Blob Blame Raw
From 9010afecdea6872235b1692c4ee5f04cca2dbcf2 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Wed, 31 Jul 2013 08:02:14 +0200
Subject: pc: Add machine type "rhel6.0.0"

Message-id: <1375201922-6794-3-git-send-email-armbru@redhat.com>
Patchwork-id: 52821
O-Subject: [RHEL-7 PATCH v3 02/15] pc: Add machine type "rhel6.0.0"
Bugzilla: 983991
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>

Make it a copy of upstream's pc-0.12 type.  Change name and desc.
Collect the scattered compat_props in one place (no functional
change).  Copy the init function.

The next few commits will morph compat_props and init function from
"same as upstream's pc-0.12" into "compatible with RHEL-6's
rhel6.0.0".

Signed-off-by: Markus Armbruster <armbru@redhat.com>

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 070a50d..bdb1b11 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -777,9 +777,252 @@ static QEMUMachine pc_machine_rhel700 = {
     DEFAULT_MACHINE_OPTIONS,
 };
 
+#define PC_RHEL6_0_COMPAT \
+    {\
+        .driver   = "Conroe-" TYPE_X86_CPU,\
+        .property = "model",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "Conroe-" TYPE_X86_CPU,\
+        .property = "level",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "Penryn-" TYPE_X86_CPU,\
+        .property = "model",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "Penryn-" TYPE_X86_CPU,\
+        .property = "level",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "Nehalem-" TYPE_X86_CPU,\
+        .property = "model",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "Nehalem-" TYPE_X86_CPU,\
+        .property = "level",\
+        .value    = stringify(2),\
+    },{\
+        .driver   = "scsi-hd",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "scsi-cd",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "scsi-disk",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "ide-hd",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "ide-cd",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "ide-drive",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "virtio-blk-pci",\
+        .property = "discard_granularity",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "virtio-serial-pci",\
+        .property = "vectors",\
+        /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
+        .value    = stringify(0xFFFFFFFF),\
+    },{\
+        .driver   = "e1000",\
+        .property = "romfile",\
+        .value    = "pxe-e1000.rom",\
+    },{\
+        .driver   = "ne2k_pci",\
+        .property = "romfile",\
+        .value    = "pxe-ne2k_pci.rom",\
+    },{\
+        .driver   = "pcnet",\
+        .property = "romfile",\
+        .value    = "pxe-pcnet.rom",\
+    },{\
+        .driver   = "rtl8139",\
+        .property = "romfile",\
+        .value    = "pxe-rtl8139.rom",\
+    },{\
+        .driver   = "virtio-net-pci",\
+        .property = "romfile",\
+        .value    = "pxe-virtio.rom",\
+    },{\
+        .driver   = "486-" TYPE_X86_CPU,\
+        .property = "model",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "usb-tablet",\
+        .property = "usb_version",\
+        .value    = stringify(1),\
+    },{\
+        .driver   = "virtio-net-pci",\
+        .property = "ctrl_mac_addr",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-net-pci",\
+        .property = "mq",\
+        .value    = "off",\
+    },{\
+        .driver   = "e1000",\
+        .property = "autonegotiation",\
+        .value    = "off",\
+    },{\
+        .driver   = "nec-usb-xhci",\
+        .property = "msi",\
+        .value    = "off",\
+    },{\
+        .driver   = "nec-usb-xhci",\
+        .property = "msix",\
+        .value    = "off",\
+    },{\
+        .driver   = "ivshmem",\
+        .property = "use64",\
+        .value    = "0",\
+    },{\
+        .driver   = "qxl",\
+        .property = "revision",\
+        .value    = stringify(3),\
+    },{\
+        .driver   = "qxl-vga",\
+        .property = "revision",\
+        .value    = stringify(3),\
+    },{\
+        .driver   = "VGA",\
+        .property = "mmio",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-scsi-pci",\
+        .property = "hotplug",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-scsi-pci",\
+        .property = "param_change",\
+        .value    = "off",\
+    },{\
+        .driver   = "VGA",\
+        .property = "vgamem_mb",\
+        .value    = stringify(8),\
+    },{\
+        .driver   = "vmware-svga",\
+        .property = "vgamem_mb",\
+        .value    = stringify(8),\
+    },{\
+        .driver   = "qxl-vga",\
+        .property = "vgamem_mb",\
+        .value    = stringify(8),\
+    },{\
+        .driver   = "qxl",\
+        .property = "vgamem_mb",\
+        .value    = stringify(8),\
+    },{\
+        .driver   = "virtio-blk-pci",\
+        .property = "config-wce",\
+        .value    = "off",\
+    },{\
+        .driver   = "pc-sysfw",\
+        .property = "rom_only",\
+        .value    = stringify(1),\
+    },{\
+        .driver   = TYPE_ISA_FDC,\
+        .property = "check_media_rate",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-balloon-pci",\
+        .property = "class",\
+        .value    = stringify(PCI_CLASS_MEMORY_RAM),\
+    },{\
+        .driver   = "apic",\
+        .property = "vapic",\
+        .value    = "off",\
+    },{\
+        .driver   = TYPE_USB_DEVICE,\
+        .property = "full-path",\
+        .value    = "no",\
+    },{\
+        .driver   = "virtio-blk-pci",\
+        .property = "event_idx",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-serial-pci",\
+        .property = "event_idx",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-net-pci",\
+        .property = "event_idx",\
+        .value    = "off",\
+    },{\
+        .driver   = "virtio-balloon-pci",\
+        .property = "event_idx",\
+        .value    = "off",\
+    },{\
+        .driver   = TYPE_PCI_DEVICE,\
+        .property = "command_serr_enable",\
+        .value    = "off",\
+    },{\
+        .driver   = "AC97",\
+        .property = "use_broken_id",\
+        .value    = stringify(1),\
+    },{\
+        .driver   = "virtio-serial-pci",\
+        .property = "max_ports",\
+        .value    = stringify(1),\
+    },{\
+        .driver   = "virtio-serial-pci",\
+        .property = "vectors",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "VGA",\
+        .property = "rombar",\
+        .value    = stringify(0),\
+    },{\
+        .driver   = "vmware-svga",\
+        .property = "rombar",\
+        .value    = stringify(0),\
+    }
+
+static void pc_init_rhel600(QEMUMachineInitArgs *args)
+{
+    ram_addr_t ram_size = args->ram_size;
+    const char *cpu_model = args->cpu_model;
+    const char *kernel_filename = args->kernel_filename;
+    const char *kernel_cmdline = args->kernel_cmdline;
+    const char *initrd_filename = args->initrd_filename;
+    const char *boot_device = args->boot_device;
+    has_pvpanic = false;
+    disable_kvm_pv_eoi();
+    enable_compat_apic_id_mode();
+    pc_init1(get_system_memory(),
+             get_system_io(),
+             ram_size, boot_device,
+             kernel_filename, kernel_cmdline,
+             initrd_filename, cpu_model, 1, 0);
+}
+
+static QEMUMachine pc_machine_rhel600 = {
+    .name = "rhel6.0.0",
+    .desc = "RHEL 6.0.0 PC",
+    .init = pc_init_rhel600,
+    .max_cpus = 255,
+    .compat_props = (GlobalProperty[]) {
+        PC_RHEL6_0_COMPAT,
+        { /* end of list */ }
+    },
+    DEFAULT_MACHINE_OPTIONS,
+};
+
 static void rhel_machine_init(void)
 {
     qemu_register_machine(&pc_machine_rhel700);
+    qemu_register_machine(&pc_machine_rhel600);
 }
 
 machine_init(rhel_machine_init);