Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp38539rdg; Tue, 10 Oct 2023 03:43:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAGdDdK6YMzwwg4fL+5XEa9ddHv4dZpSjEDCelENIJcx4OMtuzLLofBQ5rNkL0CHLCtjqd X-Received: by 2002:a17:902:7248:b0:1c1:d730:f0c2 with SMTP id c8-20020a170902724800b001c1d730f0c2mr16941925pll.61.1696934599815; Tue, 10 Oct 2023 03:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696934599; cv=none; d=google.com; s=arc-20160816; b=gcBOHKhINJ6/idYtjX66fgAAKF669VpZJLG3rH7bx4mn53UNXCL1ChzCLBXrWJ8OQZ K3KQ6MtGtbMHXU/Bo/IEO6b4ISiTFmljkFT0wIpKvh1nGW/DSEIGykCWSqEVdMRkFCY0 JYHxHVeJjtdXzeaSWUkY35yXn3OZ9XdcoaaFuP7odIm31HpriqAgud6oAI0knZD34U3w IWi0Nv5a+A9K6B0tOVOVdESHBQHIJ9RE/4U/N6wBGs2/3Tyxd9B85GqNroQpZ67pUEbk +26i/swTswGuCEQYUo9DVDfo8N7XdyLjWJh8YfFjnUdtbFmtpW3IUSJvlbVdpEyaDSKD b94g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=7TAVYzakcerzeL+fiuVqv1UaOtZCVY0y+W7Xclq7eHU=; fh=P56c0mDPWWM87WjO2FiKATbC1uYqUJ4yma1naTDzAA0=; b=eZFfFN5ZQ1RKF9gweSibGwj1ehaLxkKDpvMz4oqdwGHeffF8ZTJR2/xaJSfODJmkKf RwBXTj9r1CLofyImqNpmyx7RAGky9z9b8kk05EOSp6z57uh1mIx8QvTkTNoC/UtbYNdC qxdAEPNCqZzHXpzGWp6yK7evXHeQlsAR7YaLj8BXWJxc561LgW2viJEcBRwDsX4IZ40k 67KKzUxd7b7KRJtAAreWrStItAZ+fSEj/yr7OkcZ6knbruEKZliLrIlhKh4FGfIxtvls ARVFzfTFZlfbsmDmdDuijlRq8QfOkUiOurDUSaTOPUPw9TVsdnJkW0Uql/Tqb21rBOuL kmjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c11-20020a170902d48b00b001b8a3a8d707si2794497plg.573.2023.10.10.03.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 03:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 53A03801E6A4; Tue, 10 Oct 2023 03:43:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbjJJKnA (ORCPT + 99 others); Tue, 10 Oct 2023 06:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbjJJKm7 (ORCPT ); Tue, 10 Oct 2023 06:42:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0F3CFB7; Tue, 10 Oct 2023 03:42:57 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 874F31FB; Tue, 10 Oct 2023 03:43:37 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D05F3F762; Tue, 10 Oct 2023 03:42:55 -0700 (PDT) Date: Tue, 10 Oct 2023 11:42:52 +0100 From: Sudeep Holla To: Nikunj Kela Cc: cristian.marussi@arm.com, robh+dt@kernel.org, Sudeep Holla , krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v6 2/2] firmware: arm_scmi: Add qcom smc/hvc transport support Message-ID: <20231010104252.dwix4xg766uk2y44@bogus> References: <20230718160833.36397-1-quic_nkela@quicinc.com> <20231009191437.27926-1-quic_nkela@quicinc.com> <20231009191437.27926-3-quic_nkela@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009191437.27926-3-quic_nkela@quicinc.com> X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 10 Oct 2023 03:43:16 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 12:14:37PM -0700, Nikunj Kela wrote: > This change adds the support for SCMI message exchange on Qualcomm > virtual platforms. > > The hypervisor associates an object-id also known as capability-id > with each smc/hvc doorbell object. The capability-id is used to > identify the doorbell from the VM's capability namespace, similar > to a file-descriptor. > > The hypervisor, in addition to the function-id, expects the capability-id > to be passed in x1 register when SMC/HVC call is invoked. > > The capability-id is allocated by the hypervisor on bootup and is stored in > the shmem region by the firmware before starting Linux. > > Signed-off-by: Nikunj Kela > Reviewed-by: Brian Masney > Signed-off-by: Sudeep Holla FYI for the next time. When posting on the list, the senders sign-off must be the last. The only reason I signed off is because it is needed as part of committer in the git repo. You should have ideally dropped it in this case. If there was some other author/co-developer of the patch, then your signoff will be always at the end as you are sending the patch. Refer "Sign your work - the Developer's Certificate of Origin" section in Documentation/process/submitting-patches.rst > --- > drivers/firmware/arm_scmi/driver.c | 1 + > drivers/firmware/arm_scmi/smc.c | 27 +++++++++++++++++++++++++-- > 2 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 87383c05424b..09371f40d61f 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -2915,6 +2915,7 @@ static const struct of_device_id scmi_of_match[] = { > #ifdef CONFIG_ARM_SCMI_TRANSPORT_SMC > { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, > { .compatible = "arm,scmi-smc-param", .data = &scmi_smc_desc}, > + { .compatible = "qcom,scmi-smc", .data = &scmi_smc_desc}, > #endif > #ifdef CONFIG_ARM_SCMI_TRANSPORT_VIRTIO > { .compatible = "arm,scmi-virtio", .data = &scmi_virtio_desc}, > diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c > index 8eba60a41975..7611e9665038 100644 > --- a/drivers/firmware/arm_scmi/smc.c > +++ b/drivers/firmware/arm_scmi/smc.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -50,6 +51,8 @@ > * @func_id: smc/hvc call function id > * @param_page: 4K page number of the shmem channel > * @param_offset: Offset within the 4K page of the shmem channel > + * @cap_id: smc/hvc doorbell's capability id to be used on Qualcomm virtual > + * platforms > */ > > struct scmi_smc { > @@ -63,6 +66,7 @@ struct scmi_smc { > unsigned long func_id; > unsigned long param_page; > unsigned long param_offset; > + unsigned long cap_id; > }; > > static irqreturn_t smc_msg_done_isr(int irq, void *data) > @@ -124,6 +128,7 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > bool tx) > { > struct device *cdev = cinfo->dev; > + unsigned long cap_id = ULONG_MAX; > struct scmi_smc *scmi_info; > resource_size_t size; > struct resource res; > @@ -162,6 +167,18 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > if (ret < 0) > return ret; > > + if (of_device_is_compatible(dev->of_node, "qcom,scmi-smc")) { > + void __iomem *ptr = (void __iomem *)scmi_info->shmem + size - 8; > + /* The capability-id is kept in last 8 bytes of shmem. > + * +-------+ <-- 0 > + * | shmem | > + * +-------+ <-- size - 8 > + * | capId | > + * +-------+ <-- size > + */ > + memcpy_fromio(&cap_id, ptr, sizeof(cap_id)); > + } > + > if (of_device_is_compatible(dev->of_node, "arm,scmi-smc-param")) { > scmi_info->param_page = SHMEM_PAGE(res.start); > scmi_info->param_offset = SHMEM_OFFSET(res.start); > @@ -184,6 +201,7 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > } > > scmi_info->func_id = func_id; > + scmi_info->cap_id = cap_id; > scmi_info->cinfo = cinfo; > smc_channel_lock_init(scmi_info); > cinfo->transport_info = scmi_info; > @@ -220,8 +238,13 @@ static int smc_send_message(struct scmi_chan_info *cinfo, > > shmem_tx_prepare(scmi_info->shmem, xfer, cinfo); > > - arm_smccc_1_1_invoke(scmi_info->func_id, scmi_info->param_page, > - scmi_info->param_offset, 0, 0, 0, 0, 0, &res); > + if (scmi_info->cap_id != ULONG_MAX) > + arm_smccc_1_1_invoke(scmi_info->func_id, scmi_info->cap_id, 0, > + 0, 0, 0, 0, 0, &res); > + else > + arm_smccc_1_1_invoke(scmi_info->func_id, scmi_info->param_page, > + scmi_info->param_offset, 0, 0, 0, 0, 0, > + &res); > > /* Only SMCCC_RET_NOT_SUPPORTED is valid error code */ > if (res.a0) { > -- > 2.17.1 > -- Regards, Sudeep