[PATCH] armv8: Fix transfer list passing with KVM
Ilias Apalodimas
ilias.apalodimas at linaro.org
Wed Nov 5 14:08:41 CET 2025
Hi Tom
On Tue, 4 Nov 2025 at 22:42, Tom Rini <trini at konsulko.com> wrote:
>
> On Tue, Nov 04, 2025 at 05:04:02PM +0200, Ilias Apalodimas 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 */
>
> This comment is no longer correct. We're saving a few regs in other regs
> that can't be touched until later.
>
> > - 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]
>
> Here is where we should comment on what's being calculated (and is it
> safe to do this without BLOBLIST?).
Nop, it actually blowed up during my testing, e.g compiling without
BLOBLIST, but I didn't respond in time.
I'll send a V2 moving the comment and adding an ifdef around this
Thanks
/Ilias
>
> --
> Tom
More information about the U-Boot
mailing list