From patchwork Mon Dec 19 22:58:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 34818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2662221wrn; Mon, 19 Dec 2022 15:04:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsaNq09GijpE42+vQX0gWgCJLRr6n3XxM5XAaV34wsblnzXEcjnqDECA7s0XGO40Fh39aKY X-Received: by 2002:a17:902:f607:b0:186:8d78:740c with SMTP id n7-20020a170902f60700b001868d78740cmr15002924plg.6.1671491093470; Mon, 19 Dec 2022 15:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671491093; cv=none; d=google.com; s=arc-20160816; b=ZEweaxvADNe5LkezTjqbAi9xcdpZp9HfZqq/ask+MNDcuZxj4dyuRtR23kNgDcXDb2 gzv5dYw4mayBlkkvkGKXamTGGDe77PK6bI0/B0WhqqLdIiKq+ffU6v/n7lh1hNQ+6d6+ cGSIRUfy53WvCK++UMfwIYrFyBJvk78KDyvq+hiIq5M0H63TBC+bk2DlF4VJckzKvvoa o495aKCCs5qUbCxahM4ZilEubCgRkmDyOmSpwcHpDVLGF/98R0mWXmshcMl0xZrQTBMQ /7SKfEhgMmeHX5Kfv4c8ylIrIa0GHh3pB1BqKBziaJHpLHgRRPSIHBHtxkHmiVh7fjl4 VDNg== 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=iYweQv3PzZF7Arr6/aTL5AojEd8q8UfNKCO0tinlKwU=; b=RFAmwgBwLGoyEe/chSHdMcQyD3zvEaDahTQa4j2UKvepE+C7hg/9ZZGaaaJtEQu2Oa OPoCTDvNsCIyJKit0yd+FlIdMKxA9q11S+YeZ6iUesCkyXQ3CY+8eoL/NhTrfu8VjuQi eZCitUz6kE3EHTGB1oeLPuCPQHRQxAbidYE1be+L6e91s2ubpMYuNVvIovFLLN6soJFZ QxMIvPMyRkpuCYnLoQxlJAATRBr8ROEHUQ8eENj8CaA33ROAnSha9UHc4RX8QozLY8yU 7g2nIp6bVp6sBa1alH/Hj2Y8xQc7e3o/AFA1UJaVfSrYbaretFlV2K4mZYGErTTcsx7W 7Y1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=cLfMLaGP; 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 e16-20020a170902ef5000b0019103860c7asi11408654plx.530.2022.12.19.15.04.40; Mon, 19 Dec 2022 15:04:53 -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=qcdkim header.b=cLfMLaGP; 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 S233129AbiLSXEH (ORCPT + 99 others); Mon, 19 Dec 2022 18:04:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232971AbiLSXCK (ORCPT ); Mon, 19 Dec 2022 18:02:10 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF3812ACE; Mon, 19 Dec 2022 15:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1671490858; x=1703026858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iYweQv3PzZF7Arr6/aTL5AojEd8q8UfNKCO0tinlKwU=; b=cLfMLaGPiVLRASxlmDtaNkILDRz9fMsBa+ne0Db2n1O2jBjrvF6JURaR uCMODnPlD6QvQaVBrwvkIuL5/5qyPMC7Yjb6hA/Vc3gvc6BBxaY6cX8UV 7n7U6c5H+9l6vJeTaZ7VwjFCovxqsfpbJHhDCXG22Owv7/XloM4EejD0k I=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 19 Dec 2022 15:00:54 -0800 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 15:00:54 -0800 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; Mon, 19 Dec 2022 15:00:53 -0800 From: Elliot Berman To: Bjorn Andersson , Elliot Berman , Murali Nalajala , Catalin Marinas , Will Deacon CC: Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Prakruthi Deepak Heragu , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Bagas Sanjaya" , Jassi Brar , "Sudeep Holla" , Mark Rutland , "Lorenzo Pieralisi" , Dmitry Baryshkov , , , , , , Subject: [PATCH v8 26/28] virt: gunyah: Add hypercalls for sending doorbell Date: Mon, 19 Dec 2022 14:58:47 -0800 Message-ID: <20221219225850.2397345-27-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219225850.2397345-1-quic_eberman@quicinc.com> References: <20221219225850.2397345-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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1752685444533470715?= X-GMAIL-MSGID: =?utf-8?q?1752685444533470715?= 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 | 27 +++++++++++++++++++++++++++ include/linux/gunyah.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c index dc42a4e6bd7c..00c5f91b96fd 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -26,6 +26,8 @@ GH_FN_ID(GH_CALL_TYPE_HYPERCALL, fn)) #define GH_HYPERCALL_HYP_IDENTIFY GH_HYPERCALL(0x0000) +#define GH_HYPERCALL_DBL_SEND GH_HYPERCALL(0x0012) +#define GH_HYPERCALL_DBL_SET_MASK GH_HYPERCALL(0x0015) #define GH_HYPERCALL_MSGQ_SEND GH_HYPERCALL(0x001B) #define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x001C) #define GH_HYPERCALL_VCPU_RUN GH_HYPERCALL(0x0065) @@ -68,6 +70,31 @@ void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identi } EXPORT_SYMBOL_GPL(gh_hypercall_hyp_identify); +int gh_hypercall_dbl_send(u64 capid, u64 new_flags, u64 *old_flags) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_DBL_SEND, capid, new_flags, 0, &res); + + if (res.a0) + return res.a0; + + *old_flags = res.a1; + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_dbl_send); + +int gh_hypercall_dbl_set_mask(u64 capid, u64 enable_mask, u64 ack_mask) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_DBL_SET_MASK, capid, enable_mask, ack_mask, 0, &res); + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_dbl_set_mask); + int gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready) { struct arm_smccc_res res; diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index 42160b4de834..2c2b498a792d 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -163,6 +163,9 @@ static inline u16 gh_api_version(void) void gh_hypercall_get_uid(u32 uid[4]); void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identity); +int gh_hypercall_dbl_send(u64 capid, u64 new_flags, u64 *old_flags); +int gh_hypercall_dbl_set_mask(u64 capid, u64 enable_mask, u64 ack_mask); + #define GH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0) int gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready);