On Sat, 3 Feb 2024 at 18:37, Raymond Mao <raymond....@linaro.org> wrote: > > Save boot arguments r[0-3] into an array for handover of bloblist from > previous boot stage. > > Signed-off-by: Raymond Mao <raymond....@linaro.org> > Suggested-by: Ard Biesheuvel <a...@kernel.org> > --- > Changes in v2 > - New patch file created for v2. > Changes in v3 > - Swap value of r0 with r2. > Changes in v4 > - Fix a bug when saving the boot args. > Changes in V5 > - Drop the dependence on OF_BOARD. > Changes in V7 > - Exclude the saved_args when BLOBLIST is disabled. > Changes in V8 > - Use PC-relative reference for saved_args. > - Add 4-byte alignment for saved_args. > > arch/arm/cpu/armv7/start.S | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S > index 69e281b086..7730a16e51 100644 > --- a/arch/arm/cpu/armv7/start.S > +++ b/arch/arm/cpu/armv7/start.S > @@ -152,9 +152,38 @@ ENDPROC(c_runtime_cpu_setup) > * > *************************************************************************/ > WEAK(save_boot_params) > +#if (IS_ENABLED(CONFIG_BLOBLIST)) > + /* Calculate the PC-relative address of saved_args */ > + adr r12, saved_args_offset > + ldr r13, saved_args_offset > + add r12, r12, r13 > + > + /* > + * Intentionally swapping r0 with r2 in order to simplify the C > + * function we use later. > + */ > + str r2, [r12] > + str r1, [r12, #4] > + str r0, [r12, #8] > + str r3, [r12, #12] > +#endif > b save_boot_params_ret @ back to my caller > ENDPROC(save_boot_params) > > +#if (IS_ENABLED(CONFIG_BLOBLIST)) > +saved_args_offset: > + .long saved_args - . /* offset from current code to save_args */ > + > + .section .data > + .align 2 > + .global saved_args > +saved_args: > + .rept 4 > + .word 0 > + .endr > +END(saved_args) > +#endif > + > #ifdef CONFIG_ARMV7_LPAE > WEAK(switch_to_hypervisor) > b switch_to_hypervisor_ret > -- > 2.25.1 >
Reviewed-by: Ilias Apalodimas <ilias.apalodi...@linaro.org>