[PATCH] arm64: versal: Fix LTO for mini_ospi/mini_qspi

Michal Simek michal.simek at amd.com
Mon Dec 8 14:54:24 CET 2025


From: Pranav Tilak <pranav.vinaytilak at amd.com>

With LTO enabled, mini U-Boot was hanging during reloc_fdt().
The initial stack pointer was placed too low, and the FDT memcpy
destination was carved only 4KB above it. This left insufficient
margin, causing the FDT copy to overwrite the live early stack
and corrupt execution before relocation.

To fix this, increase the malloc heap from 8KB to 12KB and raise the
initial stack pointer by 4KB. Together these adjustments increase
the separation between the early stack and the FDT region during
the pre-relocation phase, eliminating the overlap and fixing the
hang on mini builds (QSPI/OSPI).

Signed-off-by: Pranav Tilak <pranav.vinaytilak at amd.com>
Signed-off-by: Michal Simek <michal.simek at amd.com>
---

 configs/xilinx_versal_mini_ospi_defconfig | 4 ++--
 configs/xilinx_versal_mini_qspi_defconfig | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configs/xilinx_versal_mini_ospi_defconfig b/configs/xilinx_versal_mini_ospi_defconfig
index 11811f3c0fdb..eb101d03973e 100644
--- a/configs/xilinx_versal_mini_ospi_defconfig
+++ b/configs/xilinx_versal_mini_ospi_defconfig
@@ -3,11 +3,11 @@ CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini"
 CONFIG_COUNTER_FREQUENCY=100000000
 CONFIG_ARCH_VERSAL=y
 CONFIG_TEXT_BASE=0xFFFC0000
-CONFIG_SYS_MALLOC_LEN=0x2000
+CONFIG_SYS_MALLOC_LEN=0x3000
 CONFIG_SYS_MALLOC_F_LEN=0x500
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE1000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE2000
 CONFIG_SF_DEFAULT_SPEED=30000000
 CONFIG_ENV_SIZE=0x80
 # CONFIG_DM_GPIO is not set
diff --git a/configs/xilinx_versal_mini_qspi_defconfig b/configs/xilinx_versal_mini_qspi_defconfig
index 47737ce0f8fd..20fab6931c36 100644
--- a/configs/xilinx_versal_mini_qspi_defconfig
+++ b/configs/xilinx_versal_mini_qspi_defconfig
@@ -3,10 +3,10 @@ CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini"
 CONFIG_COUNTER_FREQUENCY=100000000
 CONFIG_ARCH_VERSAL=y
 CONFIG_TEXT_BASE=0xFFFC0000
-CONFIG_SYS_MALLOC_LEN=0x2000
+CONFIG_SYS_MALLOC_LEN=0x3000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE0000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE2000
 CONFIG_SF_DEFAULT_SPEED=30000000
 CONFIG_ENV_SIZE=0x80
 CONFIG_DEFAULT_DEVICE_TREE="versal-mini-qspi-single"
-- 
2.43.0

base-commit: a1f26a9392128309a1affed28b14809845714c21
branch: debian-sent3


More information about the U-Boot mailing list