22c213
From 2ebaeca6e26950f401a8169d1324be2bafd11741 Mon Sep 17 00:00:00 2001
22c213
From: Miroslav Rezanina <mrezanin@redhat.com>
22c213
Date: Fri, 19 Oct 2018 13:10:31 +0200
22c213
Subject: Add x86_64 machine types
22c213
22c213
Adding changes to add RHEL machine types for x86_64 architecture.
22c213
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
22c213
Rebase changes (qemu-4.0.0):
22c213
- Use upstream compat handling
22c213
22c213
Rebase notes (3.1.0):
22c213
- Removed xsave changes
22c213
22c213
Rebase notes (4.1.0):
22c213
- Updated format for compat structures
22c213
22c213
Rebase notes (4.2.0-rc2):
22c213
- Use X86MachineClass for save_tsc_khz (upstream change)
22c213
22c213
Merged patches (4.1.0):
22c213
- f4dc802 pc: 7.5 compat entries
22c213
- 456ed3e pc: PC_RHEL7_6_COMPAT
22c213
- 04119ee pc: Add compat for pc-i440fx-rhel7.6.0 machine type
22c213
- b3b3687 pc: Add pc-q35-8.0.0 machine type
22c213
- 8d46fc6 pc: Add x-migrate-smi-count=off to PC_RHEL7_6_COMPAT
22c213
- 1de7949 kvm: clear out KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT for older machine types
22c213
- 18cf0d7 target/i386: Disable MPX support on named CPU models (partialy)
22c213
- 2660667 rhel: Set host-phys-bits-limit=48 on rhel machine-types
22c213
22c213
Merged patches (4.2.0):
22c213
- 7d5c2ef pc: Don't make die-id mandatory unless necessary
22c213
- e42808c x86 machine types: pc_rhel_8_0_compat
22c213
- 9de83a8 x86 machine types: q35: Fixup units_per_default_bus
22c213
- 6df1559 x86 machine types: Fixup dynamic sysbus entries
22c213
- 0784125 x86 machine types: add pc-q35-rhel8.1.0
22c213
- machines/x86: Add rhel 8.2 machine type (patch 92959)
22c213
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 hw/i386/acpi-build.c |   3 +
22c213
 hw/i386/pc.c         | 263 ++++++++++++++++++++++++++++++++++++++++++-
22c213
 hw/i386/pc_piix.c    | 210 +++++++++++++++++++++++++++++++++-
22c213
 hw/i386/pc_q35.c     | 156 ++++++++++++++++++++++++-
22c213
 include/hw/boards.h  |   2 +
22c213
 include/hw/i386/pc.h |  33 ++++++
22c213
 target/i386/cpu.c    |   9 +-
22c213
 target/i386/kvm.c    |   4 +
22c213
 8 files changed, 673 insertions(+), 7 deletions(-)
22c213
22c213
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
22c213
index 12ff55fcfb..64001893ab 100644
22c213
--- a/hw/i386/acpi-build.c
22c213
+++ b/hw/i386/acpi-build.c
22c213
@@ -204,6 +204,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
22c213
         pm->fadt.reset_reg = r;
22c213
         pm->fadt.reset_val = 0xf;
22c213
         pm->fadt.flags |= 1 << ACPI_FADT_F_RESET_REG_SUP;
22c213
+        if (object_property_get_bool(lpc,
22c213
+                                     "__com.redhat_force-rev1-fadt", NULL))
22c213
+            pm->fadt.rev = 1;
22c213
         pm->cpu_hp_io_base = ICH9_CPU_HOTPLUG_IO_BASE;
22c213
     }
22c213
 
22c213
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
22c213
index ac08e63604..61e70e4811 100644
22c213
--- a/hw/i386/pc.c
22c213
+++ b/hw/i386/pc.c
22c213
@@ -344,6 +344,261 @@ GlobalProperty pc_compat_1_4[] = {
22c213
 };
22c213
 const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4);
22c213
 
