From patchwork Sat Mar 4 01:06:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 64132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp711116wrd; Fri, 3 Mar 2023 17:10:00 -0800 (PST) X-Google-Smtp-Source: AK7set9hL4s3TNvSjHLynZU7jJh/gvkpXK/g/VCrCM2QkXxknwaID1Yy54edo4bWzV9F+x5ux+z+ X-Received: by 2002:a17:907:9713:b0:861:7a02:1046 with SMTP id jg19-20020a170907971300b008617a021046mr4861560ejc.37.1677892200439; Fri, 03 Mar 2023 17:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677892200; cv=none; d=google.com; s=arc-20160816; b=YeHimlkMbFwAz1W34Xaz0hM0kEPM+OV0A5oknMRrw6bDtkjrFoLQ4ccHDhxPSXXCsy 5uuZJ9/Y6wo7w4YLHzbNXCuMsKxwOyMmTKOC3C6mckKTV2AQ5OaC1FxJn7gvxcT2vmmJ VhpU5q/1CO23wCToIC+//1AwCgIxIvPoBQ+eJt7IAUqhYTDnmkhrIhKNtmWzb5xdshik 5TCm/roatLlSYbrjB95aKjfYOiiT47HZA1k1ix2nie1w7eCFyam1wv63o15JRoljdzHl X1ryjfGDteMtLBoMbX9CMatCqlbSzyOahsK4KTcVlz0OhRvxGMqOV9nZB08wcfZqLFY2 63iA== 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=DfRy3GvvyBk78GUTsKcTklgcl7kKoNmh7DRjvVFD040=; b=DmxzXQpVlqhx36Yk2/4E7cCO3tzjN3GGV9ROlGGtLX4i5mkS2NEowN+XnVf7nzWm9a C0MD+BFBhDNTyqOk0y5AVwdYEoYSSM6r0o8SzlXz7OhEc+VcP52WWT14YDlaN5usqrn1 t68ukuzftR1ePa6QphtdwhSpu87Y97NOiL18t56rXc95ZP3UhKI/AybEYD3crzxnIalA WDlwmxaxtIFIn/5T9eg5cBEjkUCC735IJyxHA9hURnluZlTTqVtVJoeDxKpBPG4Qkqh9 FYvuGh1gKKQckASKJ665O9OrdbrjDu3+kfZPYuTfm3XKrDCFgPM/iMIZcvtBHNsrcD/w MK8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S79rfEXV; 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 f4-20020a056402160400b004aac4b670f2si3843178edv.625.2023.03.03.17.09.34; Fri, 03 Mar 2023 17:10:00 -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=S79rfEXV; 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 S229868AbjCDBIi (ORCPT + 99 others); Fri, 3 Mar 2023 20:08:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbjCDBIT (ORCPT ); Fri, 3 Mar 2023 20:08:19 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4445C6781A; Fri, 3 Mar 2023 17:07:50 -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 3240F8Vi019324; Sat, 4 Mar 2023 01:07:20 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=DfRy3GvvyBk78GUTsKcTklgcl7kKoNmh7DRjvVFD040=; b=S79rfEXV4pdWh98610HCh6N3yO9svZkP15hDoFKYqLShwEjFgleT0rUk/YfrQmgXReSq 0VrqkIpN/s8iUmMG0VLwvs2CmMTkfP9Y3BTbRtihotXil4iU5Pdic786+yFOxu15FDSA nfTNKZVwHaIjHk1To1K7PxMlnJZZbej6zCnC5aqK/q5Pw7ZRKDJQ968IKk3GIDJ/UQlr 3RI3y+5/ktS36mI65kTqADynbIeegD8KFcFJJHiD9SHWKyQzXlv4KUxjGtcxfySqkmNG hVovQ+2WP5I0TksM2g852i4ctoIWB98iSHWRt6aEIb7DORdgKq9sOGVTty1vGQL0yCa4 ow== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p3c8htrd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 04 Mar 2023 01:07:20 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32417JOT029048 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 4 Mar 2023 01:07:19 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.41; Fri, 3 Mar 2023 17:07: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 , Andy Gross , Jassi Brar , , , , , Subject: [PATCH v11 23/26] virt: gunyah: Add hypercalls for sending doorbell Date: Fri, 3 Mar 2023 17:06:29 -0800 Message-ID: <20230304010632.2127470-24-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230304010632.2127470-1-quic_eberman@quicinc.com> References: <20230304010632.2127470-1-quic_eberman@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) 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: IiboxbtkbH4HJrmtSGSyH0Ln5QlJ8zUO X-Proofpoint-ORIG-GUID: IiboxbtkbH4HJrmtSGSyH0Ln5QlJ8zUO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-03_07,2023-03-03_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 phishscore=0 malwarescore=0 mlxlogscore=766 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303040004 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?1759397491938479048?= X-GMAIL-MSGID: =?utf-8?q?1759397491938479048?= 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 f01f5cec4d23..0f1cdb706e91 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -41,6 +41,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) @@ -63,6 +65,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, void *buff, int tx_flags, bool *ready) { struct arm_smccc_res res; diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index 37f1e2c822ce..63395dacc1a8 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -169,6 +169,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, void *buff, int tx_flags, bool *ready);