Blame SOURCES/kvm-misc-Add-pc-i440fx-rhel7-2-0-machine-type.patch

8be556
From 9dba3a5128ff087a33db4d83db1647aa22efc91d Mon Sep 17 00:00:00 2001
8be556
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
8be556
Date: Fri, 10 Apr 2015 16:43:18 +0200
8be556
Subject: Add pc-i440fx-rhel7.2.0 machine type
8be556
8be556
Message-id: <1428684199-19029-2-git-send-email-dgilbert@redhat.com>
8be556
Patchwork-id: 64794
8be556
O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/2] Add pc-i440fx-rhel7.2.0 machine type
8be556
Bugzilla: 1210050
8be556
RH-Acked-by: Bandan Das <bsd@redhat.com>
8be556
RH-Acked-by: John Snow <jsnow@redhat.com>
8be556
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
8be556
8be556
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
8be556
8be556
There are a bunch of changes between 2.1 and 2.3
8be556
that mean we need a new machine type; add it and
8be556
add compatibility settings for the older machine
8be556
types.
8be556
8be556
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8be556
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
8be556
8be556
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
8be556
index 899d277..49a8a12 100644
8be556
--- a/hw/i386/pc_piix.c
8be556
+++ b/hw/i386/pc_piix.c
8be556
@@ -1001,7 +1001,7 @@ machine_init(pc_machine_init);
8be556
 
8be556
 /* Red Hat Enterprise Linux machine types */
8be556
 
8be556
-static void pc_compat_rhel710(MachineState *machine)
8be556
+static void pc_compat_rhel720(MachineState *machine)
8be556
 {
8be556
     /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
8be556
      * on AMD CPU models.
8be556
@@ -1018,6 +1018,64 @@ static void pc_compat_rhel710(MachineState *machine)
8be556
                                 CPUID_EXT2_RDTSCP);
8be556
 }
8be556
 
