Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-05-06 Thread Peng Fan
On Wed, Apr 23, 2025 at 02:42:12PM -0500, Rob Herring (Arm) wrote:
>While there's a common function to parse "memory-region" properties for
>DMA pool regions, there's not anything for driver private regions. As a
>result, drivers have resorted to parsing "memory-region" properties
>themselves repeating the same pattern over and over. To fix this, this
>series adds 2 functions to handle those cases:
>of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().
>
>I've converted the whole tree, but just including remoteproc here as
>it has the most cases. I intend to apply the first 3 patches for 6.16
>so the driver conversions can be applied for 6.17.
>
>A git tree with all the drivers converted is here[1].
>
>v2:
>- Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
>- Export devm_ioremap_resource_wc()
>- Rework handling of resource name to drop unit-address from name as it 
>  was before.
>- Link to v1: 
>  https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org
>
>[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
>dt/memory-region
>
>Signed-off-by: Rob Herring (Arm) 
>---
>Rob Herring (Arm) (4):
>  of: reserved_mem: Add functions to parse "memory-region"
>  of: Simplify of_dma_set_restricted_buffer() to use of_for_each_phandle()
>  devres: Export devm_ioremap_resource_wc()
>  remoteproc: Use of_reserved_mem_region_* functions for "memory-region"
>
> drivers/of/device.c   | 31 +---
> drivers/of/of_reserved_mem.c  | 80 +++
> drivers/remoteproc/imx_dsp_rproc.c| 45 +++--
> drivers/remoteproc/imx_rproc.c| 68 +++---

Tested-by: Peng Fan  (i.MX93-11x11-EVK for imx_rproc.c)

Thanks,
Peng



Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-05-01 Thread Tanmay Shah




On 5/1/25 10:44 AM, Tanmay Shah wrote:

Hi Mathieu,

I tested this patchset on top of recent for-next branch. I don't see 
issue on AMD-xlnx ZynqMP platform. With this:


Tested-by: Tanmay Shah 



Hi Mathieu,

Looks like I said it too soon. Firmware loading works with this series, 
but RPMsg doesn't work. I am debugging further and will provide inputs 
once I find bug on xlnx_r5_remoteproc driver.


Please ignore above TB for now.

Thanks,
Tanmay


On 4/24/25 9:14 AM, Mathieu Poirier wrote:

Arnaud, Daniel, Iuliana, Andrew and Tanmay - please test this patchset
on the platforms you are working on.

Thanks,
Mathieu

On Wed, 23 Apr 2025 at 13:42, Rob Herring (Arm)  wrote:


While there's a common function to parse "memory-region" properties for
DMA pool regions, there's not anything for driver private regions. As a
result, drivers have resorted to parsing "memory-region" properties
themselves repeating the same pattern over and over. To fix this, this
series adds 2 functions to handle those cases:
of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().

I've converted the whole tree, but just including remoteproc here as
it has the most cases. I intend to apply the first 3 patches for 6.16
so the driver conversions can be applied for 6.17.

A git tree with all the drivers converted is here[1].

v2:
- Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
- Export devm_ioremap_resource_wc()
- Rework handling of resource name to drop unit-address from name as it
   was before.
- Link to v1:
   https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git dt/ 
memory-region


Signed-off-by: Rob Herring (Arm) 
---
Rob Herring (Arm) (4):
   of: reserved_mem: Add functions to parse "memory-region"
   of: Simplify of_dma_set_restricted_buffer() to use 
of_for_each_phandle()

   devres: Export devm_ioremap_resource_wc()
   remoteproc: Use of_reserved_mem_region_* functions for 
"memory-region"


  drivers/of/device.c   | 31 +---
  drivers/of/of_reserved_mem.c  | 80  
+++

  drivers/remoteproc/imx_dsp_rproc.c    | 45 +++--
  drivers/remoteproc/imx_rproc.c    | 68 ++ 
+---

  drivers/remoteproc/qcom_q6v5_adsp.c   | 24 --
  drivers/remoteproc/qcom_q6v5_mss.c    | 60 ---
  drivers/remoteproc/qcom_q6v5_pas.c    | 69 + 
+

  drivers/remoteproc/qcom_q6v5_wcss.c   | 25 --
  drivers/remoteproc/qcom_wcnss.c   | 23 -
  drivers/remoteproc/rcar_rproc.c   | 36 ++
  drivers/remoteproc/st_remoteproc.c    | 41 
  drivers/remoteproc/stm32_rproc.c  | 44 -
  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 28 +--
  drivers/remoteproc/ti_k3_m4_remoteproc.c  | 28 +--
  drivers/remoteproc/ti_k3_r5_remoteproc.c  | 28 +--
  drivers/remoteproc/xlnx_r5_remoteproc.c   | 51 
  include/linux/of_reserved_mem.h   | 26 ++
  lib/devres.c  |  1 +
  18 files changed, 339 insertions(+), 369 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250423-dt-memory-region-v2-a2b15caacc63

Best regards,
--
Rob Herring (Arm) 








Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-05-01 Thread Tanmay Shah

Hi Mathieu,

I tested this patchset on top of recent for-next branch. I don't see 
issue on AMD-xlnx ZynqMP platform. With this:


Tested-by: Tanmay Shah 

On 4/24/25 9:14 AM, Mathieu Poirier wrote:

Arnaud, Daniel, Iuliana, Andrew and Tanmay - please test this patchset
on the platforms you are working on.

Thanks,
Mathieu

On Wed, 23 Apr 2025 at 13:42, Rob Herring (Arm)  wrote:


While there's a common function to parse "memory-region" properties for
DMA pool regions, there's not anything for driver private regions. As a
result, drivers have resorted to parsing "memory-region" properties
themselves repeating the same pattern over and over. To fix this, this
series adds 2 functions to handle those cases:
of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().

I've converted the whole tree, but just including remoteproc here as
it has the most cases. I intend to apply the first 3 patches for 6.16
so the driver conversions can be applied for 6.17.

A git tree with all the drivers converted is here[1].

v2:
- Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
- Export devm_ioremap_resource_wc()
- Rework handling of resource name to drop unit-address from name as it
   was before.
- Link to v1:
   https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
dt/memory-region

Signed-off-by: Rob Herring (Arm) 
---
Rob Herring (Arm) (4):
   of: reserved_mem: Add functions to parse "memory-region"
   of: Simplify of_dma_set_restricted_buffer() to use of_for_each_phandle()
   devres: Export devm_ioremap_resource_wc()
   remoteproc: Use of_reserved_mem_region_* functions for "memory-region"

  drivers/of/device.c   | 31 +---
  drivers/of/of_reserved_mem.c  | 80 +++
  drivers/remoteproc/imx_dsp_rproc.c| 45 +++--
  drivers/remoteproc/imx_rproc.c| 68 +++---
  drivers/remoteproc/qcom_q6v5_adsp.c   | 24 --
  drivers/remoteproc/qcom_q6v5_mss.c| 60 ---
  drivers/remoteproc/qcom_q6v5_pas.c| 69 ++
  drivers/remoteproc/qcom_q6v5_wcss.c   | 25 --
  drivers/remoteproc/qcom_wcnss.c   | 23 -
  drivers/remoteproc/rcar_rproc.c   | 36 ++
  drivers/remoteproc/st_remoteproc.c| 41 
  drivers/remoteproc/stm32_rproc.c  | 44 -
  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 28 +--
  drivers/remoteproc/ti_k3_m4_remoteproc.c  | 28 +--
  drivers/remoteproc/ti_k3_r5_remoteproc.c  | 28 +--
  drivers/remoteproc/xlnx_r5_remoteproc.c   | 51 
  include/linux/of_reserved_mem.h   | 26 ++
  lib/devres.c  |  1 +
  18 files changed, 339 insertions(+), 369 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250423-dt-memory-region-v2-a2b15caacc63

Best regards,
--
Rob Herring (Arm) 






Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-04-28 Thread Iuliana Prodan

On 4/28/2025 3:23 PM, Rob Herring wrote:

On Fri, Apr 25, 2025 at 6:34 PM Iuliana Prodan  wrote:

Hello Mathieu, Rob,

I've tested imx_dsp_rproc and it fails with:

[   39.743770] Unable to handle kernel paging request at virtual address
ffea
...
[   39.805078] Hardware name: NXP i.MX8MPlus EVK board (DT)
[   39.810390] pstate: 0005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS
BTYPE=--)
[   39.817353] pc : __pi_memset_generic+0x50/0x188
[   39.821892] lr : imx_dsp_rproc_prepare+0x3a4/0xea4 [imx_dsp_rproc]
[   39.828079] sp : 8000853dbb10
[   39.831396] x29: 8000853dbb90 x28: 9240 x27:
80007a36d3d8
[   39.838540] x26: d0a5e410 x25: 80007a36d3f0 x24:
0004
[   39.845685] x23: d5414880 x22: d5e1dce8 x21:

[   39.852827] x20: d5e1db98 x19: d5414b80 x18:

[   39.859970] x17: 202c656c69687720 x16: 3e2074756f657672 x15:
800081f8d050
[   39.867114] x14: db584680 x13: 0003 x12:
7fffa333
[   39.874257] x11: 0004 x10: 0ab0 x9 :

[   39.881400] x8 : ffea x7 :  x6 :
003f
[   39.888546] x5 : 0040 x4 : 0006 x3 :
0004
[   39.895689] x2 : 8000 x1 :  x0 :
ffea
[   39.902837] Call trace:
[   39.905284]  __pi_memset_generic+0x50/0x188 (P)
[   39.909821]  rproc_boot+0x2c0/0x524
[   39.913317]  state_store+0x40/0x100
[   39.916812]  dev_attr_store+0x18/0x2c
[   39.920478]  sysfs_kf_write+0x7c/0x94
[   39.924146]  kernfs_fop_write_iter+0x120/0x1e8
[   39.928598]  vfs_write+0x244/0x37c
[   39.932008]  ksys_write+0x70/0x110
[   39.935413]  __arm64_sys_write+0x1c/0x28
[   39.939342]  invoke_syscall+0x48/0x104
[   39.943094]  el0_svc_common.constprop.0+0xc0/0xe0
[   39.947805]  do_el0_svc+0x1c/0x28
[   39.951123]  el0_svc+0x30/0xcc
[   39.954188]  el0t_64_sync_handler+0x10c/0x138
[   39.958549]  el0t_64_sync+0x198/0x19c
[   39.96] Code: d65f03c0 cb0803e4 f2400c84 5480 (a9001d07)
[   39.968317] ---[ end trace  ]---

The problem seems to be when computing `cpu_addr =
devm_ioremap_resource_wc(dev, &res);`, in patch 4.
In `__devm_ioremap_resource` (see [1]), it's expecting the resource type
to be `IORESOURCE_MEM`, which is not the case here (at least the flags
are nowhere set for this).

Thanks for testing and diagnosing. IORESOURCE_MEM needs to be set. Can
you test with this change:

index f87915cce961..00c93585758f 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -771,6 +771,7 @@ int of_reserved_mem_region_to_resource(const
struct device_node *np,
 return -EINVAL;

 resource_set_range(res, rmem->base, rmem->size);
+   res->flags = IORESOURCE_MEM;
 res->name = rmem->name;
 return 0;
  }


I've tested with this change, and is all good now. Iulia




Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-04-28 Thread Rob Herring
On Fri, Apr 25, 2025 at 6:34 PM Iuliana Prodan  wrote:
>
> Hello Mathieu, Rob,
>
> I've tested imx_dsp_rproc and it fails with:
>
> [   39.743770] Unable to handle kernel paging request at virtual address
> ffea
> ...
> [   39.805078] Hardware name: NXP i.MX8MPlus EVK board (DT)
> [   39.810390] pstate: 0005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS
> BTYPE=--)
> [   39.817353] pc : __pi_memset_generic+0x50/0x188
> [   39.821892] lr : imx_dsp_rproc_prepare+0x3a4/0xea4 [imx_dsp_rproc]
> [   39.828079] sp : 8000853dbb10
> [   39.831396] x29: 8000853dbb90 x28: 9240 x27:
> 80007a36d3d8
> [   39.838540] x26: d0a5e410 x25: 80007a36d3f0 x24:
> 0004
> [   39.845685] x23: d5414880 x22: d5e1dce8 x21:
> 
> [   39.852827] x20: d5e1db98 x19: d5414b80 x18:
> 
> [   39.859970] x17: 202c656c69687720 x16: 3e2074756f657672 x15:
> 800081f8d050
> [   39.867114] x14: db584680 x13: 0003 x12:
> 7fffa333
> [   39.874257] x11: 0004 x10: 0ab0 x9 :
> 
> [   39.881400] x8 : ffea x7 :  x6 :
> 003f
> [   39.888546] x5 : 0040 x4 : 0006 x3 :
> 0004
> [   39.895689] x2 : 8000 x1 :  x0 :
> ffea
> [   39.902837] Call trace:
> [   39.905284]  __pi_memset_generic+0x50/0x188 (P)
> [   39.909821]  rproc_boot+0x2c0/0x524
> [   39.913317]  state_store+0x40/0x100
> [   39.916812]  dev_attr_store+0x18/0x2c
> [   39.920478]  sysfs_kf_write+0x7c/0x94
> [   39.924146]  kernfs_fop_write_iter+0x120/0x1e8
> [   39.928598]  vfs_write+0x244/0x37c
> [   39.932008]  ksys_write+0x70/0x110
> [   39.935413]  __arm64_sys_write+0x1c/0x28
> [   39.939342]  invoke_syscall+0x48/0x104
> [   39.943094]  el0_svc_common.constprop.0+0xc0/0xe0
> [   39.947805]  do_el0_svc+0x1c/0x28
> [   39.951123]  el0_svc+0x30/0xcc
> [   39.954188]  el0t_64_sync_handler+0x10c/0x138
> [   39.958549]  el0t_64_sync+0x198/0x19c
> [   39.96] Code: d65f03c0 cb0803e4 f2400c84 5480 (a9001d07)
> [   39.968317] ---[ end trace  ]---
>
> The problem seems to be when computing `cpu_addr =
> devm_ioremap_resource_wc(dev, &res);`, in patch 4.
> In `__devm_ioremap_resource` (see [1]), it's expecting the resource type
> to be `IORESOURCE_MEM`, which is not the case here (at least the flags
> are nowhere set for this).

