linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region"
@ 2025-07-03 18:34 Rob Herring (Arm)
  2025-07-09 12:22 ` Thierry Reding
  2025-07-28 14:17 ` Jon Hunter
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2025-07-03 18:34 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter; +Cc: linux-tegra, linux-kernel

Use the newly added of_reserved_mem_region_to_resource() function to
handle "memory-region" properties.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/firmware/tegra/bpmp-tegra186.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/tegra/bpmp-tegra186.c b/drivers/firmware/tegra/bpmp-tegra186.c
index 6f0d0511b486..7cfc5fdfa49d 100644
--- a/drivers/firmware/tegra/bpmp-tegra186.c
+++ b/drivers/firmware/tegra/bpmp-tegra186.c
@@ -6,7 +6,7 @@
 #include <linux/genalloc.h>
 #include <linux/io.h>
 #include <linux/mailbox_client.h>
-#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 
 #include <soc/tegra/bpmp.h>
@@ -192,16 +192,11 @@ static void tegra186_bpmp_teardown_channels(struct tegra_bpmp *bpmp)
 static int tegra186_bpmp_dram_init(struct tegra_bpmp *bpmp)
 {
 	struct tegra186_bpmp *priv = bpmp->priv;
-	struct device_node *np;
 	struct resource res;
 	size_t size;
 	int err;
 
-	np = of_parse_phandle(bpmp->dev->of_node, "memory-region", 0);
-	if (!np)
-		return -ENODEV;
-
-	err = of_address_to_resource(np, 0, &res);
+	err = of_reserved_mem_region_to_resource(bpmp->dev->of_node, 0, &res);
 	if (err < 0) {
 		dev_warn(bpmp->dev, "failed to parse memory region: %d\n", err);
 		return err;
-- 
2.47.2


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

* Re: [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-03 18:34 [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
@ 2025-07-09 12:22 ` Thierry Reding
  2025-07-28 14:17 ` Jon Hunter
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2025-07-09 12:22 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Rob Herring (Arm)
  Cc: linux-tegra, linux-kernel

From: Thierry Reding <treding@nvidia.com>


On Thu, 03 Jul 2025 13:34:34 -0500, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
> 
> 

Applied, thanks!

[1/1] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region"
      commit: dbe4efea38d0a79ed58069499368e08b815952c6

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

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

* Re: [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-03 18:34 [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
  2025-07-09 12:22 ` Thierry Reding
@ 2025-07-28 14:17 ` Jon Hunter
  2025-07-29 12:24   ` Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2025-07-28 14:17 UTC (permalink / raw)
  To: Rob Herring (Arm), Thierry Reding; +Cc: linux-tegra, linux-kernel

Hi Rob, Thierry,

On 03/07/2025 19:34, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>   drivers/firmware/tegra/bpmp-tegra186.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/firmware/tegra/bpmp-tegra186.c b/drivers/firmware/tegra/bpmp-tegra186.c
> index 6f0d0511b486..7cfc5fdfa49d 100644
> --- a/drivers/firmware/tegra/bpmp-tegra186.c
> +++ b/drivers/firmware/tegra/bpmp-tegra186.c
> @@ -6,7 +6,7 @@
>   #include <linux/genalloc.h>
>   #include <linux/io.h>
>   #include <linux/mailbox_client.h>
> -#include <linux/of_address.h>
> +#include <linux/of_reserved_mem.h>
>   #include <linux/platform_device.h>
>   
>   #include <soc/tegra/bpmp.h>
> @@ -192,16 +192,11 @@ static void tegra186_bpmp_teardown_channels(struct tegra_bpmp *bpmp)
>   static int tegra186_bpmp_dram_init(struct tegra_bpmp *bpmp)
>   {
>   	struct tegra186_bpmp *priv = bpmp->priv;
> -	struct device_node *np;
>   	struct resource res;
>   	size_t size;
>   	int err;
>   
> -	np = of_parse_phandle(bpmp->dev->of_node, "memory-region", 0);
> -	if (!np)
> -		return -ENODEV;
> -
> -	err = of_address_to_resource(np, 0, &res);
> +	err = of_reserved_mem_region_to_resource(bpmp->dev->of_node, 0, &res);
>   	if (err < 0) {
>   		dev_warn(bpmp->dev, "failed to parse memory region: %d\n", err);
>   		return err;


This change is now causing the following warning to be observed on 
Tegra194 Jetson AGX Xavier platform ...

  WARNING KERN tegra-bpmp bpmp: failed to parse memory region: -19

Looking at the binding only one of 'memory-region' or 'shmem' is 
required and for Tegra194 we are using shmem. So I am not sure if it is 
worth making this change for this driver.

Jon

-- 
nvpublic


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

* Re: [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-28 14:17 ` Jon Hunter
@ 2025-07-29 12:24   ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2025-07-29 12:24 UTC (permalink / raw)
  To: Jon Hunter; +Cc: Rob Herring (Arm), linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2235 bytes --]

On Mon, Jul 28, 2025 at 03:17:11PM +0100, Jon Hunter wrote:
> Hi Rob, Thierry,
> 
> On 03/07/2025 19:34, Rob Herring (Arm) wrote:
> > Use the newly added of_reserved_mem_region_to_resource() function to
> > handle "memory-region" properties.
> > 
> > Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> > ---
> >   drivers/firmware/tegra/bpmp-tegra186.c | 9 ++-------
> >   1 file changed, 2 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/firmware/tegra/bpmp-tegra186.c b/drivers/firmware/tegra/bpmp-tegra186.c
> > index 6f0d0511b486..7cfc5fdfa49d 100644
> > --- a/drivers/firmware/tegra/bpmp-tegra186.c
> > +++ b/drivers/firmware/tegra/bpmp-tegra186.c
> > @@ -6,7 +6,7 @@
> >   #include <linux/genalloc.h>
> >   #include <linux/io.h>
> >   #include <linux/mailbox_client.h>
> > -#include <linux/of_address.h>
> > +#include <linux/of_reserved_mem.h>
> >   #include <linux/platform_device.h>
> >   #include <soc/tegra/bpmp.h>
> > @@ -192,16 +192,11 @@ static void tegra186_bpmp_teardown_channels(struct tegra_bpmp *bpmp)
> >   static int tegra186_bpmp_dram_init(struct tegra_bpmp *bpmp)
> >   {
> >   	struct tegra186_bpmp *priv = bpmp->priv;
> > -	struct device_node *np;
> >   	struct resource res;
> >   	size_t size;
> >   	int err;
> > -	np = of_parse_phandle(bpmp->dev->of_node, "memory-region", 0);
> > -	if (!np)
> > -		return -ENODEV;
> > -
> > -	err = of_address_to_resource(np, 0, &res);
> > +	err = of_reserved_mem_region_to_resource(bpmp->dev->of_node, 0, &res);
> >   	if (err < 0) {
> >   		dev_warn(bpmp->dev, "failed to parse memory region: %d\n", err);
> >   		return err;
> 
> 
> This change is now causing the following warning to be observed on Tegra194
> Jetson AGX Xavier platform ...
> 
>  WARNING KERN tegra-bpmp bpmp: failed to parse memory region: -19
> 
> Looking at the binding only one of 'memory-region' or 'shmem' is required
> and for Tegra194 we are using shmem. So I am not sure if it is worth making
> this change for this driver.

I guess the change still makes sense for merging both calls into one but
we now need to check for -ENODEV and not warn about it for this to
remain really equivalent.

I can patch it up.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2025-07-29 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 18:34 [PATCH] firmware: tegra: bpmp: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
2025-07-09 12:22 ` Thierry Reding
2025-07-28 14:17 ` Jon Hunter
2025-07-29 12:24   ` Thierry Reding

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