From patchwork Tue Jun 13 17:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 107475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp712963vqr; Tue, 13 Jun 2023 10:26:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XVaVJ0UjQwZrfcdMnCCqtPzlpVYK+IO3+9EUoJ8m3o5N8vzgEKatqoBTI45BsKVhNbW6Z X-Received: by 2002:a17:906:6a16:b0:961:b0:3dfd with SMTP id qw22-20020a1709066a1600b0096100b03dfdmr14243775ejc.7.1686677196682; Tue, 13 Jun 2023 10:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686677196; cv=none; d=google.com; s=arc-20160816; b=VGmAxMMDkmbJHMxA//qVw4JlwIa8BX9ujClFYjhf1/TQE5bI06VirOOcjjIU64vvQw qHFobvO3RkHzdkrXwNw+mkmBJx6HKbnHiXLNORck5cUonHi0/zQVmxyMR8r/5WQpj3Ih pGV7q6UmH4Ul4K38BejBu47WdK57SI2lCu8iTq1BBUogAvTjcwDAkmJHEfzLm3nKCHOC Zq5M5ELReNp4eDI6T61oxzBufTCGAjlINkzVS9LEeNSvlDJxNkLSlzGaWETaxuRPAFqN BTjvpbLHngJ1aFXgrcWQn/KkkqJHdfrgf6k2SCPwhX3gp08nRxc5ZCYJz/lq79bZA/u6 xtKA== 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=NSCOZ7VSWpZwQV9qvmb1c2Vez+hFpRt/AqMP2FgNDQ0=; b=tlHt4J50+Q/FRP8NRcum4o1iMt/yIB2O0WQOBB3f0CWg8BoUIzSRDDQM/ilIDhg7Gr irddDQgc4vvT1cH4WBdxo6uPPp7mP+CaXQRL7bAics+NA6br4tzFFrLwmDx0Bq+Ln8uh R3AXOLrknB791/MFQx172Y/fN+eWwU4GKWZ9ze38b/G+Q8vViuPUekPIWc9W4/Cf210R yep6egC4X5mEFB4CN77Z/DkYwvXsWnYiooSKSr+57S54X9B/lcGxNNDaUXrHaUBfnTq8 /7WnoDrUlDotAJViBntEqPbtTXcGDHPwt4szI/QMlot8OWHvFROdEkQ53O1DdCOQKoR3 Ve4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZMtmTfRz; 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 rv26-20020a17090710da00b00965ffb6e3d0si6955221ejb.94.2023.06.13.10.26.11; Tue, 13 Jun 2023 10:26:36 -0700 (PDT) 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=ZMtmTfRz; 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 S239086AbjFMRYT (ORCPT + 99 others); Tue, 13 Jun 2023 13:24:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbjFMRXr (ORCPT ); Tue, 13 Jun 2023 13:23:47 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FAE42701; Tue, 13 Jun 2023 10:22:25 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35DDE9mR017030; Tue, 13 Jun 2023 17:21:54 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=NSCOZ7VSWpZwQV9qvmb1c2Vez+hFpRt/AqMP2FgNDQ0=; b=ZMtmTfRzys/i5SqABaIvg3OLXexumFcanti974C1zJ0zTPV0LsuvOobrVfJVNqY1ZRp0 4rKEkji0bzS+MQpknZFX9Of8HXbcH4465O2AA7TVq9MOMKHYt+DgOL3CciNWP4zJzl5o QYtL+5UpmEsf3l65rxWpUXt5GB5VTfKJ9uvSZg8/8RqvtrziSAX0hx1Bv1F8XlxA8mBY J5U8S6URLrIOkTR01HerLWPs74hNj4lF+0Hbj7nBfFbSFz2FOu4LZyH7vFjyGBWzf7cV 4nmUStBdFFjBETBMeBCu/FieqD6flTHDoZiHb5AAhgqN/kZrfgKI2qZQNvuQCFG2fQn7 7Q== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r68x9ae1f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 17:21:54 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35DHLsam021363 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 17:21:54 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.42; Tue, 13 Jun 2023 10:21:53 -0700 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 , Conor Dooley , Jonathan Corbet , Bagas Sanjaya , Andy Gross , Jassi Brar , , , , , Subject: [PATCH v14 22/25] virt: gunyah: Add hypercalls for sending doorbell Date: Tue, 13 Jun 2023 10:20:50 -0700 Message-ID: <20230613172054.3959700-23-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230613172054.3959700-1-quic_eberman@quicinc.com> References: <20230613172054.3959700-1-quic_eberman@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: V5VLIexiiqSQyzT4qX_q9Ps_8Zytzvv6 X-Proofpoint-ORIG-GUID: V5VLIexiiqSQyzT4qX_q9Ps_8Zytzvv6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-13_19,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 suspectscore=0 mlxlogscore=842 mlxscore=0 adultscore=0 malwarescore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130153 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768609228110323864?= X-GMAIL-MSGID: =?utf-8?q?1768609228110323864?= Gunyah doorbells allow two virtual machines to signal each other using interrupts. Add the hypercalls needed to assert the interrupt. Reviewed-by: Alex Elder 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 7d96491f84e00..e178b5a0f6917 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -35,6 +35,8 @@ EXPORT_SYMBOL_GPL(arch_is_gh_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) @@ -57,6 +59,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) + *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, void *buff, u64 tx_flags, bool *ready) { struct arm_smccc_res res; diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index cd5704a82c6a5..1f1685518bf3c 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -171,6 +171,9 @@ static inline u16 gh_api_version(const struct gh_hypercall_hyp_identify_resp *gh 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, void *buff, u64 tx_flags, bool *ready);