Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6104327rwd; Mon, 5 Jun 2023 13:06:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hzuBpe8Iv8sdMYK4DesEAarGW4iyipKDdc6OwCunaRJdPoeRU9fT0TSnsCqsxR70te+9p X-Received: by 2002:aca:210a:0:b0:39c:4553:9644 with SMTP id 10-20020aca210a000000b0039c45539644mr315985oiz.42.1685995618510; Mon, 05 Jun 2023 13:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685995618; cv=none; d=google.com; s=arc-20160816; b=iPkSbdRmDQ+/h/KVlaG7YEtTgpKa3tFP668+lDQRCmL5oBUD8RKEUQjXBU9gl33B6f yaRBjOJ70JW77jB9n4aoGkQ4qQtJcCGxnfe8lvhdLOz+BmOkEVPxhzzC3oM8J5YW4UVi xEtM4yQbCz8NJDFfx7+5eNnipiSNNiJOyOBXyoYXZ0ZarmNX/zK3h0SAgrMRZwpvmlES jKw3txpPJLQz764IRln9wvNt3o3PXwBxdgWuZ3a7r2Nr+gKYFm/IJ4Ofjjd194Fa7KZl HvQMxNTD4MZxBt1b5ojn6O90F15udnfPRBV6z4W6Q6drIE4OferUbI/UBnu8ml9VVcFj Jx6g== 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=dcbJythIts0cc1fwWPeCEyFxBgVskDL8p0CqCKAVuC4=; b=inHoExD/x3MafFsrZqlFTgFMmmV6tBa8BnxraQ0Cp+jG5pW7PfdV3IWCBqMN3GV2LU ZG15RcpNCed0vUG7ba+HUxRWdCRcSdQSvSz3NSSUYcVjJA/jufZw1TPi5qGJQkqRcD8f YRa9H8RGPiv25dDPzU4kWTFzboUkaelfBVCJMITN5xW5UhZLEV6SC8gAP6SmcLt28Ztm RjIddNGYBolxugEroGQYQMfTcA8cLeFIrN6XkzSdcxJjN3ncZvp8gqlmCuCWDMMLNkdY 3EKzPCT1+5titpt4IbixfCs1uLdC6zgjtkLyfi86UD+zUAnD+59NrOIXLjJIAks/33Kz s7yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HujNsIzV; 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 o3-20020a0562140e4300b006253099010asi5386551qvc.588.2023.06.05.13.06.43; Mon, 05 Jun 2023 13:06:58 -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=HujNsIzV; 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 S235853AbjFETrv (ORCPT + 99 others); Mon, 5 Jun 2023 15:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235857AbjFETrm (ORCPT ); Mon, 5 Jun 2023 15:47:42 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7833106 for ; Mon, 5 Jun 2023 12:47:39 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-33bbc91dcb7so26792485ab.3 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=Vvqi0WeJwd2ieXK48HuAPOBPL0Ha45VXQbrGPx02/8KouTsZmKl0Flf1PeZplMi3zb uTb+hl/oCstx2JcGlrolfdIkk8dBakvsOMWJu/C+bKh4SWa9h2KhcYTLeAWN7l8ITSp8 iZ0kHMVSOwpQwLj71kfz8oj6eioz5KJxCTD6zw37eOvLFDIBAC2mbrTJ/pJ3N3m0u8S+ U7jgcEMsk6wePcx0L44Q7NRoOJY40EodIB5Pn/rQ3P7UFGXgvG3cl8CwqrqizUqdC9hW rZOvJ4NZg4Z92A6335yP3kag0vF0wYuXjTZzj221Wc/atRX3oNJTmNd6/W+RUZ3aAdP1 xzmw== X-Gm-Message-State: AC+VfDxdq9JCVNz3D0mKQ5k6aCm5zpXtd4tQf/3nwM1kJZqCmVA2BgTY RXd9jdr1h0KAtwsEbFdJ7AsOIA== 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 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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