Blob Blame History Raw
From 9dba3a5128ff087a33db4d83db1647aa22efc91d Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Date: Fri, 10 Apr 2015 16:43:18 +0200
Subject: Add pc-i440fx-rhel7.2.0 machine type

Message-id: <1428684199-19029-2-git-send-email-dgilbert@redhat.com>
Patchwork-id: 64794
O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/2] Add pc-i440fx-rhel7.2.0 machine type
Bugzilla: 1210050
RH-Acked-by: Bandan Das <bsd@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

There are a bunch of changes between 2.1 and 2.3
that mean we need a new machine type; add it and
add compatibility settings for the older machine
types.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 899d277..49a8a12 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -1001,7 +1001,7 @@ machine_init(pc_machine_init);
 
 /* Red Hat Enterprise Linux machine types */
 
-static void pc_compat_rhel710(MachineState *machine)
+static void pc_compat_rhel720(MachineState *machine)
 {
     /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
      * on AMD CPU models.
@@ -1018,6 +1018,64 @@ static void pc_compat_rhel710(MachineState *machine)
                                 CPUID_EXT2_RDTSCP);
 }
 
+static void pc_init_rhel720(MachineState *machine)
+{
+    pc_compat_rhel720(machine);
+    pc_init_pci(machine);
+}
+
+static QEMUMachine pc_machine_rhel720 = {
+    PC_DEFAULT_MACHINE_OPTIONS,
+    .family = "pc_piix_Y",
+    .name = "pc-i440fx-rhel7.2.0",
+    .alias = "pc",
+    .desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)",
+    .init = pc_init_rhel720,
+    .is_default = 1,
+    .default_machine_opts = "firmware=bios-256k.bin",
+    .default_display = "std",
+    .compat_props = (GlobalProperty[]) {
+        { /* end of list */ }
+    },
+};
+
+static void pc_compat_rhel710(MachineState *machine)
+{
+    PCMachineState *pcms = PC_MACHINE(machine);
+
+    /* 7.1.0 is based on 2.1.2, 7.2.0 is based on 2.3 */
+    pc_compat_rhel720(machine);
+
+    /* From pc_compat_2_2 */
+    rsdp_in_ram = false;
+    x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Conroe", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Penryn", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Nehalem", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Westmere", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("SandyBridge", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Haswell", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Opteron_G1", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Opteron_G2", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Opteron_G3", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Opteron_G4", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Opteron_G5", FEAT_1_EDX, 0, CPUID_VME);
+    x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
+    x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
+    machine->suppress_vmdesc = true;
+
+    /* From pc_compat_2_1 */
+    smbios_uuid_encoded = false;
+    x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
+    x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
+    x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
+    pcms->enforce_aligned_dimm = false;
+}
+
 static void pc_init_rhel710(MachineState *machine)
 {
     pc_compat_rhel710(machine);
@@ -1028,12 +1086,11 @@ static QEMUMachine pc_machine_rhel710 = {
     PC_DEFAULT_MACHINE_OPTIONS,
     .family = "pc_piix_Y",
     .name = "pc-i440fx-rhel7.1.0",
-    .alias = "pc",
     .desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)",
     .init = pc_init_rhel710,
-    .is_default = 1,
     .default_machine_opts = "firmware=bios-256k.bin",
     .compat_props = (GlobalProperty[]) {
+        PC_RHEL7_1_COMPAT,
         { /* end of list */ }
     },
 };
@@ -1562,6 +1619,7 @@ static QEMUMachine pc_machine_rhel600 = {
 
 static void rhel_machine_init(void)
 {
+    qemu_register_pc_machine(&pc_machine_rhel720);
     qemu_register_pc_machine(&pc_machine_rhel710);
     qemu_register_pc_machine(&pc_machine_rhel700);
     qemu_register_pc_machine(&pc_machine_rhel660);
diff --git a/include/hw/compat.h b/include/hw/compat.h
index 313682a..88076f5 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -32,4 +32,34 @@
             .value    = "on",\
         }
 
+/* Mostly like HW_COMPAT_2_1 but:
+ *    we don't need virtio-scsi-pci since 7.0 already had that on
+ */
+#define HW_COMPAT_RHEL7_1 \
+        {\
+            .driver   = "intel-hda",\
+            .property = "old_msi_addr",\
+            .value    = "on",\
+        },{\
+            .driver   = "VGA",\
+            .property = "qemu-extended-regs",\
+            .value    = "off",\
+        },{\
+            .driver   = "secondary-vga",\
+            .property = "qemu-extended-regs",\
+            .value    = "off",\
+        },{\
+            .driver   = "usb-mouse",\
+            .property = "usb_version",\
+            .value    = stringify(1),\
+        },{\
+            .driver   = "usb-kbd",\
+            .property = "usb_version",\
+            .value    = stringify(1),\
+        },{\
+            .driver   = "virtio-pci",\
+            .property = "virtio-pci-bus-master-bug-migration",\
+            .value    = "on",\
+        }
+
 #endif /* HW_COMPAT_H */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d3ba376..bcb97ad 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -522,6 +522,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
  * in pc_piix.c.
  */
 
+/* See include/hw/compat.h for shared compatibility lists */
+#define PC_RHEL7_1_COMPAT \
+        HW_COMPAT_RHEL7_1
+
 /*
  * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_*
  * between our base and 1.5, less stuff backported to RHEL-7.0
@@ -530,6 +534,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
  * pci-serial-4x) in 7.0.
  */
 #define PC_RHEL7_0_COMPAT \
+        PC_RHEL7_1_COMPAT,\
         {\
             .driver   = "virtio-scsi-pci",\
             .property = "any_layout",\