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

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

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

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

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

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);
 
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux