linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node
@ 2021-06-01 22:51 Sudeep Holla
  2021-06-01 22:51 ` [PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
  2021-06-02  7:27 ` [PATCH 1/2] firmware: arm_scpi: " Sudeep Holla
  0 siblings, 2 replies; 14+ messages in thread
From: Sudeep Holla @ 2021-06-01 22:51 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Sudeep Holla, Cristian Marussi, Kevin Hilman, Neil Armstrong,
	Jerome Brunet

The shared memory node used for communication between the firmware and
the OS should be compatible with one of the following:
	- amlogic,meson-gxbb-scp-shmem
	- amlogic,meson-axg-scp-shmem
	- arm,juno-scp-shmem
	- arm,scp-shmem
Add the check for the same while parsing the node before fetching the memory
regions.

Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scpi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index d0dee37ad522..0fb4fe53523d 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -897,6 +897,13 @@ static const struct of_device_id legacy_scpi_of_match[] = {
 	{},
 };
 
+static const struct of_device_id shmem_of_match[] = {
+	{ .compatible = "amlogic,meson-gxbb-scp-shmem", },
+	{ .compatible = "amlogic,meson-axg-scp-shmem", },
+	{ .compatible = "arm,juno-scp-shmem", },
+	{ .compatible = "arm,scp-shmem", },
+	{ }
+};
 static int scpi_probe(struct platform_device *pdev)
 {
 	int count, idx, ret;
@@ -933,6 +940,9 @@ static int scpi_probe(struct platform_device *pdev)
 		struct mbox_client *cl = &pchan->cl;
 		struct device_node *shmem = of_parse_phandle(np, "shmem", idx);
 
+		if (!of_match_device(shmem_of_match, shmem))
+			return -ENXIO;
+
 		ret = of_address_to_resource(shmem, 0, &res);
 		of_node_put(shmem);
 		if (ret) {
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-04  9:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 22:51 [PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node Sudeep Holla
2021-06-01 22:51 ` [PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
2021-06-02  7:29   ` Sudeep Holla
2021-06-02  7:33   ` Etienne Carriere
2021-06-02  7:36     ` Sudeep Holla
2021-06-02  7:44       ` Etienne Carriere
2021-06-02  7:53         ` Sudeep Holla
2021-06-03 17:18           ` Florian Fainelli
2021-06-03 17:20             ` Florian Fainelli
2021-06-03 17:45               ` Sudeep Holla
2021-06-03 17:42             ` Sudeep Holla
2021-06-03 18:19           ` Etienne Carriere
2021-06-04  9:13             ` Sudeep Holla
2021-06-02  7:27 ` [PATCH 1/2] firmware: arm_scpi: " Sudeep Holla

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).