From patchwork Tue Feb 14 21:26:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 57227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3208460wrn; Tue, 14 Feb 2023 13:29:07 -0800 (PST) X-Google-Smtp-Source: AK7set8+ydt7QuBbIPhOqiBPbmFjwr5sNs6IYyoNtytavzRswsBC9H3AWZivqxaV5y6da7i6nAEl X-Received: by 2002:a05:6a20:691a:b0:be:e0c3:5003 with SMTP id q26-20020a056a20691a00b000bee0c35003mr4523495pzj.5.1676410146811; Tue, 14 Feb 2023 13:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676410146; cv=none; d=google.com; s=arc-20160816; b=SzI3o7Y0fpSOYviZK8HFGbUsf1Yoirg920dcPwmWlxzCO2O49nDzLnJDqO61tzVrOL QMbHZqd8zFCjWKG6S/EdLTHNEXnUd/Xj7H/czvMJWl5xjuHDLEow8gpiyGhOYZEsRTod u+f3Fb0drG3v6vdpNH+Rhz2j0T8YhlsV8zUOjR/R9VtQaP9h4nON20qbjd0uTV53Hre/ 4b35UZsMRGXtN2H+YVT9JuNVCbkx1Qp/Pf6qVz9zVivd+JHzC000v/vR0wbSkkTS7cXE 7SoZj996tI4OkR1f7TcdxQz6X1GGYpJfh8UAajj7jZNlLwx1PL4PGfq9hLPG5kxCuUqi KUuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=obyoAyuAjuu3vuNVMV1Ga1m99m6o20IntGSnJs/cUlY=; b=BGVEBVJXNJb6aoblBnDfXi4GmzznxKLDv66XpqOVdCDDSau1+5I0N8aH6Hy320wYqw nV0amQw/lS22inZB4+PqlYlb/Xm+mpnX0OK0gEsuP9XLhxH1DOalndVxP84/bZyN112f OuunLdx3vpdNpyHQOJys4fp15B5rnlvnnNjPftcDN1F0+rHsa+T8SCu8COIVN0wlJC+4 lbpIIdOJCQIxotQ/PV+CsO9M7IutbQzs4xSUNqI8tqcEP1eRrIjg5o2E9y6DomSTI4Ul UXH48CYG5aEds4vbq4m84sC4uXYfUG7yRQMOXnT3r14JfY17IS+5LLpJ0L1ECv7F1xkn ItbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="UoqG/nGv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m192-20020a633fc9000000b004fbd435fc2esi3884953pga.447.2023.02.14.13.28.54; Tue, 14 Feb 2023 13:29:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="UoqG/nGv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbjBNV2N (ORCPT + 99 others); Tue, 14 Feb 2023 16:28:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233079AbjBNV1x (ORCPT ); Tue, 14 Feb 2023 16:27:53 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2897D21968; Tue, 14 Feb 2023 13:27:30 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31EK7bg0003281; Tue, 14 Feb 2023 21:26:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=obyoAyuAjuu3vuNVMV1Ga1m99m6o20IntGSnJs/cUlY=; b=UoqG/nGvpgV6XUM2ExnjVYfVtjH1jjz6+Vq7O+mR6fvsraUd3/qkBGJ3g/u3o77Kz/Io u7WrrbGx+DOQW/cJArxvil9ahJs2+1R/QV9r+CPLsNgJo7DfvOX1tSAHGsU7833LfvuO XBi2QE0Eqz69CFeLxfPca4TP7gDgrvbAEsSZVUAk2zNJdPt8OSGAoEtQabEWBRcPk0WC f6KcnAzykdRHpG/g+i7h/nHxrdgZEUfgcPVzEKykxq+wdUHCyc8wqPRvmo6NHMv4tIWm abDp4vzBBxS/9A6YpO057qkbsD937BuzE9oxsb5WygvMxNiY8YDbdFCAag8qgfgxNtPT tg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nr6qkhxjt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Feb 2023 21:26:21 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31ELQKkc028958 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Feb 2023 21:26:20 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 14 Feb 2023 13:26:18 -0800 From: Elliot Berman To: Alex Elder , Srinivas Kandagatla , Elliot Berman , Prakruthi Deepak Heragu , Catalin Marinas , Will Deacon CC: Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Dmitry Baryshkov , Bjorn Andersson , "Konrad Dybcio" , Arnd Bergmann , "Greg Kroah-Hartman" , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Bagas Sanjaya , Jassi Brar , , , , , Subject: [PATCH v10 23/26] virt: gunyah: Add hypercalls for sending doorbell Date: Tue, 14 Feb 2023 13:26:10 -0800 Message-ID: <20230214212610.3327589-1-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214211229.3239350-1-quic_eberman@quicinc.com> References: <20230214211229.3239350-1-quic_eberman@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: _qahj_dGRK4K2TkFP_ROOyBc7CeNTUB6 X-Proofpoint-ORIG-GUID: _qahj_dGRK4K2TkFP_ROOyBc7CeNTUB6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-14_15,2023-02-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 mlxlogscore=784 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302140184 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757843445824808539?= X-GMAIL-MSGID: =?utf-8?q?1757843445824808539?= Gunyah doorbells allow two virtual machines to signal each other using interrupts. Add the hypercalls needed to assert the interrupt. Signed-off-by: Elliot Berman --- arch/arm64/gunyah/gunyah_hypercall.c | 25 +++++++++++++++++++++++++ include/linux/gunyah.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c index 260d416dd006..54e561159ac7 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -38,6 +38,8 @@ EXPORT_SYMBOL_GPL(arch_is_gunyah_guest); fn) #define GH_HYPERCALL_HYP_IDENTIFY GH_HYPERCALL(0x8000) +#define GH_HYPERCALL_BELL_SEND GH_HYPERCALL(0x8012) +#define GH_HYPERCALL_BELL_SET_MASK GH_HYPERCALL(0x8015) #define GH_HYPERCALL_MSGQ_SEND GH_HYPERCALL(0x801B) #define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x801C) #define GH_HYPERCALL_VCPU_RUN GH_HYPERCALL(0x8065) @@ -60,6 +62,29 @@ void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identi } EXPORT_SYMBOL_GPL(gh_hypercall_hyp_identify); +enum gh_error gh_hypercall_bell_send(u64 capid, u64 new_flags, u64 *old_flags) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_BELL_SEND, capid, new_flags, 0, &res); + + if (res.a0 == GH_ERROR_OK) + *old_flags = res.a1; + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_bell_send); + +enum gh_error gh_hypercall_bell_set_mask(u64 capid, u64 enable_mask, u64 ack_mask) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_BELL_SET_MASK, capid, enable_mask, ack_mask, 0, &res); + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_bell_set_mask); + enum gh_error gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready) { diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index c819df72d303..bfceaa7000e5 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -172,6 +172,9 @@ struct gh_hypercall_hyp_identify_resp { void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identity); +enum gh_error gh_hypercall_bell_send(u64 capid, u64 new_flags, u64 *old_flags); +enum gh_error gh_hypercall_bell_set_mask(u64 capid, u64 enable_mask, u64 ack_mask); + #define GH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0) enum gh_error gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags,