diff options
| author | Suraj Kakade <[email protected]> | 2026-08-26 14:04:48 +0200 |
|---|---|---|
| committer | Michal Simek <[email protected]> | 2026-09-04 12:44:20 +0200 |
| commit | feb44bd09ff673aa64f329a5a60a950b8197507f (patch) | |
| tree | 0103227edc04ffb05a13be9b31a9c6cb5aa5524b | |
| parent | 404bb0449a31a1a23dc2dbb5ff68cc72797487eb (diff) | |
board: xilinx: versal-net: move platform_id/platform_version to .data
platform_id and platform_version are plain uninitialized statics,
placing them in .bss. U-Boot's linker script overlays .bss at the
same address as .rela.dyn (the relocation table), which is safe only
if nothing writes to .bss before relocation completes.
soc_detection() writes these variables during early board_init_f(),
well before relocation, corrupting live .rela.dyn entries. When
relocate_code() later reads the corrupted entry, it writes to an
invalid, unaligned address. QEMU 8.x tolerated this silently, QEMU
10.x enforces alignment checks and traps it, causing U-Boot to hang
right after printing "DRAM: 2 GiB", never reaching the console
prompt.
Move both variables to .data via __section(".data") so they no longer
share an address with the relocation table.
Fixes: f6aebdf676ed ("arm64: versal-net: Add support for Versal NET platform")
Signed-off-by: Suraj Kakade <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
Link: https://patch.msgid.link/5908d1dcf2a650cac2b22d82e7f789b978f70748.1787745885.git.michal.simek@amd.com
| -rw-r--r-- | arch/arm/mach-versal-net/cpu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/mach-versal-net/cpu.c b/arch/arm/mach-versal-net/cpu.c index 7df7c49ac71..1555751da2e 100644 --- a/arch/arm/mach-versal-net/cpu.c +++ b/arch/arm/mach-versal-net/cpu.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2021 - 2022, Xilinx, Inc. - * Copyright (C) 2022, Advanced Micro Devices, Inc. + * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> */ @@ -151,7 +151,8 @@ u8 __weak versal_net_get_bootmode(void) return reg & BOOT_MODES_MASK; } -static u32 platform_id, platform_version; +static u32 platform_id __section(".data"); +static u32 platform_version __section(".data"); char *soc_name_decode(void) { |
