Skip to contentSkip to conversation

arm: mach-k3: Add DM firmware memory fixup

PATCH Superseded Paresh Bhagat 4 participants 15 messages Jun 9 – Jun 25

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm: mach-k3: Add DM firmware memory fixup

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

This patch will need the dts to be updated for both AM62a and AM62d i.e. rename wkup_r5fss0_core0_memory_region node from "memory@9c900000" to "dm@9c900000".

Boot logs
https://gist.github.com/paresh-bhagat/e64523fe5134a02754fdbdaff864fcd1
https://gist.github.com/paresh-bhagat/b578d602010db09d62d2be3b2709fc5a

Paresh Bhagat (4):
arm: mach-k3: Fix phandle corruption in fdt fixup
arm: mach-k3: am62ax: Enable OF_SYSTEM_SETUP for AM62D2
arm: mack-k3: Kconfig: Add DM firmware reserved memory configs
arm: mach-k3: Add DM reserved memory fixup

 arch/arm/mach-k3/Kconfig        | 16 ++++++++++++++++
 arch/arm/mach-k3/am62ax/Kconfig |  1 +
 arch/arm/mach-k3/common_fdt.c   | 34 +++++++++++++++++++++++----------
 3 files changed, 41 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 arm: mach-k3: Fix phandle corruption in fdt fixup

Fix phandle corruption in fdt_fixup_reserved_memory()

The original implementation used a delete/recreate approach:
- Find existing reserved memory node (e.g. tfa@80000000)
- Delete the entire node with fdt_del_node()
- Create new node with fdtdec_add_reserved_memory()

This worked fine for ATF and OPTEE nodes because no other device tree nodes reference them via phandles but other nodes example DM are referenced by R5 nodes.

If these nodes are deleted and recreated, it will not have any phandle property but the nodes referencing it will still contain the old phandle, causing initialization to fail.

Update nodes in-place instead of delete/recreate to update only the "reg" property using fdt_setprop().

Fixes 8b0fc29de0e3 ("arm: mach-k3: am62: Fixup TF-A/OP-TEE reserved-memory node in FDT")
---
 arch/arm/mach-k3/common_fdt.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-k3/common_fdt.c +7 -7
index 39cb00c3f43..25e40f6a666 100644
@@ -129,11 +129,12 @@ static int fdt_fixup_reserved_memory(void *blob, const char *name,
 	if (nodeoffset < 0)
 		goto add_carveout;
 
-	/* Find existing matching subnode and remove it */
+	/* Find existing matching subnode and update it in place */
 	fdt_for_each_subnode(subnode, blob, nodeoffset) {
 		const char *node_name;
 		fdt_addr_t addr;
 		fdt_size_t size;
+		u64 reg[2];
 
 		/* Name matching */
 		node_name = fdt_get_name(blob, subnode, NULL);
@@ -146,15 +147,14 @@ static int fdt_fixup_reserved_memory(void *blob, const char *name,
 				false);
 			if (addr == FDT_ADDR_T_NONE)
 				return -EINVAL;
-			new_size = size;
-
-			/* Delete node */
-			ret = fdt_del_node(blob, subnode);
+			/* Update the reg property in place */
+			reg[0] = cpu_to_fdt64(new_address);
+			reg[1] = cpu_to_fdt64(new_size);
+			ret = fdt_setprop(blob, subnode, "reg", reg, sizeof(reg));
 			if (ret < 0)
 				return ret;
 
-			/* Only one matching node */
-			break;
+			return 0;
 		}
 	}
 
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/4] arm: mach-k3: Fix phandle corruption in fdt fixup

