[PATCH 2/5] qemu-arm: Get bloblist from boot arguments

Michal Simek michal.simek at amd.com
Wed Dec 20 12:03:22 CET 2023



On 12/19/23 22:11, Raymond Mao wrote:
> Add platform custom function to get bloblist from boot arguments.
> Check whether boot arguments aligns with the register conventions
> defined in FW Handoff spec v0.9.
> Add bloblist related options into qemu default config.
> 
> Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> ---
>   board/emulation/qemu-arm/Makefile        |  1 +
>   board/emulation/qemu-arm/lowlevel_init.S | 19 +++++++++
>   board/emulation/qemu-arm/qemu-arm.c      | 51 ++++++++++++++++++++++++
>   configs/qemu_arm64_defconfig             |  3 ++
>   4 files changed, 74 insertions(+)
>   create mode 100644 board/emulation/qemu-arm/lowlevel_init.S
> 
> diff --git a/board/emulation/qemu-arm/Makefile b/board/emulation/qemu-arm/Makefile
> index a22d1237ff..0eb262e4e2 100644
> --- a/board/emulation/qemu-arm/Makefile
> +++ b/board/emulation/qemu-arm/Makefile
> @@ -1,3 +1,4 @@
>   # SPDX-License-Identifier: GPL-2.0+
>   
>   obj-y	+= qemu-arm.o
> +obj-y	+= lowlevel_init.o
> diff --git a/board/emulation/qemu-arm/lowlevel_init.S b/board/emulation/qemu-arm/lowlevel_init.S
> new file mode 100644
> index 0000000000..d72d7c938a
> --- /dev/null
> +++ b/board/emulation/qemu-arm/lowlevel_init.S
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +/*
> + * Copyright (c) 2023, Linaro Limited
> + */
> +
> +#include <config.h>
> +
> +.global save_boot_params
> +save_boot_params:
> +#ifdef CONFIG_ARM64
> +	adr x9, qemu_saved_args
> +	stp x0, x1, [x9]
> +	/* Increment the address by 16 bytes for the next pair of values */
> +	stp x2, x3, [x9, #16]

There is specified how transfer list should be passed from one stage to another.
Which pretty much saying that when bloblist is enabled this is what you can 
expect on arm64.
Why not to add it directly to?
arch/arm/cpu/armv8/start.S

WEAK(save_boot_params)
#if bloblist
	(your code)
#endif
        b       save_boot_params_ret    /* back to my caller */
ENDPROC(save_boot_params)

because pretty much all platforms which want to switch to it will just c&p your 
code.

that being said qemu_saved_args can become just generic save_args and you can 
also allocate space in .data section in this file.

> +#else
> +	ldr r12, =qemu_saved_args
> +	stm r12, {r0, r1, r2, r3}

And this part should go to arch/arm/cpu/armv7/start.S

M


More information about the U-Boot mailing list