Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1545498rwd; Tue, 13 Jun 2023 10:29:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+NsCzfyQv+mTCUEM9ZixUZUT+I5U9QJXtvbkPcXrNG7ivF+PzUvXXKK9Aw+VfCywIsW9U X-Received: by 2002:a05:6a21:78a7:b0:10b:764b:a942 with SMTP id bf39-20020a056a2178a700b0010b764ba942mr18759428pzc.11.1686677393247; Tue, 13 Jun 2023 10:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686677393; cv=none; d=google.com; s=arc-20160816; b=E8rNE3+GT0caAxCl0uPY8OBbsLK5rwZUSc9PY1if4BxLxs4qrfwKrea1aB2D4azhIF TAWndKNyRkRd5NXkOmxyYd6oWdciUHaRStuBWWRTPSti2TBl2KjqqPYM0C45ziHfH2i7 ZlB9+4PmsCFmrq+ADgpgV0lESBlXSVzJZeKcy8KjNr+tdKnDxJ9yvU2KLBA85JSUTQ9n OXGkUnxQAAT6LN5JgMDmeS3JpEklyU2UU5YNFFF9tkI8rzgcSkKO8qC1wKdfNpEq39bF 4c3v+VEqYR8GnP+Vf1aXe+LZDR8sbcWppJdz+U/HF2GRoq/L9o9RRLUOH6nSB6ZSlbGt Sh8g== 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=KpyV3EhzZ8pJ/kL6sijT9Qng9r1uqgy3JJH17CB275I=; b=Blah+OsyryVocSQY1VkqtlJRNt6P0fun/QAhTFrwCoRjrxdjkNy7CHOUI2Hj3KE+Z5 4vUi0iFAhjO21jeF20IglPQVKaR7ZBceqfyDYCcG+8Fx1dEUU0kPFBHYo5aUPyLEzbY1 5RJNIU77EC1SEwqGrODhZysFSOWJc1M9ZoRIdgnWbE9x303ERxT1r/A8NNXWXPwLu8TV NsM3YaF5f0TdIQ+nTACqoSQnvtvTBGc/Ij/Pl0WiQZY6YNndRceMmANFpgiU8LfvEoLW 4tNql6KfU01BxFORX36k46H+zDwsZawgkmbzYnYLkaCs5XxRtBwccvDU/4/Ug4lxFqvt kn7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=bX+BdKfL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s196-20020a6377cd000000b005348977b5c5si5833178pgc.97.2023.06.13.10.29.39; Tue, 13 Jun 2023 10:29:53 -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=bX+BdKfL; 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 S238900AbjFMRW3 (ORCPT + 99 others); Tue, 13 Jun 2023 13:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238491AbjFMRWN (ORCPT ); Tue, 13 Jun 2023 13:22:13 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7357D173C; Tue, 13 Jun 2023 10:21:53 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35DEOtO6020171; Tue, 13 Jun 2023 17:21:25 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=KpyV3EhzZ8pJ/kL6sijT9Qng9r1uqgy3JJH17CB275I=; b=bX+BdKfL7I8vbYos+sRAo9fakd1FY6EqMmWlB0kkzgE0H0/VJkkK9saKpwk1DGmbBpW6 npR0nElYeuuSPekcmFUKcMlXtSMWQ9cTir4Drqns4H1R5IMPAr6cIeflfWdl0kyuwsZZ RcqECPfR6b/WkR6kgGcOuGavnp/NiwBeUKeC9F2in/ZR+MM+ALCVNeIUeDKcaMpB6gaf tgBUaqJ5rLsqL1adLtgDasBIpq7AM5At7ok8TaYbIHvtDT4pCYlrChWl01aoEIyFxOSj r2OAXVzT2yAJ8AQUbOHyWZ1PtPzlNx4CmP5ycX7ls21rVEloomRTI1ZqrbsY6Ze8HgTR Dg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r6amhj9dx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 17:21:24 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35DHLOV1004137 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 17:21:24 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:23 -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 05/25] virt: gunyah: msgq: Add hypercalls to send and receive messages Date: Tue, 13 Jun 2023 10:20:33 -0700 Message-ID: <20230613172054.3959700-6-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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-ORIG-GUID: 24fQMNosgcZwy4FCvQaybYmgwVLv9Dgz X-Proofpoint-GUID: 24fQMNosgcZwy4FCvQaybYmgwVLv9Dgz 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_20,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 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, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,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 Add hypercalls to send and receive messages on a Gunyah message queue. Reviewed-by: Alex Elder Reviewed-by: Srinivas Kandagatla Signed-off-by: Elliot Berman --- arch/arm64/gunyah/gunyah_hypercall.c | 31 ++++++++++++++++++++++++++++ include/linux/gunyah.h | 6 ++++++ 2 files changed, 37 insertions(+) diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c index ef48e0b8b5448..c5bf0dd468ec9 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_MSGQ_SEND GH_HYPERCALL(0x801B) +#define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x801C) /** * gh_hypercall_hyp_identify() - Returns build information and feature flags @@ -54,5 +56,34 @@ 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_msgq_send(u64 capid, size_t size, void *buff, u64 tx_flags, bool *ready) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_MSGQ_SEND, capid, size, (uintptr_t)buff, tx_flags, 0, &res); + + if (res.a0 == GH_ERROR_OK) + *ready = !!res.a1; + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_msgq_send); + +enum gh_error gh_hypercall_msgq_recv(u64 capid, void *buff, size_t size, size_t *recv_size, + bool *ready) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_MSGQ_RECV, capid, (uintptr_t)buff, size, 0, &res); + + if (res.a0 == GH_ERROR_OK) { + *recv_size = res.a1; + *ready = !!res.a2; + } + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_msgq_recv); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Gunyah Hypervisor Hypercalls"); diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index 6b36cf4787efb..01a6f202d037e 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -111,4 +111,10 @@ 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); +#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); +enum gh_error gh_hypercall_msgq_recv(u64 capid, void *buff, size_t size, size_t *recv_size, + bool *ready); + #endif -- 2.40.0