arch/arm/mach-k3/common_fdt.c static int fdt_fixup_reserved_memory(void *blob, const char *name, · line 149

Quoted 9 lines · Paresh Bhagat
arch/arm/mach-k3/common_fdt.c +0 -1
index 39cb00c3f43..25e40f6a666 100644
@@ -146,15 +147,14 @@ static int fdt_fixup_reserved_memory(void *blob, const char *name,
 				false);
 			if (addr == FDT_ADDR_T_NONE)
 				return -EINVAL;
-			new_size = size;

If this removal is intentional, we can get rid of the redundant call to fdtdec_get_addr_size_auto_parent above since the locals 'addr' and 'size' are no longer used.

arch/arm/mach-k3/common_fdt.c static int fdt_fixup_reserved_memory(void *blob, const char *name, · line 157

Quoted 13 lines
arch/arm/mach-k3/common_fdt.c +5 -5
-
-			/* Delete node */
-			ret = fdt_del_node(blob, subnode);
+			/* Update the reg property in place */
+			reg[0] = cpu_to_fdt64(new_address);
+			reg[1] = cpu_to_fdt64(new_size);
+			ret = fdt_setprop(blob, subnode, "reg", reg, sizeof(reg));
 			if (ret < 0)
 				return ret;
 
-			/* Only one matching node */
-			break;
+			return 0;

You could just do return fdt_setprop(...) here instead. And a similar cleanup can be done for fdtdec_add_reserved_memory below, if you wanna take it up in the next revision.

Signature · 1 line
Anshul Dalal <[email protected]>
#3 lore raw

PATCH 2/4 arm: mach-k3: am62ax: Enable OF_SYSTEM_SETUP for AM62D2

In reply to Paresh Bhagat

Enable OF_SYSTEM_SETUP for AM62D2 to ensure FDT fixups are applied to the dtb before passing to kernel.

---
 arch/arm/mach-k3/am62ax/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-k3/am62ax/Kconfig +1 -0
index 6a3969343ec..e7c2a2de9be 100644
@@ -54,6 +54,7 @@ config TARGET_AM62D2_A53_EVM
 	bool "TI K3 based AM62D2 EVM running on A53"
 	select ARM64
 	select BINMAN
+	select OF_SYSTEM_SETUP
 	imply BOARD
 	imply SPL_BOARD
 	imply TI_I2C_BOARD_DETECT
Signature · 1 line
2.34.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] arm: mach-k3: am62ax: Enable OF_SYSTEM_SETUP for AM62D2

Quoted 2 lines · Paresh Bhagat

Enable OF_SYSTEM_SETUP for AM62D2 to ensure FDT fixups are applied to the dtb before passing to kernel.

Signature · 1 line
Anshul Dalal <[email protected]>
#5 lore raw

PATCH 3/4 arm: mack-k3: Kconfig: Add DM firmware reserved memory configs

In reply to Paresh Bhagat

Add Kconfig options for DM firmware reserved memory for AM62a SOC:
- K3_DM_FW_RESERVED_ADDR: DM firmware load address (default 0x9c900000)
- K3_DM_FW_RESERVED_SIZE: DM firmware reserved size (default 0x1f00000)

These configs will be used to fixup the kernel device tree's reserved memory node for DM as the current reserved carveout is insufficient to accommodate the binary.

---
 arch/arm/mach-k3/Kconfig | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/mach-k3/Kconfig +16 -0
index a32ed3a9683..ad16de9c7bf 100644
@@ -165,6 +165,22 @@ config K3_DM_FW
 	  bootloader, it makes RM and PM services not being available
 	  during R5 SPL execution time.
 
+config K3_DM_FW_RESERVED_ADDR
+	hex "Start address of DM firmware reserved memory region"
+	depends on SOC_K3_AM62A7
+	default 0x9c900000
+	help
+	  Start address of the DDR region reserved for DM firmware at runtime.
+	  Used only to fixup the kernel device-tree reserved-memory node.
+
+config K3_DM_FW_RESERVED_SIZE
+	hex "Reserved memory size for DM firmware"
+	depends on SOC_K3_AM62A7
+	default 0x1f00000
+	help
+	  The runtime memory size reserved for DM firmware. This is the total
+	  DDR span needed for the DM firmware binary.
+
 config K3_X509_SWRV
 	int "SWRV for X509 certificate used for boot images"
 	default 1
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH 3/4] arm: mack-k3: Kconfig: Add DM firmware reserved memory configs

arch/arm/mach-k3/Kconfig config K3_DM_FW · line 170

Quoted 11 lines · Paresh Bhagat
arch/arm/mach-k3/Kconfig +3 -0
index a32ed3a9683..ad16de9c7bf 100644
@@ -165,6 +165,22 @@ config K3_DM_FW
 	  bootloader, it makes RM and PM services not being available
 	  during R5 SPL execution time.
 
+config K3_DM_FW_RESERVED_ADDR
+	hex "Start address of DM firmware reserved memory region"
+	depends on SOC_K3_AM62A7

