Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1106691rwb; Wed, 28 Sep 2022 13:19:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XA9raOReW7ZRBc5fP2/SU1aWDj+MHWvVG+3LkByynoSy1zWDKviTok+49Wa0KkjsboAB0 X-Received: by 2002:aa7:c6d5:0:b0:457:e34b:42ca with SMTP id b21-20020aa7c6d5000000b00457e34b42camr5595440eds.270.1664396370723; Wed, 28 Sep 2022 13:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664396370; cv=none; d=google.com; s=arc-20160816; b=WGGSRVz4WNVGZehjBBkJ7LJDccHSknF4Z4TN6kLPXj7vu8fRI2gO29TSZmGoYrO+oO qG0clsoZfMONww/z+Pz+TFmr3pyN2He0EBPIrlDTTKgbr0r8oCGw28EPyyiRHprhGEW4 HFHK7LUXDOQY6vW0wgaXaVxpUUY2Z4/cJc+JV3J5nWoqtorM43cMPuo4WuutervtRZCz VpjfVXpCIjR0NzHDGUkbExQoH8HaL+LU+IbulADBVllGLUB0Qxn4T+nnL2FmCDdxu3GA 6ZfdxgsowGUdynvLguz8MSD1M/QGWkpr46OBF8m7wqZt6xxGOo3uxvPLu4AJV7MQIvyy UeYw== 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=FiwuO7720y1R53gujahjdqSkYpeyV9KxqW1U8kdCmo0=; b=dwu/jccGR7QbYz4fDtGGwJp9KZnjcaMUIPvxXRuiZb2Fz9HwIpoHVfDZwmuUyR0pLT xsGV3G9MU5/bPCcshMn/HmhMsfgXRATkGt7gvFFVoQ/37qJLTG3S8Mok8NqXYesWsrGF ubX/bYXAcy3itenlxWxeMiz5tDGwUrJbaIzJVC7oGTC1IMgrAimnbgCdmFx501Xt9o1u FFNo9RKXOrEVFRyWgAvilBJB/upcBHOHaiL/h9zEsTCqebKKnIqHVX8iovla13XUKCxH M193CTmQNZDM0kjXfEmIyp4p6lBsLkDrTC5Ql2VKS7fQ2Dl/g0Beng/jy66yXTZwn2Ba qdiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=NLjjYBKT; 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 j2-20020a17090686c200b00779017c0aeasi5655058ejy.595.2022.09.28.13.19.04; Wed, 28 Sep 2022 13:19:30 -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=qcdkim header.b=NLjjYBKT; 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 S234486AbiI1UAp (ORCPT + 99 others); Wed, 28 Sep 2022 16:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234731AbiI1UAP (ORCPT ); Wed, 28 Sep 2022 16:00:15 -0400 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 1FC00D76; Wed, 28 Sep 2022 12:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1664395173; x=1695931173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FiwuO7720y1R53gujahjdqSkYpeyV9KxqW1U8kdCmo0=; b=NLjjYBKTKBe0iUpAmwgJK/4BfyIX7dcRZ2Uo4B638QhkfdujuZAdGSfj nWndqwklt0iWTb6H64v6q2kaidMAYjXW0KWjpVHAdQ2OC1du9uiirFtI0 VFpF9xyeqKDG0CWKgb4kKP34cMOCbRwXxXVrEi+CVTBraGXFh3nBZ1Q9z o=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Sep 2022 12:57:29 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 12:57:29 -0700 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.29; Wed, 28 Sep 2022 12:57:28 -0700 From: Elliot Berman To: Bjorn Andersson CC: Elliot Berman , Murali Nalajala , Trilok Soni , "Srivatsa Vaddagiri" , Carl van Schaik , Andy Gross , Dmitry Baryshkov , Jassi Brar , , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Will Deacon" , Catalin Marinas , "Arnd Bergmann" , Greg Kroah-Hartman , , , , Subject: [PATCH v4 08/14] virt: gunyah: msgq: Add hypercalls to send and receive messages Date: Wed, 28 Sep 2022 12:56:27 -0700 Message-ID: <20220928195633.2348848-9-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928195633.2348848-1-quic_eberman@quicinc.com> References: <20220928195633.2348848-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-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 Add hypercalls to send and receive messages on a Gunyah message queue. Signed-off-by: Elliot Berman --- arch/arm64/gunyah/hypercall.c | 33 +++++++++++++++++++++++++++++++++ include/asm-generic/gunyah.h | 5 +++++ 2 files changed, 38 insertions(+) diff --git a/arch/arm64/gunyah/hypercall.c b/arch/arm64/gunyah/hypercall.c index 5b08c9d80de0..042cca31879e 100644 --- a/arch/arm64/gunyah/hypercall.c +++ b/arch/arm64/gunyah/hypercall.c @@ -26,6 +26,8 @@ | ((fn) & GH_CALL_FUNCTION_NUM_MASK)) #define GH_HYPERCALL_HYP_IDENTIFY GH_HYPERCALL(0x0000) +#define GH_HYPERCALL_MSGQ_SEND GH_HYPERCALL(0x001B) +#define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x001C) /** * gh_hypercall_get_uid() - Returns a UID when running under a Gunyah hypervisor. @@ -67,5 +69,36 @@ void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identi } EXPORT_SYMBOL_GPL(gh_hypercall_hyp_identify); +int gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GH_HYPERCALL_MSGQ_SEND, capid, size, buff, tx_flags, 0, &res); + + if (res.a0) + return res.a0; + + *ready = res.a1; + + return res.a0; +} +EXPORT_SYMBOL_GPL(gh_hypercall_msgq_send); + +int gh_hypercall_msgq_recv(u64 capid, uintptr_t 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, buff, size, 0, &res); + + if (res.a0) + return res.a0; + + *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/asm-generic/gunyah.h b/include/asm-generic/gunyah.h index 86eb59e203ef..43915faea704 100644 --- a/include/asm-generic/gunyah.h +++ b/include/asm-generic/gunyah.h @@ -107,4 +107,9 @@ struct gh_hypercall_hyp_identify_resp { void gh_hypercall_get_uid(u32 *uid); void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identity); +#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); +int gh_hypercall_msgq_recv(u64 capid, uintptr_t buff, size_t size, size_t *recv_size, bool *ready); + #endif -- 2.25.1