Thanks for testing and diagnosing. IORESOURCE_MEM needs to be set. Can
you test with this change:

index f87915cce961..00c93585758f 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -771,6 +771,7 @@ int of_reserved_mem_region_to_resource(const
struct device_node *np,
return -EINVAL;

resource_set_range(res, rmem->base, rmem->size);
+   res->flags = IORESOURCE_MEM;
res->name = rmem->name;
return 0;
 }



Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-04-28 Thread Arnaud POULIQUEN



On 4/23/25 21:42, Rob Herring (Arm) wrote:
> While there's a common function to parse "memory-region" properties for
> DMA pool regions, there's not anything for driver private regions. As a
> result, drivers have resorted to parsing "memory-region" properties
> themselves repeating the same pattern over and over. To fix this, this
> series adds 2 functions to handle those cases:
> of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().
> 
> I've converted the whole tree, but just including remoteproc here as
> it has the most cases. I intend to apply the first 3 patches for 6.16
> so the driver conversions can be applied for 6.17.
> 
> A git tree with all the drivers converted is here[1].
> 
> v2:
> - Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
> - Export devm_ioremap_resource_wc()
> - Rework handling of resource name to drop unit-address from name as it 
>   was before.
> - Link to v1: 
>   https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
> dt/memory-region
> 
> Signed-off-by: Rob Herring (Arm) 
> ---
> Rob Herring (Arm) (4):
>   of: reserved_mem: Add functions to parse "memory-region"
>   of: Simplify of_dma_set_restricted_buffer() to use of_for_each_phandle()
>   devres: Export devm_ioremap_resource_wc()
>   remoteproc: Use of_reserved_mem_region_* functions for "memory-region"
> 
>  drivers/of/device.c   | 31 +---
>  drivers/of/of_reserved_mem.c  | 80 
> +++
>  drivers/remoteproc/imx_dsp_rproc.c| 45 +++--
>  drivers/remoteproc/imx_rproc.c| 68 +++---
>  drivers/remoteproc/qcom_q6v5_adsp.c   | 24 --
>  drivers/remoteproc/qcom_q6v5_mss.c| 60 ---
>  drivers/remoteproc/qcom_q6v5_pas.c| 69 ++
>  drivers/remoteproc/qcom_q6v5_wcss.c   | 25 --
>  drivers/remoteproc/qcom_wcnss.c   | 23 -
>  drivers/remoteproc/rcar_rproc.c   | 36 ++
>  drivers/remoteproc/st_remoteproc.c| 41 
>  drivers/remoteproc/stm32_rproc.c  | 44 -
>  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 28 +--
>  drivers/remoteproc/ti_k3_m4_remoteproc.c  | 28 +--
>  drivers/remoteproc/ti_k3_r5_remoteproc.c  | 28 +--
>  drivers/remoteproc/xlnx_r5_remoteproc.c   | 51 
>  include/linux/of_reserved_mem.h   | 26 ++
>  lib/devres.c  |  1 +
>  18 files changed, 339 insertions(+), 369 deletions(-)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250423-dt-memory-region-v2-a2b15caacc63
> 

