diff mbox series

[v8,5/8] arm: armv8: save boot arguments

Message ID 20240203163631.177508-6-raymond.mao@linaro.org
State Accepted
Commit 11f3171256337dfb81ead526bb2dd78503839882
Delegated to: Tom Rini
Headers show
Series Handoff bloblist from previous boot stage | expand

Commit Message

Raymond Mao Feb. 3, 2024, 4:36 p.m. UTC
Save boot arguments x[0-3] into an array for handover of bloblist from
previous boot stage.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
---
Changes in v2
- New patch file created for v2.
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/armv8/start.S | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Ilias Apalodimas Feb. 23, 2024, 7:03 a.m. UTC | #1
On Sat, 3 Feb 2024 at 18:38, Raymond Mao <raymond.mao@linaro.org> wrote:
>
> Save boot arguments x[0-3] into an array for handover of bloblist from
> previous boot stage.
>
> Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> Changes in v2
> - New patch file created for v2.
> 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/armv8/start.S | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
> index 6cc1d26e5e..7461280261 100644
> --- a/arch/arm/cpu/armv8/start.S
> +++ b/arch/arm/cpu/armv8/start.S
> @@ -370,5 +370,28 @@ ENTRY(c_runtime_cpu_setup)
>  ENDPROC(c_runtime_cpu_setup)
>
>  WEAK(save_boot_params)
> +#if (IS_ENABLED(CONFIG_BLOBLIST))
> +       /* Calculate the PC-relative address of saved_args */
> +       adr     x9, saved_args_offset
> +       ldr     w10, saved_args_offset
> +       add     x9, x9, w10, sxtw
> +
> +       stp     x0, x1, [x9]
> +       stp     x2, x3, [x9, #16]
> +#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
> +       .dword 0
> +       .endr
> +END(saved_args)
> +#endif
> --
> 2.25.1
>

 Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index 6cc1d26e5e..7461280261 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -370,5 +370,28 @@  ENTRY(c_runtime_cpu_setup)
 ENDPROC(c_runtime_cpu_setup)
 
 WEAK(save_boot_params)
+#if (IS_ENABLED(CONFIG_BLOBLIST))
+	/* Calculate the PC-relative address of saved_args */
+	adr	x9, saved_args_offset
+	ldr	w10, saved_args_offset
+	add	x9, x9, w10, sxtw
+
+	stp	x0, x1, [x9]
+	stp	x2, x3, [x9, #16]
+#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
+	.dword 0
+	.endr
+END(saved_args)
+#endif