[PATCH 1/2] firmware: arm_scpi: Add compatibility checks for shmem node

Sudeep Holla sudeep.holla at arm.com
Wed Jun 2 00:27:58 PDT 2021


On Tue, Jun 01, 2021 at 11:51:24PM +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.
>

Ignore this patch, sent a wrong version. This breaks build...

> Cc: Kevin Hilman <khilman at baylibre.com>
> Cc: Neil Armstrong <narmstrong at baylibre.com>
> Cc: Jerome Brunet <jbrunet at baylibre.com>
> Signed-off-by: Sudeep Holla <sudeep.holla at 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))

This must be of_match_node

> +			return -ENXIO;
> +
>  		ret = of_address_to_resource(shmem, 0, &res);
>  		of_node_put(shmem);
>  		if (ret) {
> -- 
> 2.25.1
> 

-- 
Regards,
Sudeep



More information about the linux-arm-kernel mailing list