Testing of the series on the STM32MP15 platform has passed.

just one minor comment in patch 1/4.

Acked-by: Arnaud Pouliquen 

Thanks,
Arnaud




> Best regards,



Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-04-25 Thread Iuliana Prodan

Hello Mathieu, Rob,

I've tested imx_dsp_rproc and it fails with:

[   39.743770] Unable to handle kernel paging request at virtual address 
ffea

...
[   39.805078] Hardware name: NXP i.MX8MPlus EVK board (DT)
[   39.810390] pstate: 0005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS 
BTYPE=--)

[   39.817353] pc : __pi_memset_generic+0x50/0x188
[   39.821892] lr : imx_dsp_rproc_prepare+0x3a4/0xea4 [imx_dsp_rproc]
[   39.828079] sp : 8000853dbb10
[   39.831396] x29: 8000853dbb90 x28: 9240 x27: 
80007a36d3d8
[   39.838540] x26: d0a5e410 x25: 80007a36d3f0 x24: 
0004
[   39.845685] x23: d5414880 x22: d5e1dce8 x21: 

[   39.852827] x20: d5e1db98 x19: d5414b80 x18: 

[   39.859970] x17: 202c656c69687720 x16: 3e2074756f657672 x15: 
800081f8d050
[   39.867114] x14: db584680 x13: 0003 x12: 
7fffa333
[   39.874257] x11: 0004 x10: 0ab0 x9 : 

[   39.881400] x8 : ffea x7 :  x6 : 
003f
[   39.888546] x5 : 0040 x4 : 0006 x3 : 
0004
[   39.895689] x2 : 8000 x1 :  x0 : 
ffea

[   39.902837] Call trace:
[   39.905284]  __pi_memset_generic+0x50/0x188 (P)
[   39.909821]  rproc_boot+0x2c0/0x524
[   39.913317]  state_store+0x40/0x100
[   39.916812]  dev_attr_store+0x18/0x2c
[   39.920478]  sysfs_kf_write+0x7c/0x94
[   39.924146]  kernfs_fop_write_iter+0x120/0x1e8
[   39.928598]  vfs_write+0x244/0x37c
[   39.932008]  ksys_write+0x70/0x110
[   39.935413]  __arm64_sys_write+0x1c/0x28
[   39.939342]  invoke_syscall+0x48/0x104
[   39.943094]  el0_svc_common.constprop.0+0xc0/0xe0
[   39.947805]  do_el0_svc+0x1c/0x28
[   39.951123]  el0_svc+0x30/0xcc
[   39.954188]  el0t_64_sync_handler+0x10c/0x138
[   39.958549]  el0t_64_sync+0x198/0x19c
[   39.96] Code: d65f03c0 cb0803e4 f2400c84 5480 (a9001d07)
[   39.968317] ---[ end trace  ]---

The problem seems to be when computing `cpu_addr = 
devm_ioremap_resource_wc(dev, &res);`, in patch 4.
In `__devm_ioremap_resource` (see [1]), it's expecting the resource type 
to be `IORESOURCE_MEM`, which is not the case here (at least the flags 
are nowhere set for this).


A quick fix would be to let the `cpu_addr` be calculated as before: 
`cpu_addr = devm_ioremap_wc(dev, res.start, resource_size(&res));`.


Thanks,
Iulia

[1] https://elixir.bootlin.com/linux/v6.14.3/source/lib/devres.c#L134

On 4/24/2025 5:14 PM, Mathieu Poirier wrote:

Arnaud, Daniel, Iuliana, Andrew and Tanmay - please test this patchset
on the platforms you are working on.

Thanks,
Mathieu

On Wed, 23 Apr 2025 at 13:42, Rob Herring (Arm)  wrote:

While there's a common function to parse "memory-region" properties for
DMA pool regions, there's not anything for driver private regions. As a
result, drivers have resorted to parsing "memory-region" properties
themselves repeating the same pattern over and over. To fix this, this
series adds 2 functions to handle those cases:
of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().

I've converted the whole tree, but just including remoteproc here as
it has the most cases. I intend to apply the first 3 patches for 6.16
so the driver conversions can be applied for 6.17.

A git tree with all the drivers converted is here[1].

v2:
- Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
- Export devm_ioremap_resource_wc()
- Rework handling of resource name to drop unit-address from name as it
   was before.
- Link to v1:
   https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
dt/memory-region

