Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1159822rwl; Fri, 31 Mar 2023 07:28:28 -0700 (PDT) X-Google-Smtp-Source: AKy350Z6rYMKzkJ1IhThD3c9ghVyxnqYm4lQDzhDDNw+9FFVzceRnrbd9GqNRFvkmxWvdXu+Z3oR X-Received: by 2002:a05:6402:4315:b0:502:616b:cbd5 with SMTP id m21-20020a056402431500b00502616bcbd5mr6564023edc.2.1680272907921; Fri, 31 Mar 2023 07:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680272907; cv=none; d=google.com; s=arc-20160816; b=f+JI9Dx5bfZ/9HPz2TGth1n8NeYDUwbq4LBmZbJCim7xAuvFBoP/0u2pkw5Wy6tXQk WfPxbqVLOzqFoH4fydwbJk/Ipwxuqw1/Ia4JioUadiG5R7Pry7HbikElWrXy4CIb7dxH FggBxCmmH7koCDuX52RP7HR01Whpix+iN/KhS2NCt6HJ9PUIf+ZZ73qXTzltqpqqGr/z 8pGVLABsBq6SQ8NQlYRCxoMuObsb9Z8zanyCi6HcjsLCO+wrqPb2VQQWGrq86piRMs6a NNHqpSoTU4eOqvPGAh+BRsCL8dQrt+OCjQgfSCBBy1LGuNOkT0s/aGEdKufYIdy43Aku q8sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=u2DKRWokxdgFHFKK9gKH+IOprEI8thh0AGrCKbdGi4w=; b=nxeLGV0Scdv7ttukWEycSbanrJDFpO4Sir0Amf06r5+/goeUiq3MQtv0vcWiKY7Xs5 Dicq3Bzdvw87TBhlkn459Yx6KTrAumzfpkMggDiDTYNqUlldYhz/s1T/3jee+26n+fAk 1JxrbJBOrQbt3UQ38hgjB58Kz887tKaMgBDBnAJMnUDO7iWlh/FZDmaLdK3N/8iubo6U 7NKOIPyiWaNfbV19T4wMHWLiX8eVxGrHCJjsMb91861ItvHMudoqIh53PlvP4NoCKEYA z1r6usmouspeLcmLUDzziDGbDXMqFfwKKOHG1rYjqWCP64HwrGRlbQRbG56uR87n+PVq 7KqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RbnLRCaL; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020aa7d308000000b004fa18c459fcsi2242902edq.263.2023.03.31.07.27.56; Fri, 31 Mar 2023 07:28:27 -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=@linaro.org header.s=google header.b=RbnLRCaL; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbjCaOZW (ORCPT + 99 others); Fri, 31 Mar 2023 10:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232640AbjCaOZS (ORCPT ); Fri, 31 Mar 2023 10:25:18 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8700D20303 for ; Fri, 31 Mar 2023 07:25:04 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id j2so4556231ila.8 for ; Fri, 31 Mar 2023 07:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680272704; x=1682864704; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=u2DKRWokxdgFHFKK9gKH+IOprEI8thh0AGrCKbdGi4w=; b=RbnLRCaLKbxYJSXuHmiUbzKL6mD8U9zonSzHyaUaRB1/V3UHPD4gtQKsl6tSVwqIN9 zLvgDzW1ScNkMDyYujTOmBiyu7vtEpgCXWO272QdHB3GyVHyLS2YWk0vvydEH53kzGgS 13UVDi9Vo0e6ZaeKk3++OQ3JOAtO5JnL6AbEFVEeF0f2jb1RHcmYQrtkbmO644PzjADF ObwM41wE3xqkvkZ/F137cceCZhm0awNWBo+LbF053a0HeBlYZf7ix6o7S7u46mq3ODv7 DpZTvebnlkZoIlcEks5oYO0uUOzOMl0chxoNwbGyzFm9Let7zvln3QUlFCMDK6UXzUdq mwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680272704; x=1682864704; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u2DKRWokxdgFHFKK9gKH+IOprEI8thh0AGrCKbdGi4w=; b=g9BNsb6UB5v/fii6GPMXAjN/0ZvjnlF0qx92Gri85BlQmiIX1cadq4evbFmAxsQv2V zr99L3+0neVBPiRHHMDlfN2x2Sp5we3uvGTdAa9ZoZpt3Aa0O7GSEGKtT5dHCasOer6f OFifmroA1ilUv4VFTUHEydbiEFrP2Pl9hwZWqZJkD2MRtgSaEmKT+8mqYRHUsD+FkHhC PAxwMu4cV98tWx7Y8T6zPtFDnJizzvJMZN7RRrOMx/OyFKJtZSBQ9PkAerLzTbNU/npR sBt7dhVS+BIXgUg0F8s6QXCDtSgiGAXWZVWFL7zJQ1qyi/F8bGqfbw0zAbFqhmjSE/3O xZmA== X-Gm-Message-State: AAQBX9dQdPyBzKBKKpdaW2vJz/xS5T38u1xeGB4Wh6O5SeZGTkqHZQiE 1OEijOdzEMVKEP8k7jLzPW5VWw== X-Received: by 2002:a92:907:0:b0:326:2d3a:c770 with SMTP id y7-20020a920907000000b003262d3ac770mr6423077ilg.26.1680272704208; Fri, 31 Mar 2023 07:25:04 -0700 (PDT) Received: from [172.22.22.4] ([98.61.227.136]) by smtp.googlemail.com with ESMTPSA id m36-20020a056638272400b003c4f7dd7554sm669484jav.5.2023.03.31.07.25.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Mar 2023 07:25:03 -0700 (PDT) Message-ID: <947e17c0-c157-148c-035b-f9578466a6e1@linaro.org> Date: Fri, 31 Mar 2023 09:25:02 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 From: Alex Elder Subject: Re: [PATCH v11 06/26] virt: gunyah: msgq: Add hypercalls to send and receive messages To: Elliot Berman , Srinivas Kandagatla , 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 , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230304010632.2127470-1-quic_eberman@quicinc.com> <20230304010632.2127470-7-quic_eberman@quicinc.com> Content-Language: en-US In-Reply-To: <20230304010632.2127470-7-quic_eberman@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 3/3/23 7:06 PM, Elliot Berman wrote: > Add hypercalls to send and receive messages on a Gunyah message queue. > > Signed-off-by: Elliot Berman One comment below. -Alex > --- > 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 0d14e767e2c8..3420d8f286a9 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_MSGQ_SEND GH_HYPERCALL(0x801B) > +#define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x801C) > > /** > * gh_hypercall_hyp_identify() - Returns build information and feature flags > @@ -60,5 +62,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, int tx_flags, bool *ready) The tx_flags argument--being a mask of some kind--should be unsigned, and perhaps 64 bits wide. The only caller passes a u64 value here (which would technically be truncated). > +{ > + 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 bd080e3a6fc9..18cfbf5ee48b 100644 > --- a/include/linux/gunyah.h > +++ b/include/linux/gunyah.h > @@ -108,4 +108,10 @@ struct gh_hypercall_hyp_identify_resp { > > 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, int 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