All of lore.kernel.org
 help / color / mirror / Atom feed
From: dvaleev@suse.de
To: qemu-devel@nongnu.org
Cc: Dinar Valeev <dvaleev@suse.com>,
	Gonglei <arei.gonglei@huawei.com>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
	armbru@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] sPAPR: reread boot_device on reset
Date: Tue, 27 Jan 2015 00:52:20 +0100	[thread overview]
Message-ID: <1422316341-28983-2-git-send-email-dvaleev@suse.de> (raw)
In-Reply-To: <1422316341-28983-1-git-send-email-dvaleev@suse.de>

From: Dinar Valeev <dvaleev@suse.com>

Update boot_device on reset. This is required to have -boot once=X
working.

This patch is moving creating fdt qemu,boot-device entry from
spapr_create_fdt_skel to spapr_finalize_fdt which is used on guest
reset.

Signed-off-by: Dinar Valeev <dvaleev@suse.com>
---
 hw/ppc/spapr.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b560459..36b0bdb 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -318,7 +318,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)
 {
@@ -411,9 +410,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)));
     }
@@ -730,6 +726,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
     char *bootlist;
     void *fdt;
     sPAPRPHBState *phb;
+    MachineState *machine = MACHINE(qdev_get_machine());
+    const char *boot_device = machine->boot_order;
 
     fdt = g_malloc(FDT_MAX_SIZE);
 
@@ -769,6 +767,14 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
         fprintf(stderr, "Couldn't finalize CPU device tree properties\n");
     }
 
+    if (boot_device) {
+        int offset = fdt_path_offset(fdt, "/chosen");
+        ret = fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device);
+        if (ret < 0) {
+            fprintf(stderr, "Couldn't set up boot-device dt property\n");
+        }
+    }
+
     bootlist = get_boot_devices_list(&cb, true);
     if (cb && bootlist) {
         int offset = fdt_path_offset(fdt, "/chosen");
@@ -1347,7 +1353,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;
@@ -1601,8 +1606,7 @@ 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);
 }
 
-- 
2.1.2

  reply	other threads:[~2015-01-26 23:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 23:52 [Qemu-devel] Update boot_order on reset for sPAPR dvaleev
2015-01-26 23:52 ` dvaleev [this message]
2015-01-26 23:52 ` [Qemu-devel] [PATCH 2/2] bootdevice: update boot_order in MachineState dvaleev
2015-01-27  2:51   ` Gonglei
2015-01-27  8:57     ` Dinar Valeev
2015-01-27  9:18       ` Gonglei
2015-01-27  9:56         ` Dinar Valeev
2015-01-27 10:49         ` Dinar Valeev
2015-01-28  1:48           ` Gonglei
2015-01-28 22:22             ` Dinar Valeev
2015-01-29  0:41               ` Gonglei
2015-01-29  7:48               ` Markus Armbruster
2015-01-29 10:53                 ` Alexander Graf
2015-01-29 10:55             ` Alexander Graf
2015-01-29 11:08               ` Gonglei
2015-01-29 11:11                 ` Alexander Graf
2015-01-27  2:31 ` [Qemu-devel] Update boot_order on reset for sPAPR 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=1422316341-28983-2-git-send-email-dvaleev@suse.de \
    --to=dvaleev@suse.de \
    --cc=agraf@suse.de \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=dvaleev@suse.com \
    --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.