diff mbox

[1/2] Set a default CPU type for compat PC machine defs.

Message ID 1280320944-5560-2-git-send-email-Jes.Sorensen@redhat.com
State New
Headers show

Commit Message

Jes Sorensen July 28, 2010, 12:42 p.m. UTC
From: Jes Sorensen <Jes.Sorensen@redhat.com>

This allows for changing the default CPU type on the current PC
definition without breaking legacy mode.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/boards.h  |    1 +
 hw/pc_piix.c |   15 +++++++++++++++
 vl.c         |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/boards.h b/hw/boards.h
index 6f0f0d7..932bc23 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -19,6 +19,7 @@  typedef struct QEMUMachine {
     QEMUMachineInitFunc *init;
     int use_scsi;
     int max_cpus;
+    const char *def_cpu_model;
     unsigned int no_serial:1,
         no_parallel:1,
         use_virtcon:1,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 812ddfd..51742a0 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -223,6 +223,11 @@  static QEMUMachine pc_machine_v0_12 = {
     .desc = "Standard PC",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-serial-pci",
@@ -242,6 +247,11 @@  static QEMUMachine pc_machine_v0_11 = {
     .desc = "Standard PC, qemu 0.11",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-blk-pci",
@@ -277,6 +287,11 @@  static QEMUMachine pc_machine_v0_10 = {
     .desc = "Standard PC, qemu 0.10",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-blk-pci",
diff --git a/vl.c b/vl.c
index ba6ee11..ca2c509 100644
--- a/vl.c
+++ b/vl.c
@@ -2868,6 +2868,8 @@  int main(int argc, char **argv, char **envp)
     }
     qemu_add_globals();
 
+    if ((cpu_model == NULL) && (machine->def_cpu_model))
+        cpu_model = machine->def_cpu_model;
     machine->init(ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);