All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node
@ 2021-06-02  7:38 Sudeep Holla
  2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sudeep Holla @ 2021-06-02  7:38 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Sudeep Holla, Cristian Marussi, Rob Herring, 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: Rob Herring <robh+dt@kernel.org>
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..7b827258e163 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_node(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] 6+ messages in thread

* [RESEND PATCH 2/2] firmware: arm_scmi: Add compatibility checks for shmem node
  2021-06-02  7:38 [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node Sudeep Holla
@ 2021-06-02  7:38 ` Sudeep Holla
  2021-06-03 12:53   ` Cristian Marussi
  2021-06-04 17:14   ` Florian Fainelli
  2021-06-03 12:52 ` [RESEND PATCH 1/2] firmware: arm_scpi: " Cristian Marussi
  2021-06-04  8:56 ` Sudeep Holla
  2 siblings, 2 replies; 6+ messages in thread
From: Sudeep Holla @ 2021-06-02  7:38 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Sudeep Holla, Cristian Marussi, Rob Herring, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Florian Fainelli, Jim Quinlan,
	Etienne Carriere

The shared memory node used for communication between the firmware and
the OS should be compatible with "arm,scmi-shmem". Add the check for the
same while parsing the node before fetching the memory regions.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Cristian Marussi <cristian.marussi@arm.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Jim Quinlan <jim2101024@gmail.com>
Cc: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/mailbox.c | 3 +++
 drivers/firmware/arm_scmi/smc.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
index 4626404be541..e3dcb58314ae 100644
--- a/drivers/firmware/arm_scmi/mailbox.c
+++ b/drivers/firmware/arm_scmi/mailbox.c
@@ -69,6 +69,9 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 		return -ENOMEM;
 
 	shmem = of_parse_phandle(cdev->of_node, "shmem", idx);
+	if (!of_device_is_compatible(shmem, "arm,scmi-shmem"))
+		return -ENXIO;
+
 	ret = of_address_to_resource(shmem, 0, &res);
 	of_node_put(shmem);
 	if (ret) {
diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
index fcbe2677f84b..bed5596c7209 100644
--- a/drivers/firmware/arm_scmi/smc.c
+++ b/drivers/firmware/arm_scmi/smc.c
@@ -76,6 +76,9 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 		return -ENOMEM;
 
 	np = of_parse_phandle(cdev->of_node, "shmem", 0);
+	if (!of_device_is_compatible(np, "arm,scmi-shmem"))
+		return -ENXIO;
+
 	ret = of_address_to_resource(np, 0, &res);
 	of_node_put(np);
 	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] 6+ messages in thread

* Re: [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node
  2021-06-02  7:38 [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node Sudeep Holla
  2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
@ 2021-06-03 12:52 ` Cristian Marussi
  2021-06-04  8:56 ` Sudeep Holla
  2 siblings, 0 replies; 6+ messages in thread
From: Cristian Marussi @ 2021-06-03 12:52 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-arm-kernel, Rob Herring, Kevin Hilman, Neil Armstrong,
	Jerome Brunet

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>

Cristian

On Wed, Jun 02, 2021 at 08:38:50AM +0100, Sudeep Holla wrote:
> 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: Rob Herring <robh+dt@kernel.org>
> 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..7b827258e163 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_node(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	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH 2/2] firmware: arm_scmi: Add compatibility checks for shmem node
  2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
@ 2021-06-03 12:53   ` Cristian Marussi
  2021-06-04 17:14   ` Florian Fainelli
  1 sibling, 0 replies; 6+ messages in thread
From: Cristian Marussi @ 2021-06-03 12:53 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-arm-kernel, Rob Herring, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Florian Fainelli, Jim Quinlan, Etienne Carriere

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>

Cristian

On Wed, Jun 02, 2021 at 08:38:51AM +0100, Sudeep Holla wrote:
> The shared memory node used for communication between the firmware and
> the OS should be compatible with "arm,scmi-shmem". Add the check for the
> same while parsing the node before fetching the memory regions.
> 
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Cristian Marussi <cristian.marussi@arm.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Jim Quinlan <jim2101024@gmail.com>
> Cc: Etienne Carriere <etienne.carriere@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/mailbox.c | 3 +++
>  drivers/firmware/arm_scmi/smc.c     | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
> index 4626404be541..e3dcb58314ae 100644
> --- a/drivers/firmware/arm_scmi/mailbox.c
> +++ b/drivers/firmware/arm_scmi/mailbox.c
> @@ -69,6 +69,9 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
>  		return -ENOMEM;
>  
>  	shmem = of_parse_phandle(cdev->of_node, "shmem", idx);
> +	if (!of_device_is_compatible(shmem, "arm,scmi-shmem"))
> +		return -ENXIO;
> +
>  	ret = of_address_to_resource(shmem, 0, &res);
>  	of_node_put(shmem);
>  	if (ret) {
> diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c
> index fcbe2677f84b..bed5596c7209 100644
> --- a/drivers/firmware/arm_scmi/smc.c
> +++ b/drivers/firmware/arm_scmi/smc.c
> @@ -76,6 +76,9 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
>  		return -ENOMEM;
>  
>  	np = of_parse_phandle(cdev->of_node, "shmem", 0);
> +	if (!of_device_is_compatible(np, "arm,scmi-shmem"))
> +		return -ENXIO;
> +
>  	ret = of_address_to_resource(np, 0, &res);
>  	of_node_put(np);
>  	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	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node
  2021-06-02  7:38 [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node Sudeep Holla
  2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
  2021-06-03 12:52 ` [RESEND PATCH 1/2] firmware: arm_scpi: " Cristian Marussi
@ 2021-06-04  8:56 ` Sudeep Holla
  2 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2021-06-04  8:56 UTC (permalink / raw)
  To: Sudeep Holla, linux-arm-kernel
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Rob Herring,
	Cristian Marussi

On Wed, 2 Jun 2021 08:38:50 +0100, Sudeep Holla wrote:
> 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.

Applied to sudeep.holla/linux (for-next/scmi), thanks!

[1/2] firmware: arm_scpi: Add compatibility checks for shmem node
      https://git.kernel.org/sudeep.holla/c/ed7ecb8839
[2/2] firmware: arm_scmi: Add compatibility checks for shmem node
      https://git.kernel.org/sudeep.holla/c/6bf7661d68

--
Regards,
Sudeep


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

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

* Re: [RESEND PATCH 2/2] firmware: arm_scmi: Add compatibility checks for shmem node
  2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
  2021-06-03 12:53   ` Cristian Marussi
@ 2021-06-04 17:14   ` Florian Fainelli
  1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-06-04 17:14 UTC (permalink / raw)
  To: Sudeep Holla, linux-arm-kernel
  Cc: Cristian Marussi, Rob Herring, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Jim Quinlan, Etienne Carriere



On 6/2/2021 12:38 AM, Sudeep Holla wrote:
> The shared memory node used for communication between the firmware and
> the OS should be compatible with "arm,scmi-shmem". Add the check for the
> same while parsing the node before fetching the memory regions.
> 
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Cristian Marussi <cristian.marussi@arm.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Jim Quinlan <jim2101024@gmail.com>
> Cc: Etienne Carriere <etienne.carriere@linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  7:38 [RESEND PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node Sudeep Holla
2021-06-02  7:38 ` [RESEND PATCH 2/2] firmware: arm_scmi: " Sudeep Holla
2021-06-03 12:53   ` Cristian Marussi
2021-06-04 17:14   ` Florian Fainelli
2021-06-03 12:52 ` [RESEND PATCH 1/2] firmware: arm_scpi: " Cristian Marussi
2021-06-04  8:56 ` Sudeep Holla

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.