qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/riscv: virt: Enable booting S-mode firmware from pflash


From: Andrew Jones
Subject: Re: [PATCH] hw/riscv: virt: Enable booting S-mode firmware from pflash
Date: Mon, 5 Sep 2022 10:07:22 +0200

On Mon, Sep 05, 2022 at 09:59:40AM +0530, Sunil V L wrote:
> To boot S-mode firmware payload like EDK2 from persistent
> flash storage, qemu needs to pass the flash address as the
> next_addr in fw_dynamic_info to the opensbi.
> 
> Update the kernel_entry with the flash address when no kernel
> is specified via QEMU command line  so that opensbi
> can jump to the flash address. This assumes flash drive unit 1 is
> used to keep dynamic payload similar to other architectures.
> 
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> ---
>  hw/riscv/virt.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index ff8c0df5cd..1ee855fded 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -1284,6 +1284,18 @@ static void virt_machine_done(Notifier *notifier, void 
> *data)
>          start_addr = virt_memmap[VIRT_FLASH].base;
>      }
>  
> +    if (drive_get(IF_PFLASH, 0, 1)) {
> +        /*
> +         * Assume second pflash unit (unit=1) to hold the S-mode firmware
> +         * like EDK2. Set kernel_entry to flash address if kernel argument
> +         * is not set and pflash unit 1 is configured.
> +         */
> +        if (!kernel_entry) {
> +            kernel_entry = virt_memmap[VIRT_FLASH].base +
> +                             virt_memmap[VIRT_FLASH].size / 2;
> +        }
> +    }
> +
>      /*
>       * Init fw_cfg.  Must be done before riscv_load_fdt, otherwise the device
>       * tree cannot be altered and we get FDT_ERR_NOSPACE.
> -- 
> 2.25.1
> 
>

Hi Sunil,

We should ensure we can use both edk2 and the '-kernel' option. For
example, guest installation will typically do direct kernel boot,
and when it's desired / necessary to boot that kernel with ACPI, then
we'll also need edk2.

Thanks,
drew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]