From: Avik Sil <aviksil@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: aliguori@us.ibm.com, agraf@suse.de, david@gibson.dropbear.id.au
Subject: [Qemu-devel] [PATCH 1/2] Make default boot order machine specific
Date: Tue, 23 Oct 2012 15:39:34 +0530 [thread overview]
Message-ID: <1350986975-21786-2-git-send-email-aviksil@linux.vnet.ibm.com> (raw)
In-Reply-To: <1350986975-21786-1-git-send-email-aviksil@linux.vnet.ibm.com>
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.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
---
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(-)
diff --git a/hw/nseries.c b/hw/nseries.c
index 7ada90d..7247e40 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -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)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index bf04a42..9592f16 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -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
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index a265445..1f00aa1 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -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)
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index de33408..355a3ec 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -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)
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index a0d1c3d..6dfbb7b 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -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)
diff --git a/hw/sun4m.c b/hw/sun4m.c
index dbe93f9..7b436be 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -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)
diff --git a/hw/sun4u.c b/hw/sun4u.c
index eeb6496..b77eed7 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -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)
diff --git a/qemu-config.c b/qemu-config.c
index cd1ec21..92dfc8e 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -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 */ }
},
};
diff --git a/vl.c b/vl.c
index ee3c43a..7b1f6c4 100644
--- a/vl.c
+++ b/vl.c
@@ -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;
}
--
1.7.11.4
next prev parent reply other threads:[~2012-10-23 10:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 10:09 [Qemu-devel] [PATCH 0/2] Qemu boot order patch series Avik Sil
2012-10-23 10:09 ` Avik Sil [this message]
2012-10-23 10:20 ` [Qemu-devel] [PATCH 1/2] Make default boot order machine specific Alexander Graf
2012-10-23 13:24 ` Anthony Liguori
2012-10-23 13:28 ` Alexander Graf
2012-10-23 22:43 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-10-23 22:47 ` Alexander Graf
2012-10-23 23:43 ` David Gibson
2012-10-24 1:57 ` Avik Sil
2012-10-23 10:09 ` [Qemu-devel] [PATCH 2/2] pseries: set boot-device property only if boot order specified Avik Sil
2012-10-23 22:45 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-10-24 2:01 ` Avik Sil
2012-10-24 3:54 ` David Gibson
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=1350986975-21786-2-git-send-email-aviksil@linux.vnet.ibm.com \
--to=aviksil@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=david@gibson.dropbear.id.au \
--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).