[PATCH, v2] bootm: Pass SMP core ID and DTB address for ELF-formatted kernels

Tom Rini trini at konsulko.com
Thu Jun 12 20:14:32 CEST 2025


On Thu, Jun 12, 2025 at 09:08:50AM +0000, 牛 志宏 wrote:

> When booting RISC-V ELF-formatted kernel images (IH_TYPE_KERNEL + IH_OS_ELF),
> explicitly pass SMP hart ID (via a0/argc) and DTB address (via a1/argv)
> to comply with modern SMP-enabled kernels' boot protocol requirements.
> See https://www.kernel.org/doc/html/latest/arch/riscv/boot.html#register-state
> 
> Signed-off-by: Zone.N <zone.niuzh at hotmail.com>
> ---
> boot/bootm_os.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> 
> diff --git a/boot/bootm_os.c b/boot/bootm_os.c
> index a3c7cb5332e..d95477f1344 100644
> --- a/boot/bootm_os.c
> +++ b/boot/bootm_os.c
> @@ -402,6 +402,17 @@ static int do_bootm_elf(int flag, struct bootm_info *bmi)
> if (flag != BOOTM_STATE_OS_GO)
> return 0;
> +/*
> + * Required per RISC-V boot protocol:
> + * a0(argc) = hartid of the current core
> + * a1(argv) = address of the devicetree in memory
> + * https://www.kernel.org/doc/html/latest/arch/riscv/boot.html#register-state
> + */
> +#if defined(CONFIG_RISCV)
> + bmi->argc = gd->arch.boot_hart;
> + bmi->argv = (char **)bmi->images->ft_addr;
> +#endif
> +
> bootelf(bmi->images->ep, flags, bmi->argc, bmi->argv);
> return 1;

Something entirely ate the spacing, please repost, thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250612/853dc6e9/attachment.sig>


More information about the U-Boot mailing list