[PATCH] armv8: Fix transfer list passing with KVM
Raymond Mao
raymondmaoca at gmail.com
Tue Nov 4 16:09:29 CET 2025
Hi Ilias,
On Tue, Nov 4, 2025 at 10:04 AM Ilias Apalodimas <
ilias.apalodimas at linaro.org> wrote:
> When loading U-Boot in a low memory address, the adpr instruction
> to preserve saved_args[] end up within the memory space of QEMUs
> mapped pflashes. As a result the following store pair instructions
> lead to a crash since instructions that modify more than one registers
> can't trap into KVM.
>
> This problem can be solved with loading U-Boot with -kernel
> and defining a different text base address. But when running with
> -bios we always start from 0x0. So let's postpone the calculation
> of saved_args[] post relocation, where we will have an address that
> doesn't collide with the QEMU flashes.
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
> arch/arm/cpu/armv8/start.S | 8 ++++----
> arch/arm/lib/crt0_64.S | 4 ++++
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
> index 40c342e97e9b..ef335de16b79 100644
> --- a/arch/arm/cpu/armv8/start.S
> +++ b/arch/arm/cpu/armv8/start.S
> @@ -387,10 +387,10 @@ ENDPROC(c_runtime_cpu_setup)
> WEAK(save_boot_params)
> #if (IS_ENABLED(CONFIG_BLOBLIST))
> /* Calculate the PC-relative address of saved_args */
> - adrp x9, saved_args
> - add x9, x9, :lo12:saved_args
> - stp x0, x1, [x9]
> - stp x2, x3, [x9, #16]
> + mov x0, x19
> + mov x1, x20
> + mov x2, x21
> + mov x3, x22
> #endif
> b save_boot_params_ret /* back to my caller */
> ENDPROC(save_boot_params)
> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> index 3e7627aa389b..d6246010f368 100644
> --- a/arch/arm/lib/crt0_64.S
> +++ b/arch/arm/lib/crt0_64.S
> @@ -132,6 +132,10 @@ ENTRY(_main)
> b relocate_code
>
> relocation_return:
> + adrp x9, saved_args
> + add x9, x9, :lo12:saved_args
> + stp x19, x20, [x9]
> + stp x21, x22, [x9, #16]
>
>
Acked-by: Raymond Mao <raymondmaoca at gmail.com>
Raymond
> /*
> * Set up final (full) environment
> --
> 2.43.0
>
>
More information about the U-Boot
mailing list