All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: Pass shmem address to SMCCC call
@ 2020-07-15 16:55 ` Daniele Alessandrelli
  0 siblings, 0 replies; 22+ messages in thread
From: Daniele Alessandrelli @ 2020-07-15 16:55 UTC (permalink / raw)
  To: Sudeep Holla, linux-arm-kernel
  Cc: Daniele Alessandrelli, Peng Fan, Paul J. Murphy, Paul J. Murphy,
	linux-kernel

From: Daniele Alessandrelli <daniele.alessandrelli@intel.com>

Currently, when SMC/HVC is used as transport, the base address of the
shared memory used for communication is not passed to the SMCCC call.
This means that such an address must be hard-coded into the bootloader.

In order to increase flexibility and allow the memory layout to be
changed without modifying the bootloader, this patch adds the shared
memory base address to the a1 argument of the SMCCC call.

On the Secure Monitor side, the service call implementation can
therefore read the a1 argument in order to know the location of the
shared memory to use. This change is backward compatible to existing
service call implementations as long as they don't check for a1 to be
zero.

Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Signed-off-by: Paul J. Murphy <paul.j.murphy@intel.com>
---
 drivers/firmware/arm_scmi/smc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
index 49bc4b0e8428..aef3a58f8266 100644
--- a/drivers/firmware/arm_scmi/smc.c
+++ b/drivers/firmware/arm_scmi/smc.c
@@ -21,12 +21,14 @@
  *
  * @cinfo: SCMI channel info
  * @shmem: Transmit/Receive shared memory area
+ * @shmem_paddr: Physical address of shmem
  * @func_id: smc/hvc call function id
  */
 
 struct scmi_smc {
 	struct scmi_chan_info *cinfo;
 	struct scmi_shared_mem __iomem *shmem;
+	resource_size_t shmem_paddr;
 	struct mutex shmem_lock;
 	u32 func_id;
 };
@@ -73,6 +75,7 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 		dev_err(dev, "failed to ioremap SCMI Tx shared memory\n");
 		return -EADDRNOTAVAIL;
 	}
+	scmi_info->shmem_paddr = res.start;
 
 	ret = of_property_read_u32(dev->of_node, "arm,smc-id", &func_id);
 	if (ret < 0)
@@ -109,7 +112,8 @@ static int smc_send_message(struct scmi_chan_info *cinfo,
 
 	shmem_tx_prepare(scmi_info->shmem, xfer);
 
-	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, scmi_info->shmem_paddr, 0, 0,
+			     0, 0, 0, 0, &res);
 	scmi_rx_callback(scmi_info->cinfo, shmem_read_header(scmi_info->shmem));
 
 	mutex_unlock(&scmi_info->shmem_lock);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-07-17 18:02 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 16:55 [PATCH] firmware: arm_scmi: Pass shmem address to SMCCC call Daniele Alessandrelli
2020-07-15 16:55 ` Daniele Alessandrelli
2020-07-15 22:43 ` Florian Fainelli
2020-07-15 22:43   ` Florian Fainelli
2020-07-16 14:13   ` Daniele Alessandrelli
2020-07-16 14:13     ` Daniele Alessandrelli
2020-07-16 19:57     ` Florian Fainelli
2020-07-16 19:57       ` Florian Fainelli
2020-07-17 10:31       ` Sudeep Holla
2020-07-17 10:31         ` Sudeep Holla
2020-07-17 14:59         ` Daniele Alessandrelli
2020-07-17 14:59           ` Daniele Alessandrelli
2020-07-17 14:00       ` Paul Murphy
2020-07-17 14:00         ` Paul Murphy
2020-07-17 14:42       ` Daniele Alessandrelli
2020-07-17 14:42         ` Daniele Alessandrelli
2020-07-17 10:08     ` Sudeep Holla
2020-07-17 10:08       ` Sudeep Holla
2020-07-17  9:45   ` Sudeep Holla
2020-07-17  9:45     ` Sudeep Holla
2020-07-17 18:01     ` Florian Fainelli
2020-07-17 18:01       ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.