From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C2B2C77B73 for ; Mon, 5 Jun 2023 19:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235842AbjFETrq (ORCPT ); Mon, 5 Jun 2023 15:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235850AbjFETrl (ORCPT ); Mon, 5 Jun 2023 15:47:41 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90DF7103 for ; Mon, 5 Jun 2023 12:47:39 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-33b204f0ca0so26833165ab.2 for ; Mon, 05 Jun 2023 12:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685994459; x=1688586459; 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=dcbJythIts0cc1fwWPeCEyFxBgVskDL8p0CqCKAVuC4=; b=HujNsIzVmnL4LWFyMOxiap2Os2d1sMZjg0ElZcdznLxfye470Ws7kdmFle1fHPXj8F eNpUtyLvsqUEg2Rvml98si8zE86dF6KKzyoBUTIM/REFv+J1BqlIHQBqOuxayDQpmoGo qvHPtgaqw77cqtq0/t6CI3wvg2d5KISEH5JTpNuCtlymd9pdUshGeFBbc3fOJje4Fy9h Fls13CO3scJjq56MWlxKEHgfRBzw4B4QmYptGYINYTQuUwICUc2tsGOVg+5VrH5dCr39 SkiZQyxnxFnWVflcV0IGIg4JR53NXwmAocMPe7ylQl1I3SKFdpxX67EBZPZLrQDM2ZMk 2Tyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685994459; x=1688586459; 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=dcbJythIts0cc1fwWPeCEyFxBgVskDL8p0CqCKAVuC4=; b=kd3vi74yo++/n7/HAqatZyr6huhmHj/FUrnSJWCqwKA82bvPgF+sL00fBIYBVIRFuh IvpZ2YUB7v9sCNlq+O/YVkoo9SiJr1LUaoX/eVLKCsfqmF3m8uM2AHDoW0VOXwt8hkTP NYP5fnbzn1V0UP7bpPQfv8CBmKzCRKcQSwozs2+2TkGnzKD9btnlcXQePgTMzkQLohL6 Xh40aMDftQtZufp1Toj6iLqbe5UE8ID6fn4UpI1N0apCp27he+cRu+Gwusln+sZ8atu+ Yk6zzubyGrUz1rLE42EroDxiOb7fG/tSo8BiptJltDUtwW8wxiLpGJ5mN7aFNkDAJtbl EsHw== X-Gm-Message-State: AC+VfDxU1/UnwGx06leAg4agiaQCt1IqV4vhpgcQsbczyNLEIuakvi37 s1ySqOdA/4rTg+6dk0F/T30ACg== X-Google-Smtp-Source: ACHHUZ4uyBenlMorqz51x6ZjxUg87PZ+PunoQonsP28HyrxBRkvYwflwlB1KDimnYtyVfP2QCcz+VA== X-Received: by 2002:a92:cd09:0:b0:33a:efd3:add3 with SMTP id z9-20020a92cd09000000b0033aefd3add3mr86093iln.14.1685994459287; Mon, 05 Jun 2023 12:47:39 -0700 (PDT) Received: from [172.22.22.28] ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id z4-20020a92cd04000000b003248469e5easm2523401iln.43.2023.06.05.12.47.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jun 2023 12:47:38 -0700 (PDT) Message-ID: <94dac3b3-79b1-125f-31a9-8d19cae23773@linaro.org> Date: Mon, 5 Jun 2023 14:47:37 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Alex Elder Subject: Re: [PATCH v13 04/24] 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: <20230509204801.2824351-1-quic_eberman@quicinc.com> <20230509204801.2824351-5-quic_eberman@quicinc.com> Content-Language: en-US In-Reply-To: <20230509204801.2824351-5-quic_eberman@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 5/9/23 3:47 PM, Elliot Berman wrote: > Add hypercalls to send and receive messages on a Gunyah message queue. > > Signed-off-by: Elliot Berman I continue to dislike the long lines, but aside from that this looks fine. Reviewed-by: Alex Elder > --- > 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 2166d5dab869..2b2a63e9b9e5 100644 > --- a/arch/arm64/gunyah/gunyah_hypercall.c > +++ b/arch/arm64/gunyah/gunyah_hypercall.c > @@ -33,6 +33,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 > @@ -52,5 +54,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 6b36cf4787ef..01a6f202d037 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