All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] imx9: scmi: Fix SPL trampoline buffer for 1GB DDR
@ 2026-06-18  1:17 ye.li
  2026-06-18  1:17 ` [PATCH 2/3] imx9: scmi: Correct shutdown checking ye.li
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: ye.li @ 2026-06-18  1:17 UTC (permalink / raw)
  To: festevam, u-boot; +Cc: peng.fan, uboot-imx, alice.guo, ye.li

From: Ye Li <ye.li@nxp.com>

After supporting get DRAM size from SM, the trampoline buffer address
still depends on PHYS_SDRAM_SIZE. If the real DDR size is less than
PHYS_SDRAM_SIZE, the trampoline buffer address is invalid and SPL will
crash. So use board_phys_sdram_size to get real DDR size to calculate
correct address.

Fixes: e1cc7117b630 ("imx9: scmi: Get DDR size through SM SCMI API")
Signed-off-by: Ye Li <ye.li@nxp.com>
---
 arch/arm/mach-imx/imx9/scmi/soc.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c
index 00b8693fbe0..ce86cdf8574 100644
--- a/arch/arm/mach-imx/imx9/scmi/soc.c
+++ b/arch/arm/mach-imx/imx9/scmi/soc.c
@@ -1177,10 +1177,11 @@ enum boot_device get_boot_device(void)
 
 bool arch_check_dst_in_secure(void *start, ulong size)
 {
-	ulong ns_end = CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE;
-#ifdef PHYS_SDRAM_2_SIZE
-	ns_end += PHYS_SDRAM_2_SIZE;
-#endif
+	ulong ns_end;
+	phys_size_t dram_size;
+
+	board_phys_sdram_size(&dram_size);
+	ns_end = CFG_SYS_SDRAM_BASE + dram_size;
 
 	if ((ulong)start < CFG_SYS_SDRAM_BASE || (ulong)start + size > ns_end)
 		return true;
@@ -1190,5 +1191,10 @@ bool arch_check_dst_in_secure(void *start, ulong size)
 
 void *arch_get_container_trampoline(void)
 {
-	return (void *)((ulong)CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE - SZ_16M);
+	phys_size_t size;
+
+	board_phys_sdram_size(&size);
+	size = (size > PHYS_SDRAM_SIZE) ? PHYS_SDRAM_SIZE : size;
+
+	return (void *)((ulong)CFG_SYS_SDRAM_BASE + size - SZ_16M);
 }
-- 
2.34.1


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

end of thread, other threads:[~2026-06-18  8:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18  1:17 [PATCH 1/3] imx9: scmi: Fix SPL trampoline buffer for 1GB DDR ye.li
2026-06-18  1:17 ` [PATCH 2/3] imx9: scmi: Correct shutdown checking ye.li
2026-06-18  1:17 ` [PATCH 3/3] imx9: scmi: use 48-bit MAC add instead of incrementing mac[5] ye.li
2026-06-18  2:03   ` Peng Fan
2026-06-18  2:02 ` [PATCH 1/3] imx9: scmi: Fix SPL trampoline buffer for 1GB DDR Peng Fan
2026-06-18  7:00 ` Francesco Dolcini
2026-06-18  8:14   ` Ye Li
2026-06-18  8:41     ` Emanuele Ghidoli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.