From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Paul Mackerras <paulus@ozlabs.org>,
Michael Ellerman <mpe@ellerman.id.au>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH qemu RFC 2/4] spapr: Allow bios-less configuration
Date: Tue, 23 Jul 2019 13:52:29 +1000 [thread overview]
Message-ID: <20190723035229.GP25073@umbus.fritz.box> (raw)
In-Reply-To: <20190720012850.14369-3-aik@ozlabs.ru>
[-- Attachment #1: Type: text/plain, Size: 6122 bytes --]
On Sat, Jul 20, 2019 at 11:28:48AM +1000, Alexey Kardashevskiy wrote:
> The pseries kernel can do either usual prom-init boot or kexec style boot.
> We always did the prom-init which relies on the completeness of
> the device tree (for example, PCI BARs have to be assigned beforehand) and
> the client interface; the system firmware (SLOF) implements this.
>
> However we can use the kexec style boot as well. To do that, we can skip
> loading SLOF and jump straight to the kernel. GPR5==0 (the client
> interface entry point, SLOF passes a valid pointer there) tells Linux to
> do the kexec boot rather than prom_init so it can proceed to the initramfs.
> With few PCI fixes in the guest kernel, it can boot from PCI (via
> petitboot, for example).
>
> This adds a "bios" machine option which controls whether QEMU loads SLOF
> or jumps directly to the kernel. When bios==off, this does not copy SLOF
> and RTAS into the guest RAM and sets RTAS properties to 0 to bypass
> the kexec user space tool which checks for their presence (not for
> the values though).
BIOS is sometimes used to refer to any machine's firmware, but it's
also used to refer specifically to PC style BIOS. I think it would be
clearer to be explicit here and call the options "slof" rather than
"bios".
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> include/hw/ppc/spapr.h | 1 +
> hw/ppc/spapr.c | 58 ++++++++++++++++++++++++++++++++----------
> 2 files changed, 45 insertions(+), 14 deletions(-)
>
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index ff82bb8554e1..7f5d7a70d27e 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -160,6 +160,7 @@ struct SpaprMachineState {
> long kernel_size;
> bool kernel_le;
> uint64_t kernel_addr;
> + bool bios_enabled;
> uint32_t initrd_base;
> long initrd_size;
> uint64_t rtc_offset; /* Now used only during incoming migration */
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 6d13d65d8996..81ad6a6f28de 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1116,6 +1116,10 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
> _FDT(fdt_setprop(fdt, rtas, "ibm,lrdr-capacity",
> lrdr_capacity, sizeof(lrdr_capacity)));
>
> + /* These are to make kexec-lite happy */
> + _FDT(fdt_setprop_cell(fdt, rtas, "linux,rtas-base", 0));
> + _FDT(fdt_setprop_cell(fdt, rtas, "rtas-size", 0));
What exactly is kexec-lite and what does it need here?
> spapr_dt_rtas_tokens(fdt, rtas);
> }
>
> @@ -1814,7 +1818,11 @@ static void spapr_machine_reset(MachineState *machine)
> spapr->fdt_blob = fdt;
>
> /* Set up the entry state */
> - spapr_cpu_set_entry_state(first_ppc_cpu, SPAPR_ENTRY_POINT, fdt_addr);
> + if (!spapr->bios_enabled) {
> + spapr_cpu_set_entry_state(first_ppc_cpu, spapr->kernel_addr, fdt_addr);
> + } else {
> + spapr_cpu_set_entry_state(first_ppc_cpu, SPAPR_ENTRY_POINT, fdt_addr);
> + }
> first_ppc_cpu->env.gpr[5] = 0;
>
> spapr->cas_reboot = false;
> @@ -3031,20 +3039,22 @@ static void spapr_machine_init(MachineState *machine)
> }
> }
>
> - if (bios_name == NULL) {
> - bios_name = FW_FILE_NAME;
> + if (spapr->bios_enabled) {
> + if (bios_name == NULL) {
> + bios_name = FW_FILE_NAME;
> + }
> + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> + if (!filename) {
> + error_report("Could not find LPAR firmware '%s'", bios_name);
> + exit(1);
> + }
> + fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> + if (fw_size <= 0) {
> + error_report("Could not load LPAR firmware '%s'", filename);
> + exit(1);
> + }
> + g_free(filename);
> }
> - filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> - if (!filename) {
> - error_report("Could not find LPAR firmware '%s'", bios_name);
> - exit(1);
> - }
> - fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
> - if (fw_size <= 0) {
> - error_report("Could not load LPAR firmware '%s'", filename);
> - exit(1);
> - }
> - g_free(filename);
>
> /* FIXME: Should register things through the MachineState's qdev
> * interface, this is a legacy from the sPAPREnvironment structure
> @@ -3266,6 +3276,20 @@ static void spapr_set_kernel_addr(Object *obj, Visitor *v, const char *name,
> visit_type_uint64(v, name, (uint64_t *)opaque, errp);
> }
>
> +static bool spapr_get_bios_enabled(Object *obj, Error **errp)
> +{
> + SpaprMachineState *spapr = SPAPR_MACHINE(obj);
> +
> + return spapr->bios_enabled;
> +}
> +
> +static void spapr_set_bios_enabled(Object *obj, bool value, Error **errp)
> +{
> + SpaprMachineState *spapr = SPAPR_MACHINE(obj);
> +
> + spapr->bios_enabled = value;
> +}
> +
> static char *spapr_get_ic_mode(Object *obj, Error **errp)
> {
> SpaprMachineState *spapr = SPAPR_MACHINE(obj);
> @@ -3379,6 +3403,12 @@ static void spapr_instance_init(Object *obj)
> " for -kernel is the default",
> NULL);
> spapr->kernel_addr = KERNEL_LOAD_ADDR;
> + object_property_add_bool(obj, "bios", spapr_get_bios_enabled,
> + spapr_set_bios_enabled, NULL);
> + object_property_set_description(obj, "bios", "Conrols whether to load bios",
> + NULL);
> + spapr->bios_enabled = true;
> +
> /* The machine class defines the default interrupt controller mode */
> spapr->irq = smc->irq;
> object_property_add_str(obj, "ic-mode", spapr_get_ic_mode,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-07-23 5:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-20 1:28 [Qemu-devel] [PATCH qemu RFC 0/4] spapr: Kexec style boot Alexey Kardashevskiy
2019-07-20 1:28 ` [Qemu-devel] [PATCH qemu RFC 1/4] spapr: Allow changing kernel loading address Alexey Kardashevskiy
2019-07-23 3:49 ` David Gibson
2019-07-23 5:36 ` Alexey Kardashevskiy
2019-07-20 1:28 ` [Qemu-devel] [PATCH qemu RFC 2/4] spapr: Allow bios-less configuration Alexey Kardashevskiy
2019-07-23 3:52 ` David Gibson [this message]
2019-07-23 5:43 ` Alexey Kardashevskiy
2019-07-20 1:28 ` [Qemu-devel] [PATCH qemu RFC 3/4] spapr: Advertise H_RTAS to the guest Alexey Kardashevskiy
2019-07-23 3:53 ` David Gibson
2019-07-23 5:48 ` Alexey Kardashevskiy
2019-07-23 6:14 ` David Gibson
2019-07-23 7:41 ` Alexey Kardashevskiy
2019-07-20 1:28 ` [Qemu-devel] [PATCH qemu RFC 4/4] spapr: Implement SLOF-less client_architecture_support Alexey Kardashevskiy
2019-07-28 6:09 ` David Gibson
2019-07-29 5:03 ` Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190723035229.GP25073@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=aik@ozlabs.ru \
--cc=mpe@ellerman.id.au \
--cc=paulus@ozlabs.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.