* [PATCH v5 0/2] Allow parameter in smc/hvc calls
@ 2023-05-06 18:24 Nikunj Kela
2023-05-06 18:24 ` [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Nikunj Kela
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Nikunj Kela @ 2023-05-06 18:24 UTC (permalink / raw)
To: sudeep.holla
Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt,
linux-arm-kernel, devicetree, linux-kernel, Nikunj Kela
Currently, smc/hvc calls are made with parameters set
to zeros. We are using multiple scmi instances within
a VM. We are sharing the same smc-id(func_id) with all
scmi instance. The hypervisor needs a way to distinguish
among hvc calls made from different instances.
This patch series introduces new compatible string which
can be used to pass shmem channel address as parameters
to smc/hvc calls.
---
v5 -> avoid computing page and offset in send function
Link: https://lore.kernel.org/all/20230418185659.29745-1-quic_nkela@quicinc.com/
v4 -> split shmem address into 4KB-pages and offset
v3 -> pass shmem channel address as parameter
v2 -> fix the compilation erros on 32bit platform(see below)
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202304100606.kUjhsRYf-lkp@intel.com/
v1 -> original patches
Nikunj Kela (2):
dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call
firmware: arm_scmi: Augment SMC/HVC to allow optional parameters
.../bindings/firmware/arm,scmi.yaml | 8 ++++-
drivers/firmware/arm_scmi/driver.c | 1 +
drivers/firmware/arm_scmi/smc.c | 30 ++++++++++++++++++-
3 files changed, 37 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call 2023-05-06 18:24 [PATCH v5 0/2] Allow parameter in smc/hvc calls Nikunj Kela @ 2023-05-06 18:24 ` Nikunj Kela 2023-05-08 17:47 ` Florian Fainelli 2023-05-06 18:24 ` [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Nikunj Kela ` (2 subsequent siblings) 3 siblings, 1 reply; 8+ messages in thread From: Nikunj Kela @ 2023-05-06 18:24 UTC (permalink / raw) To: sudeep.holla Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel, Nikunj Kela Currently, smc/hvc calls are made with smc-id only. The parameters are all set to zeros. This change defines a new compatible string that can be used to pass shmem address(4KB-page, offset) as two parameters in SMC/HVC doorbell. This is useful when multiple scmi instances are used with common smc-id. Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com> Reviewed-by: Rob Herring <robh@kernel.org> --- Documentation/devicetree/bindings/firmware/arm,scmi.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml index 5824c43e9893..ad776911f990 100644 --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml @@ -34,6 +34,10 @@ properties: - description: SCMI compliant firmware with ARM SMC/HVC transport items: - const: arm,scmi-smc + - description: SCMI compliant firmware with ARM SMC/HVC transport + with shmem address(4KB-page, offset) as parameters + items: + - const: arm,scmi-smc-param - description: SCMI compliant firmware with SCMI Virtio transport. The virtio transport only supports a single device. items: @@ -299,7 +303,9 @@ else: properties: compatible: contains: - const: arm,scmi-smc + enum: + - arm,scmi-smc + - arm,scmi-smc-param then: required: - arm,smc-id -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call 2023-05-06 18:24 ` [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Nikunj Kela @ 2023-05-08 17:47 ` Florian Fainelli 0 siblings, 0 replies; 8+ messages in thread From: Florian Fainelli @ 2023-05-08 17:47 UTC (permalink / raw) To: Nikunj Kela, sudeep.holla Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel On 5/6/23 11:24, Nikunj Kela wrote: > Currently, smc/hvc calls are made with smc-id only. The parameters are > all set to zeros. This change defines a new compatible string that can > be used to pass shmem address(4KB-page, offset) as two parameters in > SMC/HVC doorbell. > > This is useful when multiple scmi instances are used with common smc-id. > > Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com> > Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -- Florian ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters 2023-05-06 18:24 [PATCH v5 0/2] Allow parameter in smc/hvc calls Nikunj Kela 2023-05-06 18:24 ` [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Nikunj Kela @ 2023-05-06 18:24 ` Nikunj Kela 2023-05-08 17:46 ` Florian Fainelli 2023-05-09 16:01 ` [PATCH v5 0/2] Allow parameter in smc/hvc calls Sudeep Holla 2023-05-31 12:26 ` Sudeep Holla 3 siblings, 1 reply; 8+ messages in thread From: Nikunj Kela @ 2023-05-06 18:24 UTC (permalink / raw) To: sudeep.holla Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel, Nikunj Kela This change adds support for passing shmem channel address as parameters in smc/hvc call. The address is split into 4KB-page and offset. This is useful when multiple scmi instances are using same smc-id and firmware needs to distinguish among the instances. Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com> --- drivers/firmware/arm_scmi/driver.c | 1 + drivers/firmware/arm_scmi/smc.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index e7d97b59963b..b5957cc12fee 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2914,6 +2914,7 @@ static const struct of_device_id scmi_of_match[] = { #endif #ifdef CONFIG_ARM_SCMI_TRANSPORT_SMC { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, + { .compatible = "arm,scmi-smc-param", .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 93272e4bbd12..621c37efe3ec 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -20,6 +20,23 @@ #include "common.h" +/* + * The shmem address is split into 4K page and offset. + * This is to make sure the parameters fit in 32bit arguments of the + * smc/hvc call to keep it uniform across smc32/smc64 conventions. + * This however limits the shmem address to 44 bit. + * + * These optional parameters can be used to distinguish among multiple + * scmi instances that are using the same smc-id. + * The page parameter is passed in r1/x1/w1 register and the offset parameter + * is passed in r2/x2/w2 register. + */ + +#define SHMEM_SIZE (SZ_4K) +#define SHMEM_SHIFT 12 +#define SHMEM_PAGE(x) (_UL((x) >> SHMEM_SHIFT)) +#define SHMEM_OFFSET(x) ((x) & (SHMEM_SIZE - 1)) + /** * struct scmi_smc - Structure representing a SCMI smc transport * @@ -30,6 +47,8 @@ * @inflight: Atomic flag to protect access to Tx/Rx shared memory area. * Used when operating in atomic mode. * @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 */ struct scmi_smc { @@ -40,6 +59,8 @@ struct scmi_smc { #define INFLIGHT_NONE MSG_TOKEN_MAX atomic_t inflight; u32 func_id; + u32 param_page; + u32 param_offset; }; static irqreturn_t smc_msg_done_isr(int irq, void *data) @@ -137,6 +158,10 @@ 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, "arm,scmi-smc-param")) { + scmi_info->param_page = SHMEM_PAGE(res.start); + scmi_info->param_offset = SHMEM_OFFSET(res.start); + } /* * If there is an interrupt named "a2p", then the service and * completion of a message is signaled by an interrupt rather than by @@ -179,6 +204,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo, { struct scmi_smc *scmi_info = cinfo->transport_info; struct arm_smccc_res res; + unsigned long page = scmi_info->param_page; + unsigned long offset = scmi_info->param_offset; /* * Channel will be released only once response has been @@ -188,7 +215,8 @@ 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, 0, 0, 0, 0, 0, 0, 0, &res); + arm_smccc_1_1_invoke(scmi_info->func_id, page, offset, 0, 0, 0, 0, 0, + &res); /* Only SMCCC_RET_NOT_SUPPORTED is valid error code */ if (res.a0) { -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters 2023-05-06 18:24 ` [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Nikunj Kela @ 2023-05-08 17:46 ` Florian Fainelli 0 siblings, 0 replies; 8+ messages in thread From: Florian Fainelli @ 2023-05-08 17:46 UTC (permalink / raw) To: Nikunj Kela, sudeep.holla Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel On 5/6/23 11:24, Nikunj Kela wrote: > This change adds support for passing shmem channel address as parameters > in smc/hvc call. The address is split into 4KB-page and offset. > This is useful when multiple scmi instances are using same smc-id > and firmware needs to distinguish among the instances. > > Signed-off-by: Nikunj Kela <quic_nkela@quicinc.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> -- Florian ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 0/2] Allow parameter in smc/hvc calls 2023-05-06 18:24 [PATCH v5 0/2] Allow parameter in smc/hvc calls Nikunj Kela 2023-05-06 18:24 ` [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Nikunj Kela 2023-05-06 18:24 ` [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Nikunj Kela @ 2023-05-09 16:01 ` Sudeep Holla 2023-05-31 12:26 ` Sudeep Holla 3 siblings, 0 replies; 8+ messages in thread From: Sudeep Holla @ 2023-05-09 16:01 UTC (permalink / raw) To: Nikunj Kela Cc: cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel On Sat, May 06, 2023 at 11:24:26AM -0700, Nikunj Kela wrote: > Currently, smc/hvc calls are made with parameters set > to zeros. We are using multiple scmi instances within > a VM. We are sharing the same smc-id(func_id) with all > scmi instance. The hypervisor needs a way to distinguish > among hvc calls made from different instances. > > This patch series introduces new compatible string which > can be used to pass shmem channel address as parameters > to smc/hvc calls. > > --- > v5 -> avoid computing page and offset in send function > Link: https://lore.kernel.org/all/20230418185659.29745-1-quic_nkela@quicinc.com/ > Thanks for the updated patch. I will pick this up for v6.5 and update once queued. -- Regards, Sudeep ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v5 0/2] Allow parameter in smc/hvc calls 2023-05-06 18:24 [PATCH v5 0/2] Allow parameter in smc/hvc calls Nikunj Kela ` (2 preceding siblings ...) 2023-05-09 16:01 ` [PATCH v5 0/2] Allow parameter in smc/hvc calls Sudeep Holla @ 2023-05-31 12:26 ` Sudeep Holla [not found] ` <110da0da-211d-1a3f-e007-ddab272aece7@quicinc.com> 3 siblings, 1 reply; 8+ messages in thread From: Sudeep Holla @ 2023-05-31 12:26 UTC (permalink / raw) To: Nikunj Kela Cc: Sudeep Holla, cristian.marussi, robh+dt, krzysztof.kozlowski+dt, linux-arm-kernel, devicetree, linux-kernel On Sat, 06 May 2023 11:24:26 -0700, Nikunj Kela wrote: > Currently, smc/hvc calls are made with parameters set > to zeros. We are using multiple scmi instances within > a VM. We are sharing the same smc-id(func_id) with all > scmi instance. The hypervisor needs a way to distinguish > among hvc calls made from different instances. > > This patch series introduces new compatible string which > can be used to pass shmem channel address as parameters > to smc/hvc calls. > > [...] Applied to sudeep.holla/linux (for-next/scmi/updates), thanks! [1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call https://git.kernel.org/sudeep.holla/c/8f9d530cffc1 [2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters https://git.kernel.org/sudeep.holla/c/5f2ea10a808a -- Regards, Sudeep ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <110da0da-211d-1a3f-e007-ddab272aece7@quicinc.com>]
[parent not found: <20230630094441.fxwd4eagtj5wmbbg@bogus>]
* Re: [PATCH v5 0/2] Allow parameter in smc/hvc calls [not found] ` <20230630094441.fxwd4eagtj5wmbbg@bogus> @ 2023-06-30 15:14 ` Nikunj Kela 0 siblings, 0 replies; 8+ messages in thread From: Nikunj Kela @ 2023-06-30 15:14 UTC (permalink / raw) To: Sudeep Holla On 6/30/2023 2:44 AM, Sudeep Holla wrote: > On Wed, Jun 28, 2023 at 01:38:32PM -0700, Nikunj Kela wrote: >> On 5/31/2023 5:26 AM, Sudeep Holla wrote: >>> On Sat, 06 May 2023 11:24:26 -0700, Nikunj Kela wrote: >>>> Currently, smc/hvc calls are made with parameters set >>>> to zeros. We are using multiple scmi instances within >>>> a VM. We are sharing the same smc-id(func_id) with all >>>> scmi instance. The hypervisor needs a way to distinguish >>>> among hvc calls made from different instances. >>>> >>>> This patch series introduces new compatible string which >>>> can be used to pass shmem channel address as parameters >>>> to smc/hvc calls. >>>> >>>> [...] >>> Applied to sudeep.holla/linux (for-next/scmi/updates), thanks! >> Hi Sudeep, our hypervisor team is evaluating other scmi transport >> options(including new qcom specific transport) along with this one so there >> is a possibility that we might not use this solution. If you think this >> patch is not useful to others, you can hold off its merge. Sorry about the >> last minute inconvenience. > Firstly, not sure why you took this in private. I am going to reply on the > list and from now on I will never trust or rush to take any Qualcomm changes. > Nothing personal but I have to follow that to keep it simple. It is in > Linux tree yesterday or today and yes it is too late. I understand your frustration and trust me I am even more disappointed by the decision by our hypervisor team and that too this late. My efforts on this series are all wasted. If you like me to post a revert of this patch series, I will be happy to do that. Please don't let this one example reflect whole Qualcomm culture. Again, extremely sorry about all the efforts you put in. > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-04 19:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-06 18:24 [PATCH v5 0/2] Allow parameter in smc/hvc calls Nikunj Kela
2023-05-06 18:24 ` [PATCH v5 1/2] dt-bindings: firmware: arm,scmi: support for parameter in smc/hvc call Nikunj Kela
2023-05-08 17:47 ` Florian Fainelli
2023-05-06 18:24 ` [PATCH v5 2/2] firmware: arm_scmi: Augment SMC/HVC to allow optional parameters Nikunj Kela
2023-05-08 17:46 ` Florian Fainelli
2023-05-09 16:01 ` [PATCH v5 0/2] Allow parameter in smc/hvc calls Sudeep Holla
2023-05-31 12:26 ` Sudeep Holla
[not found] ` <110da0da-211d-1a3f-e007-ddab272aece7@quicinc.com>
[not found] ` <20230630094441.fxwd4eagtj5wmbbg@bogus>
2023-06-30 15:14 ` Nikunj Kela
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).