From: Alexander Graf <agraf@suse.de>
To: qemu-ppc@nongnu.org
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 2.3 4/5] PPC: pseries: Implement boot once=foo
Date: Wed, 25 Mar 2015 22:54:59 +0100 [thread overview]
Message-ID: <1427320500-6772-5-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1427320500-6772-1-git-send-email-agraf@suse.de>
On sPAPR we haven't supported boot once ever since it emerged, but
recently grew need for it. This patch implements boot once logic
to it.
While at it, we also move to the new bootdevice handling that got
introduced to the tree recently.
Reported-by: Dinar Valeev <dvaleev@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
hw/ppc/spapr.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 7febff7..ca0a060 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -314,7 +314,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
hwaddr initrd_size,
hwaddr kernel_size,
bool little_endian,
- const char *boot_device,
const char *kernel_cmdline,
uint32_t epow_irq)
{
@@ -407,9 +406,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
_FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0)));
}
}
- if (boot_device) {
- _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
- }
if (boot_menu) {
_FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu)));
}
@@ -721,6 +717,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
hwaddr rtas_addr,
hwaddr rtas_size)
{
+ MachineState *machine = MACHINE(qdev_get_machine());
+ const char *boot_device = machine->boot_order;
int ret, i;
size_t cb = 0;
char *bootlist;
@@ -780,6 +778,15 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist);
}
+ if (boot_device && strlen(boot_device)) {
+ int offset = fdt_path_offset(fdt, "/chosen");
+
+ if (offset < 0) {
+ exit(1);
+ }
+ fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device);
+ }
+
if (!spapr->has_graphics) {
spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
}
@@ -1370,6 +1377,13 @@ static SaveVMHandlers savevm_htab_handlers = {
.load_state = htab_load,
};
+static void spapr_boot_set(void *opaque, const char *boot_device,
+ Error **errp)
+{
+ MachineState *machine = MACHINE(qdev_get_machine());
+ machine->boot_order = g_strdup(boot_device);
+}
+
/* pSeries LPAR / sPAPR hardware init */
static void ppc_spapr_init(MachineState *machine)
{
@@ -1378,7 +1392,6 @@ static void ppc_spapr_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
- const char *boot_device = machine->boot_order;
PowerPCCPU *cpu;
CPUPPCState *env;
PCIHostState *phb;
@@ -1647,9 +1660,10 @@ static void ppc_spapr_init(MachineState *machine)
/* Prepare the device tree */
spapr->fdt_skel = spapr_create_fdt_skel(initrd_base, initrd_size,
kernel_size, kernel_le,
- boot_device, kernel_cmdline,
- spapr->epow_irq);
+ kernel_cmdline, spapr->epow_irq);
assert(spapr->fdt_skel != NULL);
+
+ qemu_register_boot_set(spapr_boot_set, spapr);
}
static int spapr_kvm_type(const char *vm_type)
@@ -1779,7 +1793,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
mc->block_default_type = IF_SCSI;
mc->max_cpus = MAX_CPUS;
mc->no_parallel = 1;
- mc->default_boot_order = NULL;
+ mc->default_boot_order = "";
mc->kvm_type = spapr_kvm_type;
mc->has_dynamic_sysbus = true;
--
1.8.1.4
next prev parent reply other threads:[~2015-03-25 21:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 21:54 [Qemu-devel] [PULL 2.3 0/5] ppc patch queue 2015-03-25 for 2.3 Alexander Graf
2015-03-25 21:54 ` [Qemu-devel] [PULL 2.3 1/5] pseries: Update SLOF firmware image to qemu-slof-20150313 Alexander Graf
2015-03-25 21:54 ` [Qemu-devel] [PULL 2.3 2/5] spapr: Add missing checks for NULL pointers and report failures Alexander Graf
2015-03-25 21:54 ` [Qemu-devel] [PULL 2.3 3/5] target-ppc: Remove POWER5+ v0.0 that never existed Alexander Graf
2015-03-25 21:54 ` Alexander Graf [this message]
2015-03-25 21:55 ` [Qemu-devel] [PULL 2.3 5/5] powerpc: fix -machine usb=no for newworld and pseries machines Alexander Graf
2015-03-26 14:35 ` [Qemu-devel] [PULL 2.3 0/5] ppc patch queue 2015-03-25 for 2.3 Peter Maydell
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=1427320500-6772-5-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=peter.maydell@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).