8be556
+static void pc_init_rhel720(MachineState *machine)
8be556
+{
8be556
+    pc_compat_rhel720(machine);
8be556
+    pc_init_pci(machine);
8be556
+}
8be556
+
8be556
+static QEMUMachine pc_machine_rhel720 = {
8be556
+    PC_DEFAULT_MACHINE_OPTIONS,
8be556
+    .family = "pc_piix_Y",
8be556
+    .name = "pc-i440fx-rhel7.2.0",
8be556
+    .alias = "pc",
8be556
+    .desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)",
8be556
+    .init = pc_init_rhel720,
8be556
+    .is_default = 1,
8be556
+    .default_machine_opts = "firmware=bios-256k.bin",
8be556
+    .default_display = "std",
8be556
+    .compat_props = (GlobalProperty[]) {
8be556
+        { /* end of list */ }
8be556
+    },
8be556
+};
8be556
+
8be556
+static void pc_compat_rhel710(MachineState *machine)
8be556
+{
8be556
+    PCMachineState *pcms = PC_MACHINE(machine);
8be556
+
8be556
+    /* 7.1.0 is based on 2.1.2, 7.2.0 is based on 2.3 */
8be556
+    pc_compat_rhel720(machine);
8be556
+
8be556
+    /* From pc_compat_2_2 */
8be556
+    rsdp_in_ram = false;
8be556
+    x86_cpu_compat_set_features("kvm64", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("kvm32", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Conroe", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Penryn", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Nehalem", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Westmere", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("SandyBridge", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Haswell", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Opteron_G1", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Opteron_G2", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Opteron_G3", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Opteron_G4", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Opteron_G5", FEAT_1_EDX, 0, CPUID_VME);
8be556
+    x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
8be556
+    x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
8be556
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
8be556
+    x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
8be556
+    machine->suppress_vmdesc = true;
8be556
+
8be556
+    /* From pc_compat_2_1 */
8be556
+    smbios_uuid_encoded = false;
8be556
+    x86_cpu_compat_set_features("coreduo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
8be556
+    x86_cpu_compat_set_features("core2duo", FEAT_1_ECX, CPUID_EXT_VMX, 0);
8be556
+    x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
8be556
+    pcms->enforce_aligned_dimm = false;
8be556
+}
8be556
+
8be556
 static void pc_init_rhel710(MachineState *machine)
8be556
 {
8be556
     pc_compat_rhel710(machine);
8be556
@@ -1028,12 +1086,11 @@ static QEMUMachine pc_machine_rhel710 = {
8be556
     PC_DEFAULT_MACHINE_OPTIONS,
8be556
     .family = "pc_piix_Y",
8be556
     .name = "pc-i440fx-rhel7.1.0",
8be556
-    .alias = "pc",
8be556
     .desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)",
8be556
     .init = pc_init_rhel710,
8be556
-    .is_default = 1,
8be556
     .default_machine_opts = "firmware=bios-256k.bin",
8be556
     .compat_props = (GlobalProperty[]) {
8be556
+        PC_RHEL7_1_COMPAT,
8be556
         { /* end of list */ }
8be556
     },
8be556
 };
8be556
@@ -1562,6 +1619,7 @@ static QEMUMachine pc_machine_rhel600 = {
8be556
 
8be556
 static void rhel_machine_init(void)
8be556
 {
8be556
+    qemu_register_pc_machine(&pc_machine_rhel720);
8be556
     qemu_register_pc_machine(&pc_machine_rhel710);
8be556
     qemu_register_pc_machine(&pc_machine_rhel700);
8be556
     qemu_register_pc_machine(&pc_machine_rhel660);
8be556
diff --git a/include/hw/compat.h b/include/hw/compat.h
8be556
index 313682a..88076f5 100644
8be556
--- a/include/hw/compat.h
8be556
+++ b/include/hw/compat.h
8be556
@@ -32,4 +32,34 @@
8be556
             .value    = "on",\
8be556
         }
8be556
 
8be556
+/* Mostly like HW_COMPAT_2_1 but:
8be556
+ *    we don't need virtio-scsi-pci since 7.0 already had that on
8be556
+ */
8be556
+#define HW_COMPAT_RHEL7_1 \
8be556
+        {\
8be556
+            .driver   = "intel-hda",\
8be556
+            .property = "old_msi_addr",\
8be556
+            .value    = "on",\
8be556
+        },{\
8be556
+            .driver   = "VGA",\
8be556
+            .property = "qemu-extended-regs",\
8be556
+            .value    = "off",\
8be556
+        },{\
8be556
+            .driver   = "secondary-vga",\
8be556
+            .property = "qemu-extended-regs",\
8be556
+            .value    = "off",\
8be556
+        },{\
8be556
+            .driver   = "usb-mouse",\
8be556
+            .property = "usb_version",\
8be556
+            .value    = stringify(1),\
8be556
+        },{\
8be556
+            .driver   = "usb-kbd",\
8be556
+            .property = "usb_version",\
8be556
+            .value    = stringify(1),\
8be556
+        },{\
8be556
+            .driver   = "virtio-pci",\
8be556
+            .property = "virtio-pci-bus-master-bug-migration",\
8be556
+            .value    = "on",\
8be556
+        }
8be556
+
8be556
 #endif /* HW_COMPAT_H */
8be556
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
8be556
index d3ba376..bcb97ad 100644
8be556
--- a/include/hw/i386/pc.h
8be556
+++ b/include/hw/i386/pc.h
8be556
@@ -522,6 +522,10 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
8be556
  * in pc_piix.c.
8be556
  */
8be556
 
8be556
+/* See include/hw/compat.h for shared compatibility lists */
8be556
+#define PC_RHEL7_1_COMPAT \
8be556
+        HW_COMPAT_RHEL7_1
8be556
+
8be556
 /*
8be556
  * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_*
8be556
  * between our base and 1.5, less stuff backported to RHEL-7.0
8be556
@@ -530,6 +534,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
8be556
  * pci-serial-4x) in 7.0.
8be556
  */
8be556
 #define PC_RHEL7_0_COMPAT \
8be556
+        PC_RHEL7_1_COMPAT,\
8be556
         {\
8be556
             .driver   = "virtio-scsi-pci",\
8be556
             .property = "any_layout",\