Signed-off-by: Rob Herring (Arm) 
---
Rob Herring (Arm) (4):
   of: reserved_mem: Add functions to parse "memory-region"
   of: Simplify of_dma_set_restricted_buffer() to use of_for_each_phandle()
   devres: Export devm_ioremap_resource_wc()
   remoteproc: Use of_reserved_mem_region_* functions for "memory-region"

  drivers/of/device.c   | 31 +---
  drivers/of/of_reserved_mem.c  | 80 +++
  drivers/remoteproc/imx_dsp_rproc.c| 45 +++--
  drivers/remoteproc/imx_rproc.c| 68 +++---
  drivers/remoteproc/qcom_q6v5_adsp.c   | 24 --
  drivers/remoteproc/qcom_q6v5_mss.c| 60 ---
  drivers/remoteproc/qcom_q6v5_pas.c| 69 ++
  drivers/remoteproc/qcom_q6v5_wcss.c   | 25 --
  drivers/remoteproc/qcom_wcnss.c   | 23 -
  drivers/remoteproc/rcar_rproc.c   | 36 ++
  drivers/remoteproc/st_remoteproc.c| 41 
  drivers/remoteproc/stm32_rproc.c  | 44 -
  drivers/remoteproc/ti_k3_dsp_rem

Re: [PATCH v2 0/4] of: Common "memory-region" parsing

2025-04-24 Thread Mathieu Poirier
Arnaud, Daniel, Iuliana, Andrew and Tanmay - please test this patchset
on the platforms you are working on.

Thanks,
Mathieu

On Wed, 23 Apr 2025 at 13:42, Rob Herring (Arm)  wrote:
>
> While there's a common function to parse "memory-region" properties for
> DMA pool regions, there's not anything for driver private regions. As a
> result, drivers have resorted to parsing "memory-region" properties
> themselves repeating the same pattern over and over. To fix this, this
> series adds 2 functions to handle those cases:
> of_reserved_mem_region_to_resource() and of_reserved_mem_region_count().
>
> I've converted the whole tree, but just including remoteproc here as
> it has the most cases. I intend to apply the first 3 patches for 6.16
> so the driver conversions can be applied for 6.17.
>
> A git tree with all the drivers converted is here[1].
>
> v2:
> - Fix of_dma_set_restricted_buffer() to maintain behavior on warning msg
> - Export devm_ioremap_resource_wc()
> - Rework handling of resource name to drop unit-address from name as it
>   was before.
> - Link to v1:
>   https://lore.kernel.org/all/20250317232426.952188-1-r...@kernel.org
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
> dt/memory-region
>
> Signed-off-by: Rob Herring (Arm) 
> ---
> Rob Herring (Arm) (4):
>   of: reserved_mem: Add functions to parse "memory-region"
>   of: Simplify of_dma_set_restricted_buffer() to use of_for_each_phandle()
>   devres: Export devm_ioremap_resource_wc()
>   remoteproc: Use of_reserved_mem_region_* functions for "memory-region"
>
>  drivers/of/device.c   | 31 +---
>  drivers/of/of_reserved_mem.c  | 80 
> +++
>  drivers/remoteproc/imx_dsp_rproc.c| 45 +++--
>  drivers/remoteproc/imx_rproc.c| 68 +++---
>  drivers/remoteproc/qcom_q6v5_adsp.c   | 24 --
>  drivers/remoteproc/qcom_q6v5_mss.c| 60 ---
>  drivers/remoteproc/qcom_q6v5_pas.c| 69 ++
>  drivers/remoteproc/qcom_q6v5_wcss.c   | 25 --
>  drivers/remoteproc/qcom_wcnss.c   | 23 -
>  drivers/remoteproc/rcar_rproc.c   | 36 ++
>  drivers/remoteproc/st_remoteproc.c| 41 
>  drivers/remoteproc/stm32_rproc.c  | 44 -
>  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 28 +--
>  drivers/remoteproc/ti_k3_m4_remoteproc.c  | 28 +--
>  drivers/remoteproc/ti_k3_r5_remoteproc.c  | 28 +--
>  drivers/remoteproc/xlnx_r5_remoteproc.c   | 51 
>  include/linux/of_reserved_mem.h   | 26 ++
>  lib/devres.c  |  1 +
>  18 files changed, 339 insertions(+), 369 deletions(-)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250423-dt-memory-region-v2-a2b15caacc63
>
> Best regards,
> --
> Rob Herring (Arm) 
>