qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH 2/2] hw/ppc/spapr Add qemu_register_boot_set for S


From: Dinar Valeev
Subject: Re: [Qemu-ppc] [PATCH 2/2] hw/ppc/spapr Add qemu_register_boot_set for SPAPR
Date: Sat, 24 Jan 2015 17:11:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 01/24/2015 12:04 AM, Alexander Graf wrote:


On 23.01.15 23:51, address@hidden wrote:
From: Dinar Valeev <address@hidden>

In order to have -boot once=d functioning, it is required to have
qemu_register_boot_set

qemu-system-ppc64 -enable-kvm -boot once=d

Ready!
0 > dev /chosen   ok
0 > .properties
...
qemu,boot-device                 d
...
0 > reset-all

Ready!
0 > dev /chosen   ok
0 > .properties
...
qemu,boot-device                 cdn
...

Signed-off-by: Dinar Valeev <address@hidden>
---
  hw/ppc/spapr.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 3d2cfa3..38b03fc 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -314,6 +314,16 @@ static void add_str(GString *s, const gchar *s1)
      g_string_append_len(s, s1, strlen(s1) + 1);
  }

+static void spapr_boot_set(void *opaque, const char *boot_device,
+                           Error **errp)
+{
+    int offset;
+    offset = fdt_path_offset(opaque, "/chosen");
+    fdt_setprop_string(opaque, offset, "qemu,boot-device", boot_device);
+
+}
+
+
  static void *spapr_create_fdt_skel(hwaddr initrd_base,
                                     hwaddr initrd_size,
                                     hwaddr kernel_size,
@@ -414,6 +424,8 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
      if (boot_device) {
          _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
      }
+    qemu_register_boot_set(spapr_boot_set, fdt);

If you simply move the code above (the _FDT() one) from create_fdt_skel
to spapr_finalize_fdt() you should have the same net effect and much
cleaner code :).
Haven't tried it, but I suspect -boot once=d on reset will be still equal to -boot d behaviour.

And does it make sense to split boot_device from the rest?

Alex

+
      if (boot_menu) {
          _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu)));
      }





reply via email to

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