Why is this exclusive to AM62a? We could have this fixup work K3 wide with the values defaulting to the correct one depending on the SOC similar to how we handle the different load addresses for TFA with CONFIG_K3_ATF_LOAD_ADDR. This would avoid the need for #ifdef in the next patch too.

config K3_DM_FW_RESERVED_ADDR

     hex "Start address of DM firmware reserved memory region"
     default 0x9db00000 if SOC_K3_AM625
     default 0x9c900000 if SOC_K3_AM62A7
     ...

and same for the size.

Signature · 1 line
Anshul Dalal <[email protected]>
#7 lore raw

Re: [PATCH 3/4] arm: mack-k3: Kconfig: Add DM firmware reserved memory configs

Hi Markus and Anshul,

Quoted 17 lines · Anshul Dalal

arch/arm/mach-k3/Kconfig config K3_DM_FW · line 170

Quoted 11 lines · Paresh Bhagat
arch/arm/mach-k3/Kconfig +3 -0
index a32ed3a9683..ad16de9c7bf 100644
@@ -165,6 +165,22 @@ config K3_DM_FW
  	  bootloader, it makes RM and PM services not being available
  	  during R5 SPL execution time.
 
+config K3_DM_FW_RESERVED_ADDR
+	hex "Start address of DM firmware reserved memory region"
+	depends on SOC_K3_AM62A7

Why is this exclusive to AM62a? We could have this fixup work K3 wide with the values defaulting to the correct one depending on the SOC similar to how we handle the different load addresses for TFA with CONFIG_K3_ATF_LOAD_ADDR. This would avoid the need for #ifdef in the next patch too.

Quoted 8 lines
    config K3_DM_FW_RESERVED_ADDR
      hex "Start address of DM firmware reserved memory region"
      default 0x9db00000 if SOC_K3_AM625
      default 0x9c900000 if SOC_K3_AM62A7
      ...

and same for the size.

Yep makes sense I will add it for all K3 SoCs.

Markus if we are aligned, you could make changes on top of the next revision. Sorry for the delay, I will send a patch in a day or two.

#8 lore raw

PATCH 4/4 arm: mach-k3: Add DM reserved memory fixup

In reply to Paresh Bhagat

The wkup_r5fss0_core0_memory_region reserved DDR carveout in device tree is insufficient to accommodate the current DM firmware binary. Add fixup for DM to expand the DM firmware reserved region from existing 0xf0000 to 0x1f00000.

---
 arch/arm/mach-k3/common_fdt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/arm/mach-k3/common_fdt.c +17 -3
index 25e40f6a666..2386c4a2316 100644
@@ -177,9 +177,23 @@ int fdt_fixup_reserved(void *blob)
 	if (ret)
 		return ret;
 
-	return fdt_fixup_reserved_memory(blob, "optee",
-					 CONFIG_K3_OPTEE_LOAD_ADDR,
-					 CONFIG_K3_OPTEE_RESERVED_SIZE);
+	ret = fdt_fixup_reserved_memory(blob, "optee",
+					CONFIG_K3_OPTEE_LOAD_ADDR,
+					CONFIG_K3_OPTEE_RESERVED_SIZE);
+
+	if (ret)
+		return ret;
+
+#if defined(CONFIG_K3_DM_FW_RESERVED_ADDR) && defined(CONFIG_K3_DM_FW_RESERVED_SIZE)
+	ret = fdt_fixup_reserved_memory(blob, "dm",
+					CONFIG_K3_DM_FW_RESERVED_ADDR,
+					CONFIG_K3_DM_FW_RESERVED_SIZE);
+
+	if (ret)
+		return ret;
+#endif
+
+	return 0;
 }
 
 static int fdt_fixup_critical_trips(void *blob, int zoneoffset, int maxc)
Signature · 1 line
2.34.1
#9 lore raw
In reply to Paresh Bhagat

Hi Paresh,

Quoted 11 lines · Paresh Bhagat

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

I am wondering why you chose 0x1f00000 and not 0x1d08000?

Also for am62a the firmware linker file says it is shorter:

    /* DDR for DM R5F code/data [ size 27 MiB + 364 KB ] */
    DDR                         : ORIGIN = 0x9CAA5000 LENGTH = 0x1B5B000

    https://github.com/TexasInstruments/mcupsdk-core-k3/blob/k3_main/examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/linker.cmd#L175

I am wondering what is correct, the linker file or the objdump you did?

Quoted 4 lines

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

I haven't looked at the code yet, why do you use a fixup instead of fixing the devicetree?

Best
Markus

Quoted 19 lines

This patch will need the dts to be updated for both AM62a and AM62d i.e. rename wkup_r5fss0_core0_memory_region node from "memory@9c900000" to "dm@9c900000".

Boot logs
https://gist.github.com/paresh-bhagat/e64523fe5134a02754fdbdaff864fcd1
https://gist.github.com/paresh-bhagat/b578d602010db09d62d2be3b2709fc5a

Paresh Bhagat (4):
arm: mach-k3: Fix phandle corruption in fdt fixup
arm: mach-k3: am62ax: Enable OF_SYSTEM_SETUP for AM62D2
arm: mack-k3: Kconfig: Add DM firmware reserved memory configs
arm: mach-k3: Add DM reserved memory fixup

 arch/arm/mach-k3/Kconfig        | 16 ++++++++++++++++
 arch/arm/mach-k3/am62ax/Kconfig |  1 +
 arch/arm/mach-k3/common_fdt.c   | 34 +++++++++++++++++++++++----------
 3 files changed, 41 insertions(+), 10 deletions(-)
#10 lore raw

Hi Markus,

Btw Had a quick look at series

https://lore.kernel.org/all/20260609-topic-am62a-ioddr-dt-v6-19-v6-0-16afba97fbe0@baylibre.com/

I did not know this problem was for other devices too.

Quoted 16 lines · Markus Schneider-Pargmann

Hi Paresh,

Quoted 11 lines · Paresh Bhagat

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

I am wondering why you chose 0x1f00000 and not 0x1d08000?

Quoted 7 lines

Also for am62a the firmware linker file says it is shorter:

     /* DDR for DM R5F code/data [ size 27 MiB + 364 KB ] */
     DDR                         : ORIGIN = 0x9CAA5000 LENGTH = 0x1B5B000

     https://github.com/TexasInstruments/mcupsdk-core-k3/blob/k3_main/examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/linker.cmd#L175

I am wondering what is correct, the linker file or the objdump you did?

Yes apart from the objdump output I noticed a gap between end of wkup_r5fss0_core0_memory_region and start of secure_ddr. So intention to fix the bug and use all of the available space.

Quoted 10 lines
Quoted 5 lines

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

I haven't looked at the code yet, why do you use a fixup instead of fixing the devicetree?

Best
Markus

I had a discussion with bryan regarding the device tree fix approach. He pointed out that firmware and kernel versions can be updated independently which can lead to unused reserved memory. So bootloaders should dynamically update the reserved memory based on firmware requirements before handing off to kernel. I will let Bryan and Andrew share more on device tree vs using fdt fixup approach.

Thanks,
Paresh

Quoted 19 lines
Quoted 19 lines

This patch will need the dts to be updated for both AM62a and AM62d i.e. rename wkup_r5fss0_core0_memory_region node from "memory@9c900000" to "dm@9c900000".

Boot logs
https://gist.github.com/paresh-bhagat/e64523fe5134a02754fdbdaff864fcd1
https://gist.github.com/paresh-bhagat/b578d602010db09d62d2be3b2709fc5a

Paresh Bhagat (4):
arm: mach-k3: Fix phandle corruption in fdt fixup
arm: mach-k3: am62ax: Enable OF_SYSTEM_SETUP for AM62D2
arm: mack-k3: Kconfig: Add DM firmware reserved memory configs
arm: mach-k3: Add DM reserved memory fixup

  arch/arm/mach-k3/Kconfig        | 16 ++++++++++++++++
  arch/arm/mach-k3/am62ax/Kconfig |  1 +
  arch/arm/mach-k3/common_fdt.c   | 34 +++++++++++++++++++++++----------
  3 files changed, 41 insertions(+), 10 deletions(-)
#11 lore raw

Hi Paresh,

Quoted 52 lines · Paresh Bhagat

Hi Markus,

Btw Had a quick look at series

https://lore.kernel.org/all/20260609-topic-am62a-ioddr-dt-v6-19-v6-0-16afba97fbe0@baylibre.com/

I did not know this problem was for other devices too.

Quoted 16 lines · Markus Schneider-Pargmann

Hi Paresh,

Quoted 11 lines · Paresh Bhagat

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

I am wondering why you chose 0x1f00000 and not 0x1d08000?

Quoted 7 lines

Also for am62a the firmware linker file says it is shorter:

     /* DDR for DM R5F code/data [ size 27 MiB + 364 KB ] */
     DDR                         : ORIGIN = 0x9CAA5000 LENGTH = 0x1B5B000

     https://github.com/TexasInstruments/mcupsdk-core-k3/blob/k3_main/examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/linker.cmd#L175

I am wondering what is correct, the linker file or the objdump you did?

Yes apart from the objdump output I noticed a gap between end of wkup_r5fss0_core0_memory_region and start of secure_ddr. So intention to fix the bug and use all of the available space.

Quoted 10 lines
Quoted 5 lines

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

I haven't looked at the code yet, why do you use a fixup instead of fixing the devicetree?

Best
Markus

Quoted 5 lines

I had a discussion with bryan regarding the device tree fix approach. He pointed out that firmware and kernel versions can be updated independently which can lead to unused reserved memory. So bootloaders should dynamically update the reserved memory based on firmware requirements before handing off to kernel.

Maybe I am missing something here, but isn't the firmware distributed together with u-boot? u-boot gets the devicetree merged from upstream every major version. So isn't a kernel update independent of u-boot/firmware/devicetree update?

Also do updates to the memory regions of your firmware really happen that often?

Best
Markus

#12 lore raw

On June 12, 2026 thus sayeth Markus Schneider-Pargmann:

Quoted 61 lines

Hi Paresh,

Quoted 52 lines · Paresh Bhagat

Hi Markus,

Btw Had a quick look at series

https://lore.kernel.org/all/20260609-topic-am62a-ioddr-dt-v6-19-v6-0-16afba97fbe0@baylibre.com/

I did not know this problem was for other devices too.

Quoted 16 lines · Markus Schneider-Pargmann

Hi Paresh,

Quoted 11 lines · Paresh Bhagat

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

I am wondering why you chose 0x1f00000 and not 0x1d08000?

Quoted 7 lines

Also for am62a the firmware linker file says it is shorter:

     /* DDR for DM R5F code/data [ size 27 MiB + 364 KB ] */
     DDR                         : ORIGIN = 0x9CAA5000 LENGTH = 0x1B5B000

     https://github.com/TexasInstruments/mcupsdk-core-k3/blob/k3_main/examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/linker.cmd#L175

I am wondering what is correct, the linker file or the objdump you did?

Yes apart from the objdump output I noticed a gap between end of wkup_r5fss0_core0_memory_region and start of secure_ddr. So intention to fix the bug and use all of the available space.

Quoted 10 lines
Quoted 5 lines

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

I haven't looked at the code yet, why do you use a fixup instead of fixing the devicetree?

Best
Markus

Quoted 5 lines

I had a discussion with bryan regarding the device tree fix approach. He pointed out that firmware and kernel versions can be updated independently which can lead to unused reserved memory. So bootloaders should dynamically update the reserved memory based on firmware requirements before handing off to kernel.

Quoted 7 lines

Maybe I am missing something here, but isn't the firmware distributed together with u-boot? u-boot gets the devicetree merged from upstream every major version. So isn't a kernel update independent of u-boot/firmware/devicetree update?

Also do updates to the memory regions of your firmware really happen that often?

This originally spawned because the reserved memory size in Linux's DT was wrong. Fortunately it was a simple math error and yeah we should fit it there as well. But the fix exposed another issue.

If DM _was_ to change its memory layout we don't have a way to fix it unless we keep the U-Boot build and Linux in sync. Unfortunately most of the distributions do not pin them together as tightly as we need for that to work.

For SoCs like the 62 you are correct. There hasn't been much of a need to change the memory layout at all however for devices like the AM67A, AM62A and AM62D we've found people are starting to use different firmware to help with whatever they are tasking the DSP to do.

The fdt fixup approach also has the added benefit of allowing people to try out different RTOS builds without having the headache of needing to modify DT to get the board to boot.

~Bryan

#13 lore raw

Hi Bryan,

Quoted 79 lines · Bryan Brattlof

On June 12, 2026 thus sayeth Markus Schneider-Pargmann:

Quoted 61 lines

Hi Paresh,

Quoted 52 lines · Paresh Bhagat

Hi Markus,

Btw Had a quick look at series

https://lore.kernel.org/all/20260609-topic-am62a-ioddr-dt-v6-19-v6-0-16afba97fbe0@baylibre.com/

I did not know this problem was for other devices too.

Quoted 16 lines · Markus Schneider-Pargmann

Hi Paresh,

Quoted 11 lines · Paresh Bhagat

This patch series addresses DM firmware reserved memory fixup for AM62a and AM62d:

1. AM62D is missing OF_SYSTEM_SETUP config, required for FDT fixups to be applied before passing dtb to kernel.

2. DM firmware reserved memory region is insufficient to accommodate the binary. Analysis of the DM firmware binary using objdump reveals that the resource_table section and .stack section occupies memory from 0x9c900000 to 0x9e608000. So increase the reserved region size from 0xf00000 to 0x1f00000 via fdt fixup. Add new configs in Kconfig.

I am wondering why you chose 0x1f00000 and not 0x1d08000?

Quoted 7 lines

Also for am62a the firmware linker file says it is shorter:

     /* DDR for DM R5F code/data [ size 27 MiB + 364 KB ] */
     DDR                         : ORIGIN = 0x9CAA5000 LENGTH = 0x1B5B000

     https://github.com/TexasInstruments/mcupsdk-core-k3/blob/k3_main/examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/linker.cmd#L175

I am wondering what is correct, the linker file or the objdump you did?

Yes apart from the objdump output I noticed a gap between end of wkup_r5fss0_core0_memory_region and start of secure_ddr. So intention to fix the bug and use all of the available space.

Quoted 10 lines
Quoted 5 lines

3. The existing fdt_fixup_reserved_memory() used a delete/recreate approach which corrupted phandle references to DM node, causing DM initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

I haven't looked at the code yet, why do you use a fixup instead of fixing the devicetree?

Best
Markus

Quoted 5 lines

I had a discussion with bryan regarding the device tree fix approach. He pointed out that firmware and kernel versions can be updated independently which can lead to unused reserved memory. So bootloaders should dynamically update the reserved memory based on firmware requirements before handing off to kernel.

Quoted 7 lines

Maybe I am missing something here, but isn't the firmware distributed together with u-boot? u-boot gets the devicetree merged from upstream every major version. So isn't a kernel update independent of u-boot/firmware/devicetree update?

Also do updates to the memory regions of your firmware really happen that often?

This originally spawned because the reserved memory size in Linux's DT was wrong. Fortunately it was a simple math error and yeah we should fit it there as well. But the fix exposed another issue.

If DM _was_ to change its memory layout we don't have a way to fix it unless we keep the U-Boot build and Linux in sync. Unfortunately most of the distributions do not pin them together as tightly as we need for that to work.

Quoted 8 lines

For SoCs like the 62 you are correct. There hasn't been much of a need to change the memory layout at all however for devices like the AM67A, AM62A and AM62D we've found people are starting to use different firmware to help with whatever they are tasking the DSP to do.

The fdt fixup approach also has the added benefit of allowing people to try out different RTOS builds without having the headache of needing to modify DT to get the board to boot.

Thanks for explaining. If you prefer the fixups, can you please change the code to be able to work with both layouts as documented in the binding documentation?

oneOf:
- description: Basic layout
items:
- description: region used for dynamic DMA allocations like vrings and vring buffers
- description: region reserved for firmware image sections
- description: Detailed layout
items:
- description: region used for dynamic DMA allocations like vrings and vring buffers
- description: region reserved for IPC resources
- description: LPM FS stub binary
- description: LPM metadata
- description: LPM FS context data and reserved sections
- description: DM RM/PM trace and firmware code/data

You can use the memory-region-names to know what is what.

Best
Markus

#14 lore raw
In reply to Paresh Bhagat
Quoted 7 lines · Paresh Bhagat

[...]
initialization failures. Fixed it by updating nodes in-place using fdt_setprop() to preserve original phandles.

This patch will need the dts to be updated for both AM62a and AM62d i.e. rename wkup_r5fss0_core0_memory_region node from "memory@9c900000" to "dm@9c900000".

Have the patches for that been posted to linux-devicetree yet? I presume the test logs below had the respective changes applied to the DT right?

Signature · 1 line
Anshul Dalal <[email protected]>