i.MX8QM: U-boot is conflicting with M4_0/M4_1 DDR aliasing memory region

I am trying to compile the SCUFW using the SC_BD_FLAGS_ALT_CONFIG boot flag, so that I have separate partitioning for the M4 cores. When I use this option, u-boot gives the following error:

Reading file would overwrite reserved memory

I narrowed down the problem to a conflict with the M4_0/M4_1 DDR aliasing memory region (0x8800000-0x8FFFFFF). I recompiled the SCUFW with this memory region removed from the partition, and the problem went away. I need to fix this, as my M4 code needs to access this region.

I’m using an Apalis i.MX8QuadMax (MIMX8QM6AVUFFAB)

root@apalis-vhu2:~# uname -a
Linux apalis-vhu2 5.4.91-0+git.c59b3c2da1e9 #1 SMP PREEMPT Fri Jul 30 21:26:59 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

I’m using u-boot with commit: ea16d2b66c9b5e3cda7acca2d68017caf353909d

I’m using SCUFW based on: imx-scfw-porting-kit-1.7.0

These are the mkimage commands I’m using to boot the container:

Normal imx-boot container compilation (u-boot boots linux successfully):
make SOC=iMX8QM flash_b0:
./…/mkimage_imx8 -soc QM -rev B0 -append mx8qmb0-ahab-container.img -c -scfw scfw_tcm.bin -ap u-boot-atf.bin a53 0x80000000 -out flash.bin

Change to put M4_0 in it’s own partition (u-boot fails to boot linux with “Reading file would overwrite reserved memory” error):
make SOC=iMX8QM flash_regression_linux_m4:
./…/mkimage_imx8 -soc QM -rev B0 -append mx8qmb0-ahab-container.img -c -flags 0x00200000 -scfw scfw_tcm.bin -ap u-boot-atf.bin a53 0x80000000 -p3 -m4 m4_image.bin 0 0x34FE0000 -p4 -m4 m4_1_image.bin 1 0x38FE0000 -out flash.bin

Greetings @dlm080,

I’ll most likely need to escalate your issue to our development team since the SCFW is a somewhat advanced topic.

Just so we have additional information can you provide a patch/diff of the changes you did to the SCFW.

Also if you could share, what is your objective/reason for wanting separate partitioning on the M4 cores?

Best Regards,
Jeremias

Hi @dlm080 , when SC_BD_FLAGS_ALT_CONFIG is set to 0x00200000, the default SCU code will assign memory to M4_0 and M4_1 as the following.

MCU0
static const sc_rm_mem_list_t mem_list[2U] =
    {
        {0x088000000ULL, 0x0887FFFFFULL},
        {0x008081000ULL, 0x008180FFFULL}
    };

MCU1
static const sc_rm_mem_list_t mem_list[2U] =
    {
        {0x088800000ULL, 0x08FFFFFFFULL},
        {0x008181000ULL, 0x008280FFFULL}
    };

The area of 0x880_0000-0x8FF_FFFF is not there nor a valid DDR address. Could you please check?

The region is 0x0_8800_0000 to 0x0_8F00_0000, which is in the DDR Main memory area.

I am using the M4 cores as ASIL rated safety cores, and I want to isolate their resources from the A-cores. Right now I am working with NXP, and the current plan is to move the M4 memory region to a different area since it’s conflicting with u-boot.

From the sc_fw_api.pdf:

Thank you for providing the additional information as well as your requirements.

Since you mentioned that you’re also working with NXP. Is their currently an open thread on the NXP forums where you’re discussing this?

I just want to be synced on this so that our team doesn’t do duplicate work against NXP.

Best Regards,
Jeremias

I don’t have an open thread with NXP, just a contact at NXP that is helping me. I will update this ticket though with the memory-map change that NXP recommends.

Have you received any updates from NXP regarding the memory-map?

No, I am still waiting for the memory-map update from NXP.

Here is the u-boot patch for the M4 conflicting addresses from NXP:

From fb2ccbed91caeabbe70ba65705acc5e38978fda5 Mon Sep 17 00:00:00 2001
From: Aishwarya Banthia <aishwarya.banthia@nxp.com>
Date: Thu, 28 Oct 2021 15:34:42 +0530
Subject: [PATCH 2/2] Update Uboot addresses conflicting with M4 range

Jira: SARVC-2894

Signed-off-by: Aishwarya Banthia <aishwarya.banthia@nxp.com>
---
 include/configs/apalis-imx8.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 9cc7c493ce..30f1f2c45c 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -46,8 +46,8 @@
  * fdt_addr_r		0x83000000	1MiB
  * scriptaddr		0x83100000	15MiB
  * __RESERVED__		0x84000000	48MiB
- * loadaddr		0x87000000	48MiB
- * ramdisk_addr_r	0x8a000000	288MiB (to hdp_addr)
+ * loadaddr		0xA0000000	48MiB
+ * ramdisk_addr_r	0xA3000000	288MiB (to hdp_addr)
  * SYS_MEMTEST_START	0x90000000
  * hdp_addr		0x9c000000
  * SYS_MEMTEST_END	0xC0000000
@@ -56,7 +56,7 @@
 	"fdt_addr_r=0x83000000\0" \
 	"hdp_addr=0x9c000000\0" \
 	"kernel_addr_r=0x80280000\0" \
-	"ramdisk_addr_r=0x8a000000\0" \
+	"ramdisk_addr_r=0xA3000000\0" \
 	"scriptaddr=0x83100000\0"
 
 /* Boot M4 */
@@ -121,7 +121,7 @@
 	"defargs=pci=nomsi"
 
 /* Link Definitions */
-#define CONFIG_LOADADDR			0x87000000
+#define CONFIG_LOADADDR			0xA0000000
 
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
 
-- 
2.25.1