22c213
+/* This macro is for changes to properties that are RHEL specific,
22c213
+ * different to the current upstream and to be applied to the latest
22c213
+ * machine type.
22c213
+ */
22c213
+GlobalProperty pc_rhel_compat[] = {
22c213
+    { TYPE_X86_CPU, "host-phys-bits", "on" },
22c213
+    { TYPE_X86_CPU, "host-phys-bits-limit", "48" },
22c213
+    /* bz 1508330 */ 
22c213
+    { "vfio-pci", "x-no-geforce-quirks", "on" },
22c213
+};
22c213
+const size_t pc_rhel_compat_len = G_N_ELEMENTS(pc_rhel_compat);
22c213
+
22c213
+/* pc_rhel_8_1_compat is empty since pc_4_1_compat is */
22c213
+GlobalProperty pc_rhel_8_1_compat[] = { };
22c213
+const size_t pc_rhel_8_1_compat_len = G_N_ELEMENTS(pc_rhel_8_1_compat);
22c213
+
22c213
+GlobalProperty pc_rhel_8_0_compat[] = {
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "intel-iommu", "dma-drain", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G4" "-" TYPE_X86_CPU, "npt", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G4" "-" TYPE_X86_CPU, "nrip-save", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G5" "-" TYPE_X86_CPU, "npt", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Opteron_G5" "-" TYPE_X86_CPU, "nrip-save", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "EPYC" "-" TYPE_X86_CPU, "npt", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "EPYC" "-" TYPE_X86_CPU, "nrip-save", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "EPYC-IBPB" "-" TYPE_X86_CPU, "npt", "off" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "EPYC-IBPB" "-" TYPE_X86_CPU, "nrip-save", "off" },
22c213
+    /** The mpx=on entries from pc_compat_3_1 are in pc_rhel_7_6_compat **/
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { "Cascadelake-Server" "-" TYPE_X86_CPU, "stepping", "5" },
22c213
+    /* pc_rhel_8_0_compat from pc_compat_3_1 */
22c213
+    { TYPE_X86_CPU, "x-intel-pt-auto-level", "off" },
22c213
+};
22c213
+const size_t pc_rhel_8_0_compat_len = G_N_ELEMENTS(pc_rhel_8_0_compat);
22c213
+
22c213
+/* Similar to PC_COMPAT_3_0 + PC_COMPAT_2_12, but:
22c213
+ * all of the 2_12 stuff was already in 7.6 from bz 1481253
22c213
+ * x-migrate-smi-count comes from PC_COMPAT_2_11 but
22c213
+ * is really tied to kernel version so keep it off on 7.x
22c213
+ * machine types irrespective of host.
22c213
+ */
22c213
+GlobalProperty pc_rhel_7_6_compat[] = {
22c213
+    /* pc_rhel_7_6_compat from pc_compat_3_0 */ 
22c213
+    { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_3_0 */ 
22c213
+    { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_3_0 */ 
22c213
+    { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { TYPE_X86_CPU, "x-migrate-smi-count", "off" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Skylake-Client" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Skylake-Client-IBRS" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Skylake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Cascadelake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Icelake-Client" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+    /* pc_rhel_7_6_compat from pc_compat_2_11 */ 
22c213
+    { "Icelake-Server" "-" TYPE_X86_CPU, "mpx", "on" },
22c213
+};
22c213
+const size_t pc_rhel_7_6_compat_len = G_N_ELEMENTS(pc_rhel_7_6_compat);
22c213
+
22c213
+/* Similar to PC_COMPAT_2_11 + PC_COMPAT_2_10, but:
22c213
+ * - x-hv-max-vps was backported to 7.5
22c213
+ * - x-pci-hole64-fix was backported to 7.5
22c213
+ */
22c213
+GlobalProperty pc_rhel_7_5_compat[] = {
22c213
+    /* pc_rhel_7_5_compat from pc_compat_2_11 */  
22c213
+    { "Skylake-Server" "-" TYPE_X86_CPU, "clflushopt", "off" },
22c213
+    /* pc_rhel_7_5_compat from pc_compat_2_12 */  
22c213
+    { TYPE_X86_CPU, "legacy-cache", "on" },
22c213
+    /* pc_rhel_7_5_compat from pc_compat_2_12 */  
22c213
+    { TYPE_X86_CPU, "topoext", "off" },
22c213
+    /* pc_rhel_7_5_compat from pc_compat_2_12 */  
22c213
+    { "EPYC-" TYPE_X86_CPU, "xlevel", stringify(0x8000000a) },
22c213
+    /* pc_rhel_7_5_compat from pc_compat_2_12 */  
22c213
+    { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", stringify(0x8000000a) },
22c213
+};
22c213
+const size_t pc_rhel_7_5_compat_len = G_N_ELEMENTS(pc_rhel_7_5_compat);
22c213
+
22c213
+GlobalProperty pc_rhel_7_4_compat[] = {
22c213
+    /* pc_rhel_7_4_compat from pc_compat_2_9 */ 
22c213
+    { "mch", "extended-tseg-mbytes", stringify(0) },
22c213
+    /* bz 1489800 */ 
22c213
+    { "ICH9-LPC", "__com.redhat_force-rev1-fadt", "on" },
22c213
+    /* pc_rhel_7_4_compat from pc_compat_2_10 */ 
22c213
+    { "i440FX-pcihost", "x-pci-hole64-fix", "off" },
22c213
+    /* pc_rhel_7_4_compat from pc_compat_2_10 */ 
22c213
+    { "q35-pcihost", "x-pci-hole64-fix", "off" },
22c213
+    /* pc_rhel_7_4_compat from pc_compat_2_10 */ 
22c213
+    { TYPE_X86_CPU, "x-hv-max-vps", "0x40" },
22c213
+};
22c213
+const size_t pc_rhel_7_4_compat_len = G_N_ELEMENTS(pc_rhel_7_4_compat);
22c213
+
22c213
+GlobalProperty pc_rhel_7_3_compat[] = {
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_8 */ 
22c213
+    { "kvmclock", "x-mach-use-reliable-get-clock", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { TYPE_X86_CPU, "l3-cache", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { TYPE_X86_CPU, "full-cpuid-auto-level", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "family", "15" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "model", "6" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "stepping", "1" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_7 */ 
22c213
+    { "isa-pcspk", "migrate", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_6 */ 
22c213
+    { TYPE_X86_CPU, "cpuid-0xb", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_8 */ 
22c213
+    { "ICH9-LPC", "x-smi-broadcast", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_8 */ 
22c213
+    { TYPE_X86_CPU, "vmware-cpuid-freq", "off" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_8 */ 
22c213
+    { "Haswell-" TYPE_X86_CPU, "stepping", "1" },
22c213
+    /* pc_rhel_7_3_compat from pc_compat_2_3 added in 2.9*/ 
22c213
+    { TYPE_X86_CPU, "kvm-no-smi-migration", "on" },
22c213
+};
22c213
+const size_t pc_rhel_7_3_compat_len = G_N_ELEMENTS(pc_rhel_7_3_compat);
22c213
+
22c213
+GlobalProperty pc_rhel_7_2_compat[] = {
22c213
+    { "phenom" "-" TYPE_X86_CPU, "rdtscp", "off"},
22c213
+    { "qemu64" "-" TYPE_X86_CPU, "sse4a", "on" },
22c213
+    { "qemu64" "-" TYPE_X86_CPU, "abm", "on" },
22c213
+    { "Haswell-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Haswell-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Haswell-noTSX-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Haswell-noTSX-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Broadwell-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Broadwell-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Broadwell-noTSX-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "Broadwell-noTSX-IBRS" "-" TYPE_X86_CPU, "abm", "off" },
22c213
+    { "host" "-" TYPE_X86_CPU, "host-cache-info", "on" },
22c213
+    { TYPE_X86_CPU, "check", "off" },
22c213
+    { "qemu32" "-" TYPE_X86_CPU, "popcnt", "on" },
22c213
+    { TYPE_X86_CPU, "arat", "off" },
22c213
+    { "usb-redir", "streams", "off" },
22c213
+    { TYPE_X86_CPU, "fill-mtrr-mask", "off" },
22c213
+    { "apic-common", "legacy-instance-id", "on" },
22c213
+};
22c213
+const size_t pc_rhel_7_2_compat_len = G_N_ELEMENTS(pc_rhel_7_2_compat);
22c213
+
22c213
+GlobalProperty pc_rhel_7_1_compat[] = {
22c213
+    { "kvm64" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "kvm32" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Conroe" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Penryn" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Nehalem" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Nehalem-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Westmere" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Westmere-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "SandyBridge" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "SandyBridge-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Haswell" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Haswell-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Broadwell" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Broadwell-IBRS" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Opteron_G1" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Opteron_G2" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Opteron_G4" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Opteron_G5" "-" TYPE_X86_CPU, "vme", "off" },
22c213
+    { "Haswell" "-" TYPE_X86_CPU,  "f16c", "off" },
22c213
+    { "Haswell-IBRS" "-" TYPE_X86_CPU, "f16c", "off" },
22c213
+    { "Haswell" "-" TYPE_X86_CPU, "rdrand", "off" },
22c213
+    { "Haswell-IBRS" "-" TYPE_X86_CPU, "rdrand", "off" },
22c213
+    { "Broadwell" "-" TYPE_X86_CPU, "f16c", "off" },
22c213
+    { "Broadwell-IBRS" "-" TYPE_X86_CPU, "f16c", "off" },
22c213
+    { "Broadwell" "-" TYPE_X86_CPU, "rdrand", "off" },
22c213
+    { "Broadwell-IBRS" "-" TYPE_X86_CPU, "rdrand", "off" },
22c213
+    { "coreduo" "-" TYPE_X86_CPU, "vmx", "on" },
22c213
+    { "core2duo" "-" TYPE_X86_CPU, "vmx", "on" },
22c213
+    { "qemu64" "-" TYPE_X86_CPU, "min-level", stringify(4) },
22c213
+    { "kvm64" "-" TYPE_X86_CPU, "min-level", stringify(5) },
22c213
+    { "pentium3" "-" TYPE_X86_CPU, "min-level", stringify(2) },
22c213
+    { "n270" "-" TYPE_X86_CPU, "min-level", stringify(5) },
22c213
+    { "Conroe" "-" TYPE_X86_CPU, "min-level", stringify(4) },
22c213
+    { "Penryn" "-" TYPE_X86_CPU, "min-level", stringify(4) },
22c213
+    { "Nehalem" "-" TYPE_X86_CPU, "min-level", stringify(4) },
22c213
+    { "n270" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Penryn" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Conroe" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Nehalem" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Westmere" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "SandyBridge" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "IvyBridge" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Haswell" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Haswell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Broadwell" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+    { "Broadwell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", stringify(0x8000000a) },
22c213
+};
22c213
+const size_t pc_rhel_7_1_compat_len = G_N_ELEMENTS(pc_rhel_7_1_compat);
22c213
+
22c213
+/*
22c213
+ * The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine
22c213
+ * types as the PC_COMPAT_* do for upstream types.
22c213
+ * PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types.
22c213
+ */
22c213
+
22c213
+/*
22c213
+ * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_*
22c213
+ * between our base and 1.5, less stuff backported to RHEL-7.0
22c213
+ * (usb-device.msos-desc), less stuff for devices we changed
22c213
+ * (qemu64-x86_64-cpu) or don't support (hpet, pci-serial-2x,
22c213
+ * pci-serial-4x) in 7.0.
22c213
+ */
22c213
+GlobalProperty pc_rhel_7_0_compat[] = {
22c213
+    { "virtio-scsi-pci", "any_layout", "off" },
22c213
+    { "PIIX4_PM", "memory-hotplug-support", "off" },
22c213
+    { "apic", "version", stringify(0x11) },
22c213
+    { "nec-usb-xhci", "superspeed-ports-first", "off" },
22c213
+    { "nec-usb-xhci", "force-pcie-endcap", "on" },
22c213
+    { "pci-serial", "prog_if", stringify(0) },
22c213
+    { "virtio-net-pci", "guest_announce", "off" },
22c213
+    { "ICH9-LPC", "memory-hotplug-support", "off" },
22c213
+    { "xio3130-downstream", COMPAT_PROP_PCP, "off" },
22c213
+    { "ioh3420", COMPAT_PROP_PCP, "off" },
22c213
+    { "PIIX4_PM", "acpi-pci-hotplug-with-bridge-support", "off" },
22c213
+    { "e1000", "mitigation", "off" },
22c213
+    { "virtio-net-pci", "ctrl_guest_offloads", "off" },
22c213
+    { "Conroe" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Penryn" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Nehalem" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Nehalem-IBRS" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Westmere" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Westmere-IBRS" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Opteron_G1" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Opteron_G2" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Opteron_G3" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Opteron_G4" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+    { "Opteron_G5" "-" TYPE_X86_CPU, "x2apic", "on" },
22c213
+};
22c213
+const size_t pc_rhel_7_0_compat_len = G_N_ELEMENTS(pc_rhel_7_0_compat);
22c213
+
22c213
 void gsi_handler(void *opaque, int n, int level)
22c213
 {
22c213
     GSIState *s = opaque;
22c213
@@ -1225,7 +1480,8 @@ void pc_memory_init(PCMachineState *pcms,
22c213
     option_rom_mr = g_malloc(sizeof(*option_rom_mr));
22c213
     memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
22c213
                            &error_fatal);
22c213
-    if (pcmc->pci_enabled) {
22c213
+    /* RH difference: See bz 1489800, explicitly make ROM ro */
22c213
+    if (pcmc->pc_rom_ro) {
22c213
         memory_region_set_readonly(option_rom_mr, true);
22c213
     }
22c213
     memory_region_add_subregion_overlap(rom_memory,
22c213
@@ -2198,6 +2454,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
22c213
     pcmc->linuxboot_dma_enabled = true;
22c213
     pcmc->pvh_enabled = true;
22c213
     assert(!mc->get_hotplug_handler);
22c213
+    pcmc->pc_rom_ro = true;
22c213
+    mc->async_pf_vmexit_disable = false;
22c213
     mc->get_hotplug_handler = pc_get_hotplug_handler;
22c213
     mc->hotplug_allowed = pc_hotplug_allowed;
22c213
     mc->cpu_index_to_instance_props = x86_cpu_index_to_props;
22c213
@@ -2209,7 +2467,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
22c213
     mc->hot_add_cpu = pc_hot_add_cpu;
22c213
     mc->smp_parse = pc_smp_parse;
22c213
     mc->block_default_type = IF_IDE;
22c213
-    mc->max_cpus = 255;
22c213
+    /* 240: max CPU count for RHEL */
22c213
+    mc->max_cpus = 240;
22c213
     mc->reset = pc_machine_reset;
22c213
     mc->wakeup = pc_machine_wakeup;
22c213
     hc->pre_plug = pc_machine_device_pre_plug_cb;
22c213
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
22c213
index 1bd70d1abb..bd7fdb99bb 100644
22c213
--- a/hw/i386/pc_piix.c
22c213
+++ b/hw/i386/pc_piix.c
22c213
@@ -53,6 +53,7 @@
22c213
 #include "cpu.h"
22c213
 #include "qapi/error.h"
22c213
 #include "qemu/error-report.h"
22c213
+#include "migration/migration.h"
22c213
 #ifdef CONFIG_XEN
22c213
 #include <xen/hvm/hvm_info_table.h>
22c213
 #include "hw/xen/xen_pt.h"
22c213
@@ -173,8 +174,8 @@ static void pc_init1(MachineState *machine,
22c213
     if (pcmc->smbios_defaults) {
22c213
         MachineClass *mc = MACHINE_GET_CLASS(machine);
22c213
         /* These values are guest ABI, do not change */
22c213
-        smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
22c213
-                            mc->name, pcmc->smbios_legacy_mode,
22c213
+        smbios_set_defaults("Red Hat", "KVM",
22c213
+                            mc->desc, pcmc->smbios_legacy_mode,
22c213
                             pcmc->smbios_uuid_encoded,
22c213
                             SMBIOS_ENTRY_POINT_21);
22c213
     }
22c213
@@ -307,6 +308,7 @@ else {
22c213
  * hw_compat_*, pc_compat_*, or * pc_*_machine_options().
22c213
  */
22c213
 
22c213
+#if 0 /* Disabled for Red Hat Enterprise Linux */
22c213
 static void pc_compat_2_3_fn(MachineState *machine)
22c213
 {
22c213
     PCMachineState *pcms = PC_MACHINE(machine);
22c213
@@ -1026,3 +1028,207 @@ static void xenfv_machine_options(MachineClass *m)
22c213
 DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
22c213
                   xenfv_machine_options);
22c213
 #endif
22c213
+#endif  /* Disabled for Red Hat Enterprise Linux */
22c213
+
22c213
+/* Red Hat Enterprise Linux machine types */
22c213
+
22c213
+/* Options for the latest rhel7 machine type */
22c213
+static void pc_machine_rhel7_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    m->family = "pc_piix_Y";
22c213
+    m->default_machine_opts = "firmware=bios-256k.bin";
22c213
+    pcmc->default_nic_model = "e1000";
22c213
+    m->default_display = "std";
22c213
+    m->no_parallel = 1;
22c213
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
22c213
+    compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
22c213
+    m->alias = "pc";
22c213
+    m->is_default = 1;
22c213
+}
22c213
+
22c213
+static void pc_init_rhel760(MachineState *machine)
22c213
+{
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel760_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_machine_rhel7_options(m);
22c213
+    m->desc = "RHEL 7.6.0 PC (i440FX + PIIX, 1996)";
22c213
+    m->async_pf_vmexit_disable = true;
22c213
+    m->smbus_no_migration_support = true;
22c213
+    pcmc->pvh_enabled = false;
22c213
+    pcmc->default_cpu_version = CPU_VERSION_LEGACY;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len);
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len);
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel760, "pc-i440fx-rhel7.6.0", pc_init_rhel760,
22c213
+                  pc_machine_rhel760_options);
22c213
+
22c213
+static void pc_init_rhel750(MachineState *machine)
22c213
+{
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel750_options(MachineClass *m)
22c213
+{
22c213
+    pc_machine_rhel760_options(m);
22c213
+    m->alias = NULL;
22c213
+    m->is_default = 0;
22c213
+    m->desc = "RHEL 7.5.0 PC (i440FX + PIIX, 1996)";
22c213
+    m->auto_enable_numa_with_memhp = false;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_5_compat, pc_rhel_7_5_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel750, "pc-i440fx-rhel7.5.0", pc_init_rhel750,
22c213
+                  pc_machine_rhel750_options);
22c213
+
22c213
+static void pc_init_rhel740(MachineState *machine)
22c213
+{
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel740_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_machine_rhel750_options(m);
22c213
+    m->desc = "RHEL 7.4.0 PC (i440FX + PIIX, 1996)";
22c213
+    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
22c213
+    pcmc->pc_rom_ro = false;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_4_compat, pc_rhel_7_4_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel740, "pc-i440fx-rhel7.4.0", pc_init_rhel740,
22c213
+                  pc_machine_rhel740_options);
22c213
+
22c213
+static void pc_init_rhel730(MachineState *machine)
22c213
+{
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel730_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_machine_rhel740_options(m);
22c213
+    m->desc = "RHEL 7.3.0 PC (i440FX + PIIX, 1996)";
22c213
+    pcmc->linuxboot_dma_enabled = false;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_3_compat, pc_rhel_7_3_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel730, "pc-i440fx-rhel7.3.0", pc_init_rhel730,
22c213
+                  pc_machine_rhel730_options);
22c213
+
22c213
+
22c213
+static void pc_init_rhel720(MachineState *machine)
22c213
+{
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel720_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
22c213
+    pc_machine_rhel730_options(m);
22c213
+    m->desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)";
22c213
+    /* From pc_i440fx_2_5_machine_options */
22c213
+    x86mc->save_tsc_khz = false;
22c213
+    m->legacy_fw_cfg_order = 1;
22c213
+    /* Note: broken_reserved_end was already in 7.2 */
22c213
+    /* From pc_i440fx_2_6_machine_options */
22c213
+    pcmc->legacy_cpu_hotplug = true;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_2, hw_compat_rhel_7_2_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_2_compat, pc_rhel_7_2_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel720, "pc-i440fx-rhel7.2.0", pc_init_rhel720,
22c213
+                  pc_machine_rhel720_options);
22c213
+
22c213
+static void pc_compat_rhel710(MachineState *machine)
22c213
+{
22c213
+    PCMachineState *pcms = PC_MACHINE(machine);
22c213
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
22c213
+
22c213
+    /* From pc_compat_2_2 */
22c213
+    pcmc->rsdp_in_ram = false;
22c213
+    machine->suppress_vmdesc = true;
22c213
+
22c213
+    /* From pc_compat_2_1 */
22c213
+    pcmc->smbios_uuid_encoded = false;
22c213
+    x86_cpu_change_kvm_default("svm", NULL);
22c213
+    pcmc->enforce_aligned_dimm = false;
22c213
+
22c213
+    /* Disable all the extra subsections that were added in 2.2 */
22c213
+    migrate_pre_2_2 = true;
22c213
+
22c213
+    /* From pc_i440fx_2_4_machine_options */
22c213
+    pcmc->broken_reserved_end = true;
22c213
+}
22c213
+
22c213
+static void pc_init_rhel710(MachineState *machine)
22c213
+{
22c213
+    pc_compat_rhel710(machine);
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel710_options(MachineClass *m)
22c213
+{
22c213
+    pc_machine_rhel720_options(m);
22c213
+    m->family = "pc_piix_Y";
22c213
+    m->desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)";
22c213
+    m->default_display = "cirrus";
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_1, hw_compat_rhel_7_1_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_1_compat, pc_rhel_7_1_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel710, "pc-i440fx-rhel7.1.0", pc_init_rhel710,
22c213
+                  pc_machine_rhel710_options);
22c213
+
22c213
+static void pc_compat_rhel700(MachineState *machine)
22c213
+{
22c213
+    PCMachineState *pcms = PC_MACHINE(machine);
22c213
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
22c213
+
22c213
+    pc_compat_rhel710(machine);
22c213
+
22c213
+    /* Upstream enables it for everyone, we're a little more selective */
22c213
+    x86_cpu_change_kvm_default("x2apic", NULL);
22c213
+    x86_cpu_change_kvm_default("svm", NULL);
22c213
+    pcmc->legacy_acpi_table_size = 6418; /* see pc_compat_2_0() */
22c213
+    pcmc->smbios_legacy_mode = true;
22c213
+    pcmc->has_reserved_memory = false;
22c213
+    migrate_cve_2014_5263_xhci_fields = true;
22c213
+}
22c213
+
22c213
+static void pc_init_rhel700(MachineState *machine)
22c213
+{
22c213
+    pc_compat_rhel700(machine);
22c213
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
22c213
+             TYPE_I440FX_PCI_DEVICE);
22c213
+}
22c213
+
22c213
+static void pc_machine_rhel700_options(MachineClass *m)
22c213
+{
22c213
+    pc_machine_rhel710_options(m);
22c213
+    m->family = "pc_piix_Y";
22c213
+    m->desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)";
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_0_compat, pc_rhel_7_0_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(rhel700, "pc-i440fx-rhel7.0.0", pc_init_rhel700,
22c213
+                  pc_machine_rhel700_options);
22c213
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
22c213
index 385e5cffb1..7531d8ed76 100644
22c213
--- a/hw/i386/pc_q35.c
22c213
+++ b/hw/i386/pc_q35.c
22c213
@@ -197,8 +197,8 @@ static void pc_q35_init(MachineState *machine)
22c213
 
22c213
     if (pcmc->smbios_defaults) {
22c213
         /* These values are guest ABI, do not change */
22c213
-        smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
22c213
-                            mc->name, pcmc->smbios_legacy_mode,
22c213
+        smbios_set_defaults("Red Hat", "KVM",
22c213
+                            mc->desc, pcmc->smbios_legacy_mode,
22c213
                             pcmc->smbios_uuid_encoded,
22c213
                             SMBIOS_ENTRY_POINT_21);
22c213
     }
22c213
@@ -330,6 +330,7 @@ static void pc_q35_init(MachineState *machine)
22c213
     DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
22c213
 
22c213
 
22c213
+#if 0 /* Disabled for Red Hat Enterprise Linux */
22c213
 static void pc_q35_machine_options(MachineClass *m)
22c213
 {
22c213
     PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
@@ -533,3 +534,154 @@ static void pc_q35_2_4_machine_options(MachineClass *m)
22c213
 
22c213
 DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
22c213
                    pc_q35_2_4_machine_options);
22c213
+#endif  /* Disabled for Red Hat Enterprise Linux */
22c213
+
22c213
+/* Red Hat Enterprise Linux machine types */
22c213
+
22c213
+/* Options for the latest rhel q35 machine type */
22c213
+static void pc_q35_machine_rhel_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pcmc->default_nic_model = "e1000e";
22c213
+    m->family = "pc_q35_Z";
22c213
+    m->units_per_default_bus = 1;
22c213
+    m->default_machine_opts = "firmware=bios-256k.bin";
22c213
+    m->default_display = "std";
22c213
+    m->no_floppy = 1;
22c213
+    m->no_parallel = 1;
22c213
+    pcmc->default_cpu_version = 1;
22c213
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
22c213
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
22c213
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
22c213
+    m->alias = "q35";
22c213
+    m->max_cpus = 384;
22c213
+    compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
22c213
+}
22c213
+
22c213
+static void pc_q35_init_rhel820(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel820_options(MachineClass *m)
22c213
+{
22c213
+    pc_q35_machine_rhel_options(m);
22c213
+    m->desc = "RHEL-8.2.0 PC (Q35 + ICH9, 2009)";
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel820, "pc-q35-rhel8.2.0", pc_q35_init_rhel820,
22c213
+                  pc_q35_machine_rhel820_options);
22c213
+
22c213
+static void pc_q35_init_rhel810(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel810_options(MachineClass *m)
22c213
+{
22c213
+    pc_q35_machine_rhel820_options(m);
22c213
+    m->desc = "RHEL-8.1.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->alias = NULL;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_8_1_compat, pc_rhel_8_1_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel810, "pc-q35-rhel8.1.0", pc_q35_init_rhel810,
22c213
+                  pc_q35_machine_rhel810_options);
22c213
+
22c213
+static void pc_q35_init_rhel800(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel800_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_q35_machine_rhel810_options(m);
22c213
+    m->desc = "RHEL-8.0.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->smbus_no_migration_support = true;
22c213
+    m->alias = NULL;
22c213
+    pcmc->pvh_enabled = false;
22c213
+    pcmc->default_cpu_version = CPU_VERSION_LEGACY;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_8_0_compat, pc_rhel_8_0_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel800, "pc-q35-rhel8.0.0", pc_q35_init_rhel800,
22c213
+                  pc_q35_machine_rhel800_options);
22c213
+
22c213
+static void pc_q35_init_rhel760(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel760_options(MachineClass *m)
22c213
+{
22c213
+    pc_q35_machine_rhel800_options(m);
22c213
+    m->alias = NULL;
22c213
+    m->desc = "RHEL-7.6.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->async_pf_vmexit_disable = true;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_6_compat, pc_rhel_7_6_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel760, "pc-q35-rhel7.6.0", pc_q35_init_rhel760,
22c213
+                  pc_q35_machine_rhel760_options);
22c213
+
22c213
+static void pc_q35_init_rhel750(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel750_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_q35_machine_rhel760_options(m);
22c213
+    m->alias = NULL;
22c213
+    m->desc = "RHEL-7.5.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->auto_enable_numa_with_memhp = false;
22c213
+    pcmc->default_nic_model = "e1000";
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_5_compat, pc_rhel_7_5_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel750, "pc-q35-rhel7.5.0", pc_q35_init_rhel750,
22c213
+                  pc_q35_machine_rhel750_options);
22c213
+
22c213
+static void pc_q35_init_rhel740(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel740_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_q35_machine_rhel750_options(m);
22c213
+    m->desc = "RHEL-7.4.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
22c213
+    pcmc->pc_rom_ro = false;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_4_compat, pc_rhel_7_4_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel740, "pc-q35-rhel7.4.0", pc_q35_init_rhel740,
22c213
+                  pc_q35_machine_rhel740_options);
22c213
+
22c213
+static void pc_q35_init_rhel730(MachineState *machine)
22c213
+{
22c213
+    pc_q35_init(machine);
22c213
+}
22c213
+
22c213
+static void pc_q35_machine_rhel730_options(MachineClass *m)
22c213
+{
22c213
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
22c213
+    pc_q35_machine_rhel740_options(m);
22c213
+    m->desc = "RHEL-7.3.0 PC (Q35 + ICH9, 2009)";
22c213
+    m->max_cpus = 255;
22c213
+    pcmc->linuxboot_dma_enabled = false;
22c213
+    compat_props_add(m->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
22c213
+    compat_props_add(m->compat_props, pc_rhel_7_3_compat, pc_rhel_7_3_compat_len);
22c213
+}
22c213
+
22c213
+DEFINE_PC_MACHINE(q35_rhel730, "pc-q35-rhel7.3.0", pc_q35_init_rhel730,
22c213
+                  pc_q35_machine_rhel730_options);
22c213
diff --git a/include/hw/boards.h b/include/hw/boards.h
22c213
index 6f85a0e032..2920bdef5b 100644
22c213
--- a/include/hw/boards.h
22c213
+++ b/include/hw/boards.h
22c213
@@ -222,6 +222,8 @@ struct MachineClass {
22c213
     const char **valid_cpu_types;
22c213
     strList *allowed_dynamic_sysbus_devices;
22c213
     bool auto_enable_numa_with_memhp;
22c213
+    /* RHEL only */
22c213
+    bool async_pf_vmexit_disable;
22c213
     void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
22c213
                                  int nb_nodes, ram_addr_t size);
22c213
     bool ignore_boot_device_suffixes;
22c213
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
22c213
index 1f86eba3f9..2e362c8faa 100644
22c213
--- a/include/hw/i386/pc.h
22c213
+++ b/include/hw/i386/pc.h
22c213
@@ -124,6 +124,9 @@ typedef struct PCMachineClass {
22c213
 
22c213
     /* use PVH to load kernels that support this feature */
22c213
     bool pvh_enabled;
22c213
+   
22c213
+    /* RH only, see bz 1489800 */
22c213
+    bool pc_rom_ro;
22c213
 } PCMachineClass;
22c213
 
22c213
 #define TYPE_PC_MACHINE "generic-pc-machine"
22c213
@@ -300,6 +303,36 @@ extern const size_t pc_compat_1_5_len;
22c213
 extern GlobalProperty pc_compat_1_4[];
22c213
 extern const size_t pc_compat_1_4_len;
22c213
 
22c213
+extern GlobalProperty pc_rhel_compat[];
22c213
+extern const size_t pc_rhel_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_8_1_compat[];
22c213
+extern const size_t pc_rhel_8_1_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_8_0_compat[];
22c213
+extern const size_t pc_rhel_8_0_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_6_compat[];
22c213
+extern const size_t pc_rhel_7_6_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_5_compat[];
22c213
+extern const size_t pc_rhel_7_5_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_4_compat[];
22c213
+extern const size_t pc_rhel_7_4_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_3_compat[];
22c213
+extern const size_t pc_rhel_7_3_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_2_compat[];
22c213
+extern const size_t pc_rhel_7_2_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_1_compat[];
22c213
+extern const size_t pc_rhel_7_1_compat_len;
22c213
+
22c213
+extern GlobalProperty pc_rhel_7_0_compat[];
22c213
+extern const size_t pc_rhel_7_0_compat_len;
22c213
+
22c213
 /* Helper for setting model-id for CPU models that changed model-id
22c213
  * depending on QEMU versions up to QEMU 2.4.
22c213
  */
22c213
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
22c213
index 1b7880ae3a..790db778ab 100644
22c213
--- a/target/i386/cpu.c
22c213
+++ b/target/i386/cpu.c
22c213
@@ -1829,11 +1829,17 @@ static CPUCaches epyc_cache_info = {
22c213
 
22c213
 static X86CPUDefinition builtin_x86_defs[] = {
22c213
     {
22c213
+        /* qemu64 is the default CPU model for all *-rhel7.* machine-types.
22c213
+         * The default on RHEL-6 was cpu64-rhel6.
22c213
+         * libvirt assumes that qemu64 is the default for _all_ machine-types,
22c213
+         * so we should try to keep qemu64 and cpu64-rhel6 as similar as
22c213
+         * possible.
22c213
+         */
22c213
         .name = "qemu64",
22c213
         .level = 0xd,
22c213
         .vendor = CPUID_VENDOR_AMD,
22c213
         .family = 6,
22c213
-        .model = 6,
22c213
+        .model = 13,
22c213
         .stepping = 3,
22c213
         .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
22c213
             CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
22c213
@@ -3932,6 +3938,7 @@ static PropValue kvm_default_props[] = {
22c213
     { "acpi", "off" },
22c213
     { "monitor", "off" },
22c213
     { "svm", "off" },
22c213
+    { "kvm-pv-unhalt", "on" },
22c213
     { NULL, NULL },
22c213
 };
22c213
 
22c213
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
22c213
index 1d10046a6c..86d9a1f364 100644
22c213
--- a/target/i386/kvm.c
22c213
+++ b/target/i386/kvm.c
22c213
@@ -3079,6 +3079,7 @@ static int kvm_get_msrs(X86CPU *cpu)
22c213
     struct kvm_msr_entry *msrs = cpu->kvm_msr_buf->entries;
22c213
     int ret, i;
22c213
     uint64_t mtrr_top_bits;
22c213
+    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
22c213
 
22c213
     kvm_msr_buf_reset(cpu);
22c213
 
22c213
@@ -3388,6 +3389,9 @@ static int kvm_get_msrs(X86CPU *cpu)
22c213
             break;
22c213
         case MSR_KVM_ASYNC_PF_EN:
22c213
             env->async_pf_en_msr = msrs[i].data;
22c213
+            if (mc->async_pf_vmexit_disable) {
22c213
+                env->async_pf_en_msr &= ~(1ULL << 2);
22c213
+            }
22c213
             break;
22c213
         case MSR_KVM_PV_EOI_EN:
22c213
             env->pv_eoi_en_msr = msrs[i].data;
22c213
-- 
22c213
2.21.0
22c213