firmware: arm_scmi: add smc/hvc transports support
Subsystems (2)
v3 cover firmware: arm_scmi: add smc/hvc transports support
From: Peng Fan <[email protected]>
V3:
Add back arm,scmi-smc compatible string
Change smc-id to arm,smc-id
Directly use arm_smccc_1_1_invoke
Add prot_id in scmi_chan_info for per protocol shmem usage.
V2:
patch 1/2: only add smc-id property
patch 2/2: Parse smc/hvc from psci node
Use prot_id as 2nd arg when issue smc/hvc Differentiate tranports using mboxes or smc-id property
https://lore.kernel.org/patchwork/cover/1193435/
This is to add smc/hvc transports support, based on Viresh's v6. SCMI firmware could be implemented in EL3, S-EL1, NS-EL2 or other A core exception level. Then smc/hvc could be used. And for vendor specific firmware, a wrapper layer could added in EL3, S-EL1, NS-EL2 and etc to translate SCMI calls to vendor specific firmware calls.
A new compatible string arm,scmi-smc is added. arm,scmi is still for mailbox transports.
All protocol share same smc/hvc id, the protocol id will be take as 2nd arg when issue smc/hvc.
Each protocol could use its own shmem or share the same shmem Per smc/hvc, only Tx supported.
Peng Fan (2):
dt-bindings: arm: arm,scmi: add smc/hvc transport
firmware: arm_scmi: add smc/hvc transport
Documentation/devicetree/bindings/arm/arm,scmi.txt | 3 +- drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/common.h | 3 + drivers/firmware/arm_scmi/driver.c | 2 + drivers/firmware/arm_scmi/smc.c | 146 +++++++++++++++++++++ 5 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 drivers/firmware/arm_scmi/smc.c
Signature · 1 line
2.16.4
PATCH v3 1/2 dt-bindings: arm: arm,scmi: add smc/hvc transport
From: Peng Fan <[email protected]>
SCMI could use SMC/HVC as tranports. Since there is no standardized id, we need to use vendor specific id. So add into devicetree binding doc.
Also add arm,scmi-smc compatible string for smc/hvc transport
--- Documentation/devicetree/bindings/arm/arm,scmi.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/arm,scmi.txt +2 -1
@@ -14,7 +14,7 @@ Required properties: The scmi node with the following properties shall be under the /firmware/ node. -- compatible : shall be "arm,scmi" +- compatible : shall be "arm,scmi" or "arm,scmi-smc" for smc/hvc transports - mboxes: List of phandle and mailbox channel specifiers. It should contain exactly one or two mailboxes, one for transmitting messages("tx") and another optional for receiving the notifications("rx") if
@@ -25,6 +25,7 @@ The scmi node with the following properties shall be under the /firmware/ node. protocol identifier for a given sub-node. - #size-cells : should be '0' as 'reg' property doesn't have any size associated with it. +- arm,smc-id : SMC id required when using smc or hvc transports Optional properties:
Signature · 1 line
2.16.4
PATCH v3 2/2 firmware: arm_scmi: add smc/hvc transport
In reply to [email protected]From: Peng Fan <[email protected]>
Take arm,smc-id as the 1st arg, and protocol id as the 2nd arg when issuing SMC/HVC. Since we need protocol id, so add this parameter to scmi_chan_info, then smc transport driver could directly use it. There is no Rx, only Tx because of smc/hvc not support Rx.
--- drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/common.h | 3 + drivers/firmware/arm_scmi/driver.c | 2 + drivers/firmware/arm_scmi/smc.c | 146 +++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 drivers/firmware/arm_scmi/smc.c
drivers/firmware/arm_scmi/Makefile +1 -1
@@ -2,6 +2,6 @@ obj-y = scmi-bus.o scmi-driver.o scmi-protocols.o scmi-transport.o scmi-bus-y = bus.o scmi-driver-y = driver.o -scmi-transport-y = mailbox.o shmem.o +scmi-transport-y = mailbox.o shmem.o smc.o scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
drivers/firmware/arm_scmi/common.h +3 -0
@@ -162,11 +162,13 @@ int scmi_base_protocol_init(struct scmi_handle *h);* channel * @handle: Pointer to SCMI entity handle * @transport_info: Transport layer related information +* @prot_id: The id of the protocol that will use this channel */ struct scmi_chan_info {struct device *dev;struct scmi_handle *handle;void *transport_info; +int prot_id; };/**
@@ -210,6 +212,7 @@ struct scmi_desc { };extern const struct scmi_desc scmi_mailbox_desc; +extern const struct scmi_desc scmi_smc_desc;void scmi_rx_callback (struct scmi_chan_info *cinfo,u32 msg_hdr);void scmi_free_channel (struct scmi_chan_info *cinfo,struct idr *idr,int id);
drivers/firmware/arm_scmi/driver.c +2 -0
@@ -606,6 +606,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device *dev,return ret; } + cinfo->prot_id = prot_id; cinfo->handle = &info->handle;return 0 ; }
@@ -827,6 +828,7 @@ ATTRIBUTE_GROUPS(versions);/* Each compatible listed below must have descriptor associated with it */ static const struct of_device_id scmi_of_match[] = { { .compatible ="arm,scmi" , .data = &scmi_mailbox_desc }, + { .compatible ="arm,scmi-smc" , .data = &scmi_smc_desc}, {/* Sentinel */ }, };
drivers/firmware/arm_scmi/smc.c new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
2.16.4
Re: [PATCH V3 2/2] firmware: arm_scmi: add smc/hvc transport
Quoted 4 lines · On Wed, Feb 26, 2020 at 03:12:51PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
Take arm,smc-id as the 1st arg, and protocol id as the 2nd arg when issuing SMC/HVC. Since we need protocol id, so add this parameter
And why do we need protocol id here ? I couldn't find it out myself. I would like to know why/what/how is it used in the firmware(smc/hvc handler). I hope you are not mixing the need for multiple channel with protocol id ? One can find out id from the command itself, no need to pass it and hence asking here for more details.
Signature · 2 lines
Regards, Sudeep
RE: [PATCH V3 2/2] firmware: arm_scmi: add smc/hvc transport
Hi Sudeep,
Quoted 5 lines
Subject: Re: [PATCH V3 2/2] firmware:
arm_scmi: add smc/hvc transportQuoted 2 lines · On Wed, Feb 26, 2020 at 03:12:51PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
Quoted 8 lines
Quoted 2 lines
Take arm,smc-id as the 1st arg, and protocol id as the 2nd arg when issuing SMC/HVC. Since we need protocol id, so add this parameter
And why do we need protocol id here ? I couldn't find it out myself. I would like to know why/what/how is it used in the firmware(smc/hvc handler). I hope you are not mixing the need for multiple channel with protocol id ? One can find out id from the command itself, no need to pass it and hence asking here for more details.
When each protocol needs its own shmem area, we need let firmware know which shmem area to parse the message from. Without protocol id, firmware not know which shmem area should use. Hope this is clear.
Thanks,
Peng.
Quoted 4 lines
--
Regards,
Sudeep
Re: [PATCH V3 2/2] firmware: arm_scmi: add smc/hvc transport
Quoted 16 lines · Peng Fan
Hi Sudeep,
Quoted 5 lines
Subject: Re: [PATCH V3 2/2] firmware:
arm_scmi: add smc/hvc transportQuoted 2 lines · On Wed, Feb 26, 2020 at 03:12:51PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
Quoted 8 lines
Quoted 2 lines
Take arm,smc-id as the 1st arg, and protocol id as the 2nd arg when issuing SMC/HVC. Since we need protocol id, so add this parameter
And why do we need protocol id here ? I couldn't find it out myself. I would like to know why/what/how is it used in the firmware(smc/hvc handler). I hope you are not mixing the need for multiple channel with protocol id ? One can find out id from the command itself, no need to pass it and hence asking here for more details.
Quoted 4 lines
When each protocol needs its own shmem area, we need let firmware know which shmem area to parse the message from. Without protocol id, firmware not know which shmem area should use. Hope this is clear.
Not all platforms need to have a separate shmem for each protocol. Make it it separate transport.
--
Regards,
Sudeep
RE: [PATCH V3 2/2] firmware: arm_scmi: add smc/hvc transport
Quoted 21 lines
Subject: Re: [PATCH V3 2/2] firmware:
arm_scmi: add smc/hvc transportQuoted 18 lines · Peng Fan
Hi Sudeep,
Quoted 15 lines
Subject: Re: [PATCH V3 2/2] firmware:
arm_scmi: add smc/hvc transportQuoted 5 lines · On Wed, Feb 26, 2020 at 03:12:51PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
Take arm,smc-id as the 1st arg, and protocol id as the 2nd arg when issuing SMC/HVC. Since we need protocol id, so add this parameter
And why do we need protocol id here ? I couldn't find it out myself. I would like to know why/what/how is it used in the firmware(smc/hvc handler). I hope you are not mixing the need for multiple channel with protocol id ? One can find out id from the command itself, no need to pass it and hence asking here for more details.
Quoted 7 lines
Quoted 4 lines
When each protocol needs its own shmem area, we need let firmware know which shmem area to parse the message from. Without protocol id, firmware not know which shmem area should use. Hope this is clear.
Not all platforms need to have a separate shmem for each protocol. Make it it separate transport.
I added that in case somebody needs it, but actually my platform not need it. I'll remove the protocol id change in v4. If others need it in future, they could add then.
Thanks,
Peng.
Quoted 5 lines
--
Regards,
Sudeep
Quoted 9 lines
_______________________________________________
linux-arm-kernel mailing list [email protected]
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.infr
adead.org%2Fmailman%2Flistinfo%2Flinux-arm-kernel&data=02%7C01 %7Cpeng.fan%40nxp.com%7Ca9c9201db90749d46cfd08d7be9be1a2%7C686 ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637187449022127405&a mp;sdata=mwxo5a%2F4jW5ram7%2BRyHpjJ6N9ngPn5SoT4L4uq1tJ44%3D&a mp;reserved=0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel