Skip to contentSkip to conversation

Qemu boot order patch series

PATCH Superseded Avik Sil 4 participants 13 messages Oct 23, 2012 – Oct 24, 2012

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Avik Sil

author
#0 lore raw

cover Qemu boot order patch series

Hi,

This patch series implements requirement 1 of the mailing list discussion [1], i.e., to allow a machine to specify if it wants a default boot order or not. Comments are welcome.

Regards,
Avik

[1] http://lists.nongnu.org/archive/html/qemu-devel/2012-10/msg02799.html

Avik Sil (2):
Make default boot order machine specific
pseries: set boot-device property only if boot order specified

 hw/nseries.c      |  2 ++
 hw/pc_piix.c      | 13 ++++++++++++-
 hw/ppc_newworld.c |  1 +
 hw/ppc_oldworld.c |  1 +
 hw/ppc_prep.c     |  1 +
 hw/spapr.c        |  4 +++-
 hw/sun4m.c        | 10 ++++++++++
 hw/sun4u.c        |  3 +++
 qemu-config.c     |  6 +++++-
 vl.c              | 13 +++++++++----
 10 files changed, 47 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.11.4
author
#9 lore raw

PATCH 2/2 pseries: set boot-device property only if boot order specified

---
 hw/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/spapr.c +3 -1
index 637b3fb..1b2340c 100644
@@ -283,7 +283,9 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
 
         _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop))));
     }
-    _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    if (boot_device) {
+        _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    }
     _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth)));
Signature · 1 line
1.7.11.4
author
#1 lore raw

PATCH 1/2 Make default boot order machine specific

In reply to Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

---
 hw/nseries.c      |  2 ++
 hw/pc_piix.c      | 13 ++++++++++++-
 hw/ppc_newworld.c |  1 +
 hw/ppc_oldworld.c |  1 +
 hw/ppc_prep.c     |  1 +
 hw/sun4m.c        | 10 ++++++++++
 hw/sun4u.c        |  3 +++
 qemu-config.c     |  6 +++++-
 vl.c              | 13 +++++++++----
 9 files changed, 44 insertions(+), 6 deletions(-)
hw/nseries.c +2 -0
index 7ada90d..7247e40 100644
@@ -1427,12 +1427,14 @@ static QEMUMachine n800_machine = {
     .name = "n800",
     .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
     .init = n800_init,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine n810_machine = {
     .name = "n810",
     .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
     .init = n810_init,
+    .default_machine_opts = "boot=cad",
 };
 
 static void nseries_machine_init(void)
hw/pc_piix.c +12 -1
index bf04a42..9592f16 100644
@@ -352,6 +352,7 @@ static QEMUMachine pc_machine_v1_3 = {
     .init = pc_init_pci,
     .max_cpus = 255,
     .is_default = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_1_2 \
@@ -390,6 +391,7 @@ static QEMUMachine pc_machine_v1_2 = {
         PC_COMPAT_1_2,
         { /* end of list */ }
     },
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_1_1 \
@@ -433,6 +435,7 @@ static QEMUMachine pc_machine_v1_1 = {
         PC_COMPAT_1_1,
         { /* end of list */ }
     },
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_1_0 \
@@ -469,6 +472,7 @@ static QEMUMachine pc_machine_v1_0 = {
         { /* end of list */ }
     },
     .hw_version = "1.0",
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_0_15 \
@@ -484,6 +488,7 @@ static QEMUMachine pc_machine_v0_15 = {
         { /* end of list */ }
     },
     .hw_version = "0.15",
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_0_14 \
@@ -525,6 +530,7 @@ static QEMUMachine pc_machine_v0_14 = {
         { /* end of list */ }
     },
     .hw_version = "0.14",
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_0_13 \
@@ -562,6 +568,7 @@ static QEMUMachine pc_machine_v0_13 = {
         { /* end of list */ }
     },
     .hw_version = "0.13",
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_0_12 \
@@ -595,6 +602,7 @@ static QEMUMachine pc_machine_v0_12 = {
         { /* end of list */ }
     },
     .hw_version = "0.12",
+    .default_machine_opts = "boot=cad",
 };
 
 #define PC_COMPAT_0_11 \
@@ -628,6 +636,7 @@ static QEMUMachine pc_machine_v0_11 = {
         { /* end of list */ }
     },
     .hw_version = "0.11",
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine pc_machine_v0_10 = {
@@ -661,6 +670,7 @@ static QEMUMachine pc_machine_v0_10 = {
         { /* end of list */ }
     },
     .hw_version = "0.10",
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine isapc_machine = {
@@ -676,6 +686,7 @@ static QEMUMachine isapc_machine = {
         },
         { /* end of list */ }
     },
+    .default_machine_opts = "boot=cad",
 };
 
 #ifdef CONFIG_XEN
@@ -684,7 +695,7 @@ static QEMUMachine xenfv_machine = {
     .desc = "Xen Fully-virtualized PC",
     .init = pc_xen_hvm_init,
     .max_cpus = HVM_MAX_VCPUS,
-    .default_machine_opts = "accel=xen",
+    .default_machine_opts = "accel=xen,boot=cad",
 };
 #endif
 
hw/ppc_newworld.c +1 -0
index a265445..1f00aa1 100644
@@ -426,6 +426,7 @@ static QEMUMachine core99_machine = {
 #ifdef TARGET_PPC64
     .is_default = 1,
 #endif
+    .default_machine_opts = "boot=cad",
 };
 
 static void core99_machine_init(void)
hw/ppc_oldworld.c +1 -0
index de33408..355a3ec 100644
@@ -341,6 +341,7 @@ static QEMUMachine heathrow_machine = {
 #ifndef TARGET_PPC64
     .is_default = 1,
 #endif
+    .default_machine_opts = "boot=cad",
 };
 
 static void heathrow_machine_init(void)
hw/ppc_prep.c +1 -0
index a0d1c3d..6dfbb7b 100644
@@ -694,6 +694,7 @@ static QEMUMachine prep_machine = {
     .desc = "PowerPC PREP platform",
     .init = ppc_prep_init,
     .max_cpus = MAX_CPUS,
+    .default_machine_opts = "boot=cad",
 };
 
 static void prep_machine_init(void)
hw/sun4m.c +10 -0
index dbe93f9..7b436be 100644
@@ -1428,6 +1428,7 @@ static QEMUMachine ss5_machine = {
     .init = ss5_init,
     .use_scsi = 1,
     .is_default = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine ss10_machine = {
@@ -1436,6 +1437,7 @@ static QEMUMachine ss10_machine = {
     .init = ss10_init,
     .use_scsi = 1,
     .max_cpus = 4,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine ss600mp_machine = {
@@ -1444,6 +1446,7 @@ static QEMUMachine ss600mp_machine = {
     .init = ss600mp_init,
     .use_scsi = 1,
     .max_cpus = 4,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine ss20_machine = {
@@ -1452,6 +1455,7 @@ static QEMUMachine ss20_machine = {
     .init = ss20_init,
     .use_scsi = 1,
     .max_cpus = 4,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine voyager_machine = {
@@ -1459,6 +1463,7 @@ static QEMUMachine voyager_machine = {
     .desc = "Sun4m platform, SPARCstation Voyager",
     .init = vger_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine ss_lx_machine = {
@@ -1466,6 +1471,7 @@ static QEMUMachine ss_lx_machine = {
     .desc = "Sun4m platform, SPARCstation LX",
     .init = ss_lx_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine ss4_machine = {
@@ -1473,6 +1479,7 @@ static QEMUMachine ss4_machine = {
     .desc = "Sun4m platform, SPARCstation 4",
     .init = ss4_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine scls_machine = {
@@ -1480,6 +1487,7 @@ static QEMUMachine scls_machine = {
     .desc = "Sun4m platform, SPARCClassic",
     .init = scls_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine sbook_machine = {
@@ -1487,6 +1495,7 @@ static QEMUMachine sbook_machine = {
     .desc = "Sun4m platform, SPARCbook",
     .init = sbook_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static const struct sun4d_hwdef sun4d_hwdefs[] = {
@@ -1897,6 +1906,7 @@ static QEMUMachine ss2_machine = {
     .desc = "Sun4c platform, SPARCstation 2",
     .init = ss2_init,
     .use_scsi = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static void sun4m_register_types(void)
hw/sun4u.c +3 -0
index eeb6496..b77eed7 100644
@@ -978,6 +978,7 @@ static QEMUMachine sun4u_machine = {
     .init = sun4u_init,
     .max_cpus = 1, // XXX for now
     .is_default = 1,
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine sun4v_machine = {
@@ -985,6 +986,7 @@ static QEMUMachine sun4v_machine = {
     .desc = "Sun4v platform",
     .init = sun4v_init,
     .max_cpus = 1, // XXX for now
+    .default_machine_opts = "boot=cad",
 };
 
 static QEMUMachine niagara_machine = {
@@ -992,6 +994,7 @@ static QEMUMachine niagara_machine = {
     .desc = "Sun4v platform, Niagara",
     .init = niagara_init,
     .max_cpus = 1, // XXX for now
+    .default_machine_opts = "boot=cad",
 };
 
 static void sun4u_register_types(void)
qemu-config.c +5 -1
index cd1ec21..92dfc8e 100644
@@ -619,7 +619,11 @@ static QemuOptsList qemu_machine_opts = {
             .name = "mem-merge",
             .type = QEMU_OPT_BOOL,
             .help = "enable/disable memory merge support",
-        },
+        }, {
+            .name = "boot",
+            .type = QEMU_OPT_STRING,
+            .help = "boot order",
+         },
         { /* End of list */ }
     },
 };
vl.c +9 -4
index ee3c43a..7b1f6c4 100644
@@ -2369,7 +2369,7 @@ int main(int argc, char **argv, char **envp)
     const char *icount_option = NULL;
     const char *initrd_filename;
     const char *kernel_filename, *kernel_cmdline;
-    char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
+    const char *boot_devices = NULL;
     DisplayState *ds;
     DisplayChangeListener *dcl;
     int cyls, heads, secs, translation;
@@ -2645,7 +2645,7 @@ int main(int argc, char **argv, char **envp)
                         "splash", "splash-time",
                         "reboot-timeout", NULL
                     };
-                    char buf[sizeof(boot_devices)];
+                    char buf[33];
                     char *standard_boot_devices;
                     int legacy = 0;
 
@@ -2662,14 +2662,18 @@ int main(int argc, char **argv, char **envp)
                     if (legacy ||
                         get_param_value(buf, sizeof(buf), "order", optarg)) {
                         validate_bootdevices(buf);
-                        pstrcpy(boot_devices, sizeof(boot_devices), buf);
+                        machine_opts = qemu_opts_create(qemu_find_opts("machine"), 
+                                                        NULL, 0, NULL);
+                        qemu_opt_set(machine_opts, "boot", buf);
                     }
                     if (!legacy) {
                         if (get_param_value(buf, sizeof(buf),
                                             "once", optarg)) {
                             validate_bootdevices(buf);
                             standard_boot_devices = g_strdup(boot_devices);
-                            pstrcpy(boot_devices, sizeof(boot_devices), buf);
+                            machine_opts = qemu_opts_create(qemu_find_opts("machine"), 
+                                                            NULL, 0, NULL);
+                            qemu_opt_set(machine_opts, "boot", buf);
                             qemu_register_reset(restore_boot_devices,
                                                 standard_boot_devices);
                         }
@@ -3479,6 +3483,7 @@ int main(int argc, char **argv, char **envp)
         kernel_filename = qemu_opt_get(machine_opts, "kernel");
         initrd_filename = qemu_opt_get(machine_opts, "initrd");
         kernel_cmdline = qemu_opt_get(machine_opts, "append");
+        boot_devices = qemu_opt_get(machine_opts, "boot");
     } else {
         kernel_filename = initrd_filename = kernel_cmdline = NULL;
     }
Signature · 1 line
1.7.11.4
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] Make default boot order machine specific

Quoted 10 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 8 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

The way the patch works right now, the "make machine specific" patch indirectly also changes the behavior for a bunch of machines.

Alex

#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] Make default boot order machine specific

Quoted 11 lines · Alexander Graf
Quoted 9 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 15 lines
Quoted 9 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

I agree, having a default macro would avoid having to touch everything again for the next addition.

Regards,

Anthony Liguori

Quoted 5 lines

The way the patch works right now, the "make machine specific" patch indirectly also changes the behavior for a bunch of machines.

Alex

#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] Make default boot order machine specific

Quoted 29 lines · Anthony Liguori
Quoted 11 lines · Alexander Graf
Quoted 9 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 15 lines
Quoted 9 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

Quoted 2 lines

I agree, having a default macro would avoid having to touch everything again for the next addition.

Well, can you override a default macro? Otherwise we will convert a few machines now to a different boot order default, then add another default thing for a completely different option, and the boot order modified machines miss out the change to the macro.

Alex

#5 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] Make default boot order machine specific

In reply to Alexander Graf
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 15 lines
Quoted 9 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

I'm not 100% clear on what you mean here. Do you just mean:

	#define DEFAULT_BOOT_ORDER	"boot=cad"

and then we use
.default_machine_opts = DEFAULT_BOOT_ORDER,

or something else?

Quoted 2 lines

The way the patch works right now, the "make machine specific" patch indirectly also changes the behavior for a bunch of machines.

A bunch? I thought the only machine whose behaviour changed was pseries. I agree that moving the behaviour change into a separate patch would be a better idea, but if there are machines other than pseries with changed behaviour by this patch, then that's a plain old bug, rather than a mere question of patch elegance.

Signature · 4 lines
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
#10 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] pseries: set boot-device property only if boot order specified

In reply to Avik Sil
Quoted 1 line · Avik Sil

As Anthony suggests, it would be better to explicitly remove the normal default boot order in this patch, after adding it for absolutely everything in the first patch.

This also needs a better patch comment, explaining the significance of the presence/absence of the property on firmware behaviour.

Quoted 19 lines
---
 hw/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/spapr.c +3 -1
index 637b3fb..1b2340c 100644
@@ -283,7 +283,9 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
 
         _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop))));
     }
-    _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    if (boot_device) {
+        _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    }
     _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth)));
Signature · 4 lines
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
#6 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] Make default boot order machine specific

In reply to David Gibson
Quoted 29 lines · David Gibson
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 15 lines
Quoted 9 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

Quoted 6 lines

I'm not 100% clear on what you mean here. Do you just mean:

	#define DEFAULT_BOOT_ORDER	"boot=cad"

and then we use
.default_machine_opts = DEFAULT_BOOT_ORDER,

or something else?

I mean that this patch only patches 7 files. Check this out:

dekai:qemu alex$ grep -R register_machine hw

hw/alpha_dp264.c:    qemu_register_machine(&clipper_machine);
hw/an5206.c:    qemu_register_machine(&an5206_machine);
hw/axis_dev88.c:    qemu_register_machine(&axisdev88_machine);
hw/boards.h:int qemu_register_machine(QEMUMachine *m);
hw/collie.c:    qemu_register_machine(&collie_machine);
hw/dummy_m68k.c:    qemu_register_machine(&dummy_m68k_machine);
hw/exynos4_boards.c:    qemu_register_machine(&exynos4_machines[EXYNOS4_BOARD_NURI]);
hw/exynos4_boards.c:    qemu_register_machine(&exynos4_machines[EXYNOS4_BOARD_SMDKC210]);
hw/gumstix.c:    qemu_register_machine(&connex_machine);
hw/gumstix.c:    qemu_register_machine(&verdex_machine);
hw/highbank.c:    qemu_register_machine(&highbank_machine);
hw/integratorcp.c:    qemu_register_machine(&integratorcp_machine);
hw/leon3.c:    qemu_register_machine(&leon3_generic_machine);
hw/lm32_boards.c:    qemu_register_machine(&lm32_uclinux_machine);
hw/lm32_boards.c:    qemu_register_machine(&lm32_evr_machine);
hw/mainstone.c:    qemu_register_machine(&mainstone2_machine);
hw/mcf5208.c:    qemu_register_machine(&mcf5208evb_machine);
hw/milkymist.c:    qemu_register_machine(&milkymist_machine);
hw/mips_fulong2e.c:    qemu_register_machine(&mips_fulong2e_machine);
hw/mips_jazz.c:    qemu_register_machine(&mips_magnum_machine);
hw/mips_jazz.c:    qemu_register_machine(&mips_pica61_machine);
hw/mips_malta.c:    qemu_register_machine(&mips_malta_machine);
hw/mips_mipssim.c:    qemu_register_machine(&mips_mipssim_machine);
hw/mips_r4k.c:    qemu_register_machine(&mips_machine);
hw/musicpal.c:    qemu_register_machine(&musicpal_machine);
hw/nseries.c:    qemu_register_machine(&n800_machine);
hw/nseries.c:    qemu_register_machine(&n810_machine);
hw/omap_sx1.c:    qemu_register_machine(&sx1_machine_v2);
hw/omap_sx1.c:    qemu_register_machine(&sx1_machine_v1);
hw/palm.c:    qemu_register_machine(&palmte_machine);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v1_1);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v1_0);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_15);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_14);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_13);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_12);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_11);
hw/pc_piix.c:    qemu_register_machine(&pc_machine_v0_10);
hw/pc_piix.c:    qemu_register_machine(&isapc_machine);
hw/pc_piix.c:    qemu_register_machine(&xenfv_machine);
hw/petalogix_ml605_mmu.c:    qemu_register_machine(&petalogix_ml605_machine);
hw/petalogix_s3adsp1800_mmu.c:    qemu_register_machine(&petalogix_s3adsp1800_machine);
hw/ppc405_boards.c:    qemu_register_machine(&ref405ep_machine);
hw/ppc405_boards.c:    qemu_register_machine(&taihu_machine);
hw/ppc440_bamboo.c:    qemu_register_machine(&bamboo_machine);
hw/ppc_newworld.c:    qemu_register_machine(&core99_machine);
hw/ppc_oldworld.c:    qemu_register_machine(&heathrow_machine);
hw/ppc_prep.c:    qemu_register_machine(&prep_machine);
hw/ppce500_mpc8544ds.c:    qemu_register_machine(&mpc8544ds_machine);
hw/r2d.c:    qemu_register_machine(&r2d_machine);
hw/realview.c:    qemu_register_machine(&realview_eb_machine);
hw/realview.c:    qemu_register_machine(&realview_eb_mpcore_machine);
hw/realview.c:    qemu_register_machine(&realview_pb_a8_machine);
hw/realview.c:    qemu_register_machine(&realview_pbx_a9_machine);
hw/s390-virtio.c:    qemu_register_machine(&s390_machine);
hw/shix.c:    qemu_register_machine(&shix_machine);
hw/spapr.c:    qemu_register_machine(&spapr_machine);
hw/spitz.c:    qemu_register_machine(&akitapda_machine);
hw/spitz.c:    qemu_register_machine(&spitzpda_machine);
hw/spitz.c:    qemu_register_machine(&borzoipda_machine);
hw/spitz.c:    qemu_register_machine(&terrierpda_machine);
hw/stellaris.c:    qemu_register_machine(&lm3s811evb_machine);
hw/stellaris.c:    qemu_register_machine(&lm3s6965evb_machine);
hw/sun4m.c:    qemu_register_machine(&ss5_machine);
hw/sun4m.c:    qemu_register_machine(&ss10_machine);
hw/sun4m.c:    qemu_register_machine(&ss600mp_machine);
hw/sun4m.c:    qemu_register_machine(&ss20_machine);
hw/sun4m.c:    qemu_register_machine(&voyager_machine);
hw/sun4m.c:    qemu_register_machine(&ss_lx_machine);
hw/sun4m.c:    qemu_register_machine(&ss4_machine);
hw/sun4m.c:    qemu_register_machine(&scls_machine);
hw/sun4m.c:    qemu_register_machine(&sbook_machine);
hw/sun4m.c:    qemu_register_machine(&ss1000_machine);
hw/sun4m.c:    qemu_register_machine(&ss2000_machine);
hw/sun4m.c:    qemu_register_machine(&ss2_machine);
hw/sun4u.c:    qemu_register_machine(&sun4u_machine);
hw/sun4u.c:    qemu_register_machine(&sun4v_machine);
hw/sun4u.c:    qemu_register_machine(&niagara_machine);
hw/tosa.c:    qemu_register_machine(&tosapda_machine);
hw/versatilepb.c:    qemu_register_machine(&versatilepb_machine);
hw/versatilepb.c:    qemu_register_machine(&versatileab_machine);
hw/vexpress.c:    qemu_register_machine(&vexpress_a9_machine);
hw/vexpress.c:    qemu_register_machine(&vexpress_a15_machine);
hw/virtex_ml507.c:    qemu_register_machine(&virtex_machine);
hw/xen_machine_pv.c:    qemu_register_machine(&xenpv_machine);
hw/xilinx_zynq.c:    qemu_register_machine(&zynq_machine);
hw/xtensa_lx60.c:    qemu_register_machine(&xtensa_lx60_machine);
hw/xtensa_lx60.c:    qemu_register_machine(&xtensa_lx200_machine);
hw/xtensa_sim.c:    qemu_register_machine(&xtensa_sim_machine);
hw/z2.c:    qemu_register_machine(&z2_machine);

Looks like a lot more files to me :).

Quoted 6 lines
Quoted 3 lines

The way the patch works right now, the "make machine specific" patch indirectly also changes the behavior for a bunch of machines.

A bunch? I thought the only machine whose behaviour changed was pseries.

It changes the behavior of all machines that are not patched, because they will fall back to no boot order now.

Alex

Quoted 11 lines

I agree that moving the behaviour change into a separate patch would be a better idea, but if there are machines other than pseries with changed behaviour by this patch, then that's a plain old bug, rather than a mere question of patch elegance.

Signature · 4 lines
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
#7 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] Make default boot order machine specific

Quoted 32 lines · Alexander Graf
Quoted 29 lines · David Gibson
Quoted 27 lines · Alexander Graf
Quoted 10 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 8 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

Quoted 8 lines
Quoted 6 lines

I'm not 100% clear on what you mean here. Do you just mean:

	#define DEFAULT_BOOT_ORDER	"boot=cad"

and then we use
.default_machine_opts = DEFAULT_BOOT_ORDER,

or something else?

I mean that this patch only patches 7 files. Check this out:

Oh, yes, oops. Saw the big pile of hunks changing machines and assumed that was all, but in fact half of them were just the PC variants.

Avik, this will need to be fixed.

Signature · 4 lines
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
author
#8 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] Make default boot order machine specific

Quoted 40 lines · David Gibson
Quoted 39 lines · Alexander Graf
Quoted 35 lines · David Gibson
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Avik Sil

This patch makes default boot order machine specific instead of set globally. The default boot order can be set per machine in QEMUMachine default_machine_opts, or by the command line using -machine <machine_name>,boot=<boot_devices>, or by standard -boot option. This allows a machine to receive a NULL boot order when -boot isn't used and take an appropriate action accordingly. This helps machine boots from the devices as set in guest's non-volatile memory location in case no boot order is provided by the user.

Quoted 15 lines
Quoted 9 lines

---

hw/nseries.c      |  2 ++
hw/pc_piix.c      | 13 ++++++++++++-
hw/ppc_newworld.c |  1 +
hw/ppc_oldworld.c |  1 +
hw/ppc_prep.c     |  1 +
hw/sun4m.c        | 10 ++++++++++
hw/sun4u.c        |  3 +++

That feels like too much magic for my taste. Can't we have some default macro (or even the explicit "cad" thing) that we push to _every_ machine description out there? The next patch to implement boot= for pseries would then remove this default value for the pseries machine.

I'm not 100% clear on what you mean here. Do you just mean:

	#define DEFAULT_BOOT_ORDER	"boot=cad"

and then we use
.default_machine_opts = DEFAULT_BOOT_ORDER,

or something else?

Quoted 8 lines
Quoted 1 line

I mean that this patch only patches 7 files. Check this out:

Oh, yes, oops. Saw the big pile of hunks changing machines and assumed that was all, but in fact half of them were just the PC variants.

Avik, this will need to be fixed.

Sure, will do. Actually I patched the machines that do care for boot order like in pc_piix.c and other machines do not care for the order. But in next series I'll do it for every machine.

Regards,
Avik

author
#11 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] pseries: set boot-device property only if boot order specified

In reply to David Gibson
Quoted 10 lines · David Gibson
Quoted 1 line · Avik Sil

As Anthony suggests, it would be better to explicitly remove the normal default boot order in this patch, after adding it for absolutely everything in the first patch.

This also needs a better patch comment, explaining the significance of the presence/absence of the property on firmware behaviour.

Sure. Shall I make the boot order for pseries as NULL string or empty string? Current patch handles NULL string.

Regards,
Avik

Quoted 20 lines
Quoted 19 lines
---
 hw/spapr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/spapr.c +3 -1
index 637b3fb..1b2340c 100644
@@ -283,7 +283,9 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
 
         _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop))));
     }
-    _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    if (boot_device) {
+        _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
+    }
     _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height)));
     _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth)));
#12 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] pseries: set boot-device property only if boot order specified

Quoted 8 lines · Avik Sil
Quoted 7 lines · David Gibson
Quoted 1 line · Avik Sil

As Anthony suggests, it would be better to explicitly remove the normal default boot order in this patch, after adding it for absolutely everything in the first patch.

Quoted 5 lines
Quoted 3 lines

This also needs a better patch comment, explaining the significance of the presence/absence of the property on firmware behaviour.

Sure. Shall I make the boot order for pseries as NULL string or empty string? Current patch handles NULL string.

NULL is better, I think.

Signature · 4 lines
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