Blame SOURCES/0005-Add-RHEL-7-machine-types.patch

1bdc94
From 84733200df4772cf20a4e9f7e5669b87ef5ab4c0 Mon Sep 17 00:00:00 2001
4a2fec
From: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
Date: Sun, 14 Dec 2014 18:32:18 +0100
4a2fec
Subject: Add RHEL 7 machine types
4a2fec
4a2fec
This commit adds all changes related to machine types applied in
4a2fec
qemu-kvm-rhev-2.1.2-16.el7.
4a2fec
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
Conflicts (on 2.3 rebase):
4a2fec
	default-configs/ppc64-softmmu.mak
4a2fec
	hw/arm/Makefile.objs
4a2fec
	hw/i386/pc_piix.c
4a2fec
	hw/i386/pc_q35.c
4a2fec
	hw/ppc/spapr.c
4a2fec
	savevm.c - has to change shadow_bios tail to rcu list handling
4a2fec
	target-i386/machine.c - use xmm instead of ymmh register
4a2fec
4a2fec
--
1bdc94
1bdc94
Rebase notes (2.12.0):
1bdc94
- replace has_dynamic_sysbus with list of dynamic devices (upstream)
1bdc94
- Changed force_rev1_fadt handling
1bdc94
- Added default nic to machine options for pc_piix and pc_q35
1bdc94
- Disabled m48t59-test for ppc64
1bdc94
- Disabled unsupported machine types in boot-serial-test
1bdc94
- Disabled pseries-rhel7.2.0 machine type for cpu-plug-test
1bdc94
1bdc94
Rebase notes (2.11.0):
1bdc94
- Return type for VMStateDescription.pre_save changed (upstream)
1bdc94
- Use default_cpu_type instead of tcg_default_cpu for sPAPRMachineClass
1bdc94
- Use virt_get_default_cpu_node_id in arm rhel machine type
1bdc94
- Set default_cpu_type to cortex-a57
1bdc94
- Disable options for arm boards instead of object file remove
1bdc94
- Changed order with device disable commit - removed unnecessary changes
1bdc94
4a2fec
Rebase notes (2.10.0):
4a2fec
- Commented out new unused functions in hw/arm/virt.c
4a2fec
- savevm_skip_section_footers changed to COMPAT variable (upstream)
4a2fec
- global_state_set_optional changed to COMPAT variable (upstream)
4a2fec
- savevm_skip_configuration changed to COMPAT variable (upstream)
4a2fec
- move shadow_bios() to separate module with stub version available
4a2fec
- set possible_cpu_arch_ids and cpu_index_to_instance_props fields for arm machine type
4a2fec
- Re-enable older machine types for ppc64
4a2fec
- Commented 7.2 rebase error for compat qemu-extended-regs
4a2fec
4a2fec
Rebase notes (2.9.0):
4a2fec
- new header file for arm (upstream)
4a2fec
- query_hotpluggable_cpus renamed to has_hotpluggable_cpus (upstream)
4a2fec
- replace MAX_CPUMASK_BITS with max_cpus
4a2fec
- Adding rhel6-e1000.rom moved to Initial redhat commit
4a2fec
- Fixed conflict on cirrus_vga.c
4a2fec
4a2fec
Rebase notes (2.8.0):
4a2fec
- new "m->max_cpus = 288" in pc_q35_machine_options hw/i386/pc_q35.c
4a2fec
4a2fec
Rebase notes (2.7.0):
4a2fec
- Additional fsl-imx6.o sabrelito.o files in arm hw dir
4a2fec
4a2fec
Rebase notes (2.6.0):
4a2fec
- Changes in handling of some compat properties
4a2fec
- Fixes in x86_64 copmat models
4a2fec
- Added required devices for aarch64
4a2fec
- Fixes for ppc machine types
4a2fec
4a2fec
Rebase notes (2.5.0):
4a2fec
- changed cpu defaults structure
4a2fec
- chnaged cpu compat properties handling
4a2fec
- added fix for arm machine type
4a2fec
4a2fec
Rebase notes (2.4.0)
4a2fec
- Moved needed attribute (due to 5cd8cadae8db905afcbf877cae568c27d1d55a8a)
4a2fec
- Fixes to machine types changes
4a2fec
1bdc94
Merged patches (2.12.0):
1bdc94
- 402de2c redhat: Define the pseries-rhel7.5-sxxm machine type
1bdc94
- a232ba5 redhat: Define the pseries-rhel7.4-sxxm machine type
1bdc94
- 54f90c2 redhat: Define the pseries-rhel7.3-sxxm machine type
1bdc94
- 3fe3c44 Disable GeForce quirks in vfio-pci for RHEL machines
1bdc94
- 4780659 target-i386: cpu: add new CPU models for indirect branch predictor restrictions
1bdc94
- d486f00 hw/ppc/spapr_caps: Rework spapr_caps to use uint8 internal representation
1bdc94
- cc06449 spapr: Handle Decimal Floating Point (DFP) as an optional capability
1bdc94
- 64ef8ed spapr: Handle VMX/VSX presence as an spapr capability flag
1bdc94
- acad5a1 spapr: Treat Hardware Transactional Memory (HTM) as an optional capability
1bdc94
1bdc94
Merged patches (2.11.0):
1bdc94
- 58702e8dbb redhat: fix HW_COMPAT_RHEL7_3
1bdc94
- ea157600da redhat: define HW_COMPAT_RHEL7_4
1bdc94
- 86ef5cd189 redhat: define pseries-rhel7.5.0 machine type
1bdc94
- d8bf28e9ec qemu-kvm-ma: define only pseries-rhel7.5.0 machine type for -ma
1bdc94
- 9b07271835 Create x86 7.5.0 machine types
1bdc94
- e63d707db9 acpi: Force rev1 FADT on old q35 machine types
1bdc94
- c091cd7a1b pc: make pc_rom RO only on new machine types
1bdc94
- 082bd3ba3d arm/virt: Add RHEL 7.5 machine typei
1bdc94
- 8663586f2b qemu-kvm-rhev: only allows pseries-rhel7.5.0 machine type with POWER9 guest
1bdc94
- 229441f111 machine compat: pci_bridge/shpc always enable
1bdc94
- 917c9e7df7 pcie_root_port: Fix x-migrate-msix compat
1bdc94
- b0c0614041 q35: Fix mismerge
1bdc94
- 888e98c6d6 hw/pci-host: Fix x86 Host Bridges 64bit PCI hole (partial)
1bdc94
- b2f9f4fcaa i386/cpu/hyperv: support over 64 vcpus for windows guests (partial)
1bdc94
- cc306393d7 migcompat/e1000e: Work around 7.3 msi/intr_state field
1bdc94
- c4753f76a3 migcompat/rtl8139: Work around version bump
1bdc94
- 1ece5bfd00 RHEL: Add RHEL7 machine type for qemu on s390x
1bdc94
4a2fec
Merged patches (2.10.0)
4a2fec
- 5090ba1 Fix qemu-kvm does not quit when booting guest w/ 241 vcpus and "-no-kvm"
4a2fec
- 3c52050 x86: bump maximum vcpu count of pc-q35-rhel7.4.0 to 288
4a2fec
- 0ed92ca x86: Work around SMI breakages
4a2fec
- f7b5a7f spapr: update SPAPR_COMPAT_RHEL7_3
4a2fec
- 04faf4d migration: update HW_COMPAT_RHEL7_3
4a2fec
- 9982768 x86: bump maximum vcpu count of pc-q35-rhel7.4.0 to 384
4a2fec
- f5095ba re-enable DMA for 7.3 machine type
4a2fec
- d6ec65d x86 machine compat: 2.9 stragglers
4a2fec
- eda659a disable linuxboot_dma.bin option rom for 7.3 machine types
4a2fec
- 8c122a5 Revert "hw/pci: disable pci-bridge's shpc by default" (partial)
4a2fec
- 627adfa virtio_net: Bypass backends for MTU feature negotiation (partial)
4a2fec
- b430787 pc: Use "min[x]level" on compat_props on RHEL machine-types
4a2fec
- 8c3f45a AArch64: remove mach-virt-7.3 machine type
4a2fec
- d5df1ef Downstream: Update pseries machine types for RHEL-ALT-7.4
4a2fec
4a2fec
Merged patches (2.9.0)
4a2fec
- 8475d69 hw/arm/virt: Disable virtio-net-pci option ROM file loading
4a2fec
- 73fe1f6 Workaround rhel6 ctrl_guest_offloads machine type mismatch
4a2fec
- 21d32ca pc_piix: fix compat props typo for RHEL6 machine types
4a2fec
- 55a5002 compat: define HW_COMPAT_RHEL7_3
4a2fec
- 1b8e927 spapr: define pseries-rhel7.4.0 machine type
4a2fec
- cdb76ec hw/arm/virt: remove aarch64 rhel machine type
4a2fec
- 7dfa88b hw/arm/virt: create virt-rhel7.3.0 machine type
4a2fec
- 6894f91 hw/arm/virt: create virt-rhel7.4.0 machine type
4a2fec
- a9d2d39 x86: Split out options for the head rhel7 machine types
4a2fec
- fdafbdc x86: Create PC_RHEL7_3_COMPAT definition
4a2fec
- 3427c72 x86: Define pc-i440fx-rhel7.4.0
4a2fec
- aea20ab x86: Define pc-q35-rhel7.4.0
4a2fec
- 0185c0f x86: Remove downstream opteron rdtscp override
4a2fec
- 6b51073 fix abort in acpi_setup() since 2.8 with rhel6 machine types
4a2fec
- 954fc0d intel-hda: fix rhel6 compat property
4a2fec
- 1b57274 kvmclock: reduce kvmclock difference on migration (rhel only part)
4a2fec
4a2fec
Merged patches (2.8.0)
4a2fec
- a1da2f0 virtio-pci: reduce modern_mem_bar size (rhel only part)
4a2fec
4a2fec
Merged patches (2.7.0):
4a2fec
- fe9d1cf pc: Use right HW_COMPAT_* macros at PC_RHEL7* compat macros
4a2fec
- 3938189 compat: Add missing "any_layout" in HW_COMPAT_RHEL7_1
4a2fec
- 6dffc9d spapr: update RHEL-7.2 machine type
4a2fec
- c5d5910 migration: fix HW_COMPAT_RHEL7_2
4a2fec
- 2da9bb8 pc: New (default) pc-i440fx-rhel7.3.0 machine-type
4a2fec
- 0520d7e 7.3 mismerge fix: Fix ich9-intel-hda compatibility
4a2fec
- 89528b3 PC migration compat: Section footers/global state
4a2fec
- 2231e35 fw_cfg for 7.2 compatibility
4a2fec
- b8a3ade pc: Create new pc-q35-rhel7.3.0 machine-type
4a2fec
- 340929b q35: Remove 7.0, 7.1, 7.2 machine types
4a2fec
- bb7fc95 machine types: fix pc_machine_*_options chain
4a2fec
- d9fa9aa Fix rhel6 rom file
4a2fec
- dc39363 fix vga type for older machines
4a2fec
- 255a2d1 7.2 machine type compatibility
4a2fec
- 16c3d25 target-i386: Remove SSE4a from qemu64 CPU model (rhel only part)
4a2fec
- 76a1796 target-i386: Remove ABM from qemu64 CPU model (rhel only part)
4a2fec
- a9f8773 pc: Recover PC_RHEL7_1_COMPAT from RHEL-7.2 code
4a2fec
- 7a6ed67 pc: Include missing PC_COMPAT_2_3 entries in PC_RHEL7_2_COMPAT
4a2fec
- 07428f6 Revert "static checker: e1000-82540em got aliased to e1000"
4a2fec
- 446cf1f Revert "e1000: use alias for default model"
4a2fec
- 615096e 7.x compat: e1000-82540em
4a2fec
- 0855905 hw/arm/virt: kill 7.2 machine type
4a2fec
- 18bbea2 usbredir: turn off streams for rhel7.2 & older
4a2fec
- 910cf4a target-i386: Fill high bits of mtrr mask (rhel only part)
4a2fec
- 0e8ab1b target-i386: Enable host-phys-bits on RHEL
4a2fec
- 8c5f8a5 pc: Fix rhel6.3.0 compat_props setting
4a2fec
- 8f869f1 pc: use new CPU hotplug interface since 2.7 machine type (rhel only part)
4a2fec
- d9d646f machine: add properties to compat_props incrementaly (rhel only part)
4a2fec
- acb18fd apic: Use apic_id as apic's migration instance_id (rhel only part)
4a2fec
- c7e37d4 apic: fix broken migration for kvm-apic (rhel only part)
4a2fec
- eca64aee hw/virtio-pci: fix virtio behaviour
4a2fec
- c56b8F6e pc-rhel-7.2: pcie: fix link active status bit migration
4a2fec
- 5522aa3 q35-rhel: allow dynamic sysbus
4a2fec
4a2fec
Merged patches (2.6.0):
4a2fec
- f915d7f arm: virt: Add an abstract RHEL ARM virt machine type
4a2fec
- deffcc0 arm: virt: Add RHEL 7.3.0 virt machine type
4a2fec
- 04ca07d arm: virt: Consolidate the naming of RHEL virt machine types
4a2fec
- 2856ce2 Define HW_COMPAT_RHEL7_2
4a2fec
- 1869242 spapr: move pseries-2.5 machine to RHEL disabled machine zone
4a2fec
- cc59ce7 spapr: add RHEL-7.3 machine type
4a2fec
- 98549c5 pc: Fix property names on CPU compat code
4a2fec
- caa47bb Fix ich9-intel-hda compatibility
4a2fec
4a2fec
Merged patches (2.3.0):
4a2fec
- bb4e53c2 pc: add rhel6.6.0 machine type
4a2fec
- 129a2b3 Downstream-only: Restore "pseries" machine alias
4a2fec
4a2fec
Merged patches (2.4.0):
4a2fec
- 8e8107c numa: Don't allow memdev= on RHEL-6 machine-types
4a2fec
- 8b220c0 pc_sysfw: prevent pflash and/or mis-sized firmware for rhel6.x.0 machtypes
4a2fec
- 9dba3a5 Add pc-i440fx-rhel7.2.0 machine type
4a2fec
- 1c88ffa Add pc-q35-rhel7.2.0 machine type
4a2fec
- 6f74d0c Downstream-only: Add rhel7.2.0 machine type
4a2fec
- a7d6105 Add flag for pre-2.2 migration compatibility
4a2fec
- 17f9a18 Serial: Migration compatibility pre 2.2/7.2
4a2fec
- 3799a57 Migration compat for mc146818rtc/irq_reinject_on_ack_count subsection
4a2fec
- 5668cc1 Fix reported machine type
4a2fec
- 2417534 386: drop FDC in pc-q35-rhel7.2.0 if neither it nor fl. drives are anted
4a2fec
- f42eee5 global_state: Make section optional
4a2fec
- 8640f84 migration: Add configuration section
4a2fec
- 48c857b pc: memhotplug: fix incorrectly set reserved-memory-end
4a2fec
- f33f0b6 pc: memhotplug: keep reserved-memory-end broken on rhel71 and earlier machines
4a2fec
1bdc94
(cherry picked from commit 44f7e7595c416686a00015e317e74183037a8136)
1bdc94
1bdc94
Conflicts:
1bdc94
	redhat/qemu-kvm.spec.template
1bdc94
1bdc94
Conflicts:
1bdc94
	hw/arm/Makefile.objs
1bdc94
	hw/i386/acpi-build.c
1bdc94
	hw/ppc/spapr.c
1bdc94
	hw/timer/mc146818rtc.c
1bdc94
	migration/migration.h
1bdc94
	target/i386/machine.c
1bdc94
1bdc94
Conflicts:
1bdc94
	tests/boot-serial-test.c
1bdc94
1bdc94
(cherry picked from commit f3d24bf7acf06b294404ec0c9849df6211b7b4a7)
4a2fec
---
1bdc94
 hw/acpi/ich9.c                    |  16 +
1bdc94
 hw/acpi/piix4.c                   |   6 +-
1bdc94
 hw/arm/virt.c                     | 121 +++++-
1bdc94
 hw/char/serial.c                  |  28 ++
1bdc94
 hw/display/cirrus_vga.c           |   4 +-
1bdc94
 hw/display/vga-isa.c              |   2 +-
1bdc94
 hw/i386/Makefile.objs             |   1 +
1bdc94
 hw/i386/acpi-build.c              |   3 +
1bdc94
 hw/i386/pc.c                      |   7 +-
1bdc94
 hw/i386/pc_piix.c                 | 894 +++++++++++++++++++++++++++++++++++++-
1bdc94
 hw/i386/pc_q35.c                  |  74 +++-
1bdc94
 hw/i386/pc_sysfw.c                |  16 +
1bdc94
 hw/i386/shadow-bios.c             |  64 +++
1bdc94
 hw/net/e1000.c                    |  20 +-
1bdc94
 hw/net/e1000e.c                   |  21 +
1bdc94
 hw/net/ne2000.c                   |   2 +-
1bdc94
 hw/net/pcnet-pci.c                |   2 +-
1bdc94
 hw/net/rtl8139.c                  |   6 +-
1bdc94
 hw/ppc/spapr.c                    | 213 +++++++++
1bdc94
 hw/ppc/spapr_cpu_core.c           |  13 +
1bdc94
 hw/s390x/s390-virtio-ccw.c        |  17 +-
1bdc94
 hw/smbios/smbios.c                |   1 +
1bdc94
 hw/timer/i8254_common.c           |   2 +-
1bdc94
 hw/timer/mc146818rtc.c            |   6 +
1bdc94
 hw/usb/hcd-uhci.c                 |  15 +-
1bdc94
 hw/usb/hcd-xhci.c                 |  20 +
1bdc94
 hw/usb/hcd-xhci.h                 |   2 +
1bdc94
 hw/virtio/virtio-pci.c            |   2 +-
1bdc94
 hw/virtio/virtio.c                |  22 +-
1bdc94
 include/hw/acpi/ich9.h            |   3 +
1bdc94
 include/hw/arm/virt.h             |  22 +
1bdc94
 include/hw/compat.h               | 195 +++++++++
1bdc94
 include/hw/i386/pc.h              | 554 +++++++++++++++++++++++
1bdc94
 include/hw/ppc/spapr.h            |   1 +
1bdc94
 include/hw/usb.h                  |   7 +
1bdc94
 include/hw/virtio/virtio.h        |   1 +
1bdc94
 include/sysemu/sysemu.h           |   2 +
1bdc94
 migration/migration.c             |   2 +
1bdc94
 migration/migration.h             |   5 +
1bdc94
 migration/savevm.c                |   9 +
1bdc94
 numa.c                            |  13 +
1bdc94
 qdev-monitor.c                    |   1 -
1bdc94
 redhat/qemu-kvm.spec.template     |  15 +-
1bdc94
 scripts/vmstate-static-checker.py |   1 -
1bdc94
 stubs/Makefile.objs               |   1 +
1bdc94
 stubs/shadow-bios.c               |   7 +
1bdc94
 target/i386/cpu.c                 |   9 +-
1bdc94
 target/i386/machine.c             |  21 +
1bdc94
 target/ppc/compat.c               |  11 +
1bdc94
 target/ppc/cpu.h                  |   1 +
1bdc94
 tests/Makefile.include            |   8 +-
1bdc94
 tests/cpu-plug-test.c             |   3 +-
1bdc94
 52 files changed, 2450 insertions(+), 42 deletions(-)
4a2fec
 create mode 100644 hw/i386/shadow-bios.c
4a2fec
 create mode 100644 stubs/shadow-bios.c
4a2fec
1bdc94
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
1bdc94
index a4e87b8..23a7baa 100644
1bdc94
--- a/hw/acpi/ich9.c
1bdc94
+++ b/hw/acpi/ich9.c
1bdc94
@@ -441,6 +441,18 @@ static void ich9_pm_set_enable_tco(Object *obj, bool value, Error **errp)
1bdc94
     s->pm.enable_tco = value;
1bdc94
 }
1bdc94
 
1bdc94
+static bool ich9_pm_get_force_rev1_fadt(Object *obj, Error **errp)
1bdc94
+{
1bdc94
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
1bdc94
+    return s->pm.force_rev1_fadt;
1bdc94
+}
1bdc94
+
1bdc94
+static void ich9_pm_set_force_rev1_fadt(Object *obj, bool value, Error **errp)
1bdc94
+{
1bdc94
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
1bdc94
+    s->pm.force_rev1_fadt = value;
1bdc94
+}
1bdc94
+
1bdc94
 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
1bdc94
 {
1bdc94
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
1bdc94
@@ -465,6 +477,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
1bdc94
                              ich9_pm_get_cpu_hotplug_legacy,
1bdc94
                              ich9_pm_set_cpu_hotplug_legacy,
1bdc94
                              NULL);
1bdc94
+    object_property_add_bool(obj, "__com.redhat_force-rev1-fadt",
1bdc94
+                             ich9_pm_get_force_rev1_fadt,
1bdc94
+                             ich9_pm_set_force_rev1_fadt,
1bdc94
+                             NULL);
1bdc94
     object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8",
1bdc94
                         ich9_pm_get_disable_s3,
1bdc94
                         ich9_pm_set_disable_s3,
4a2fec
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
1bdc94
index 8b70345..d706360 100644
4a2fec
--- a/hw/acpi/piix4.c
4a2fec
+++ b/hw/acpi/piix4.c
4a2fec
@@ -311,7 +311,7 @@ static const VMStateDescription vmstate_cpuhp_state = {
4a2fec
 static const VMStateDescription vmstate_acpi = {
4a2fec
     .name = "piix4_pm",
4a2fec
     .version_id = 3,
4a2fec
-    .minimum_version_id = 3,
4a2fec
+    .minimum_version_id = 2,
4a2fec
     .minimum_version_id_old = 1,
4a2fec
     .load_state_old = acpi_load_old,
4a2fec
     .post_load = vmstate_acpi_post_load,
1bdc94
@@ -671,8 +671,8 @@ static void piix4_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
4a2fec
 
4a2fec
 static Property piix4_pm_properties[] = {
4a2fec
     DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
4a2fec
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
4a2fec
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0),
4a2fec
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 1),
4a2fec
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 1),
4a2fec
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
4a2fec
     DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState,
4a2fec
                      use_acpi_pci_hotplug, true),
4a2fec
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
1bdc94
index 94dcb12..806eb1e 100644
4a2fec
--- a/hw/arm/virt.c
4a2fec
+++ b/hw/arm/virt.c
1bdc94
@@ -59,6 +59,7 @@
4a2fec
 #include "qapi/visitor.h"
4a2fec
 #include "standard-headers/linux/input.h"
4a2fec
 
4a2fec
+#if 0 /* disabled Red Hat Enterprise Linux */
4a2fec
 #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
4a2fec
     static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
4a2fec
                                                     void *data) \
1bdc94
@@ -86,7 +87,36 @@
4a2fec
     DEFINE_VIRT_MACHINE_LATEST(major, minor, true)
4a2fec
 #define DEFINE_VIRT_MACHINE(major, minor) \
4a2fec
     DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
4a2fec
-
4a2fec
+#endif /* disabled for RHEL */
4a2fec
+
4a2fec
+#define DEFINE_RHEL_MACHINE_LATEST(m, n, s, latest)                     \
4a2fec
+    static void rhel##m##n##s##_virt_class_init(ObjectClass *oc,        \
4a2fec
+                                                void *data)             \
4a2fec
+    {                                                                   \
4a2fec
+        MachineClass *mc = MACHINE_CLASS(oc);                           \
4a2fec
+        rhel##m##n##s##_virt_options(mc);                               \
4a2fec
+        mc->desc = "RHEL " # m "." # n "." # s " ARM Virtual Machine";  \
4a2fec
+        if (latest) {                                                   \
4a2fec
+            mc->alias = "virt";                                         \
4a2fec
+            mc->is_default = 1;                                         \
4a2fec
+        }                                                               \
4a2fec
+    }                                                                   \
4a2fec
+    static const TypeInfo rhel##m##n##s##_machvirt_info = {             \
4a2fec
+        .name = MACHINE_TYPE_NAME("virt-rhel" # m "." # n "." # s),     \
4a2fec
+        .parent = TYPE_RHEL_MACHINE,                                    \
4a2fec
+        .instance_init = rhel##m##n##s##_virt_instance_init,            \
4a2fec
+        .class_init = rhel##m##n##s##_virt_class_init,                  \
4a2fec
+    };                                                                  \
4a2fec
+    static void rhel##m##n##s##_machvirt_init(void)                     \
4a2fec
+    {                                                                   \
4a2fec
+        type_register_static(&rhel##m##n##s##_machvirt_info);           \
4a2fec
+    }                                                                   \
4a2fec
+    type_init(rhel##m##n##s##_machvirt_init);
4a2fec
+
4a2fec
+#define DEFINE_RHEL_MACHINE_AS_LATEST(major, minor, subminor)   \
4a2fec
+    DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, true)
4a2fec
+#define DEFINE_RHEL_MACHINE(major, minor, subminor)             \
4a2fec
+    DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, false)
4a2fec
 
4a2fec
 /* Number of external interrupt lines to configure the GIC with */
4a2fec
 #define NUM_IRQS 256
1bdc94
@@ -1416,6 +1446,7 @@ static void machvirt_init(MachineState *machine)
4a2fec
     create_platform_bus(vms, pic);
4a2fec
 }
4a2fec
 
4a2fec
+#if 0 /* disabled for RHEL */
4a2fec
 static bool virt_get_secure(Object *obj, Error **errp)
4a2fec
 {
4a2fec
     VirtMachineState *vms = VIRT_MACHINE(obj);
1bdc94
@@ -1444,6 +1475,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
4a2fec
     vms->virt = value;
4a2fec
 }
4a2fec
 
4a2fec
+#endif /* disabled for RHEL */
4a2fec
 static bool virt_get_highmem(Object *obj, Error **errp)
4a2fec
 {
4a2fec
     VirtMachineState *vms = VIRT_MACHINE(obj);
1bdc94
@@ -1536,6 +1568,7 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
4a2fec
     return ms->possible_cpus;
4a2fec
 }
4a2fec
 
4a2fec
+#if 0 /* disabled for RHEL */
4a2fec
 static void virt_machine_class_init(ObjectClass *oc, void *data)
4a2fec
 {
4a2fec
     MachineClass *mc = MACHINE_CLASS(oc);
1bdc94
@@ -1748,3 +1781,89 @@ static void virt_machine_2_6_options(MachineClass *mc)
4a2fec
     vmc->no_pmu = true;
4a2fec
 }
4a2fec
 DEFINE_VIRT_MACHINE(2, 6)
4a2fec
+#endif /* disabled for RHEL */
4a2fec
+
4a2fec
+static void rhel_machine_class_init(ObjectClass *oc, void *data)
4a2fec
+{
4a2fec
+    MachineClass *mc = MACHINE_CLASS(oc);
4a2fec
+
4a2fec
+    mc->family = "virt-rhel-Z";
4a2fec
+    mc->init = machvirt_init;
4a2fec
+    /* Start max_cpus at the maximum QEMU supports. We'll further restrict
4a2fec
+     * it later in machvirt_init, where we have more information about the
4a2fec
+     * configuration of the particular instance.
4a2fec
+     */
4a2fec
+    mc->max_cpus = 255;
4a2fec
+    mc->block_default_type = IF_VIRTIO;
4a2fec
+    mc->no_cdrom = 1;
4a2fec
+    mc->pci_allow_0_address = true;
4a2fec
+    /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */
4a2fec
+    mc->minimum_page_bits = 12;
4a2fec
+    mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
4a2fec
+    mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
1bdc94
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
1bdc94
+    mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
4a2fec
+}
4a2fec
+
4a2fec
+static const TypeInfo rhel_machine_info = {
4a2fec
+    .name          = TYPE_RHEL_MACHINE,
4a2fec
+    .parent        = TYPE_MACHINE,
4a2fec
+    .abstract      = true,
4a2fec
+    .instance_size = sizeof(VirtMachineState),
4a2fec
+    .class_size    = sizeof(VirtMachineClass),
4a2fec
+    .class_init    = rhel_machine_class_init,
4a2fec
+};
4a2fec
+
4a2fec
+static void rhel_machine_init(void)
4a2fec
+{
4a2fec
+    type_register_static(&rhel_machine_info);
4a2fec
+}
4a2fec
+type_init(rhel_machine_init);
4a2fec
+
1bdc94
+static void rhel750_virt_instance_init(Object *obj)
4a2fec
+{
4a2fec
+    VirtMachineState *vms = VIRT_MACHINE(obj);
4a2fec
+    VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
4a2fec
+
4a2fec
+    /* EL3 is disabled by default and non-configurable for RHEL */
4a2fec
+    vms->secure = false;
4a2fec
+    /* EL2 is disabled by default and non-configurable for RHEL */
4a2fec
+    vms->virt = false;
4a2fec
+    /* High memory is enabled by default for RHEL */
4a2fec
+    vms->highmem = true;
4a2fec
+    object_property_add_bool(obj, "highmem", virt_get_highmem,
4a2fec
+                             virt_set_highmem, NULL);
4a2fec
+    object_property_set_description(obj, "highmem",
4a2fec
+                                    "Set on/off to enable/disable using "
4a2fec
+                                    "physical address space above 32 bits",
4a2fec
+                                    NULL);
4a2fec
+    /* Default GIC type is still v2, but became configurable for RHEL */
4a2fec
+    vms->gic_version = 2;
4a2fec
+    object_property_add_str(obj, "gic-version", virt_get_gic_version,
4a2fec
+                        virt_set_gic_version, NULL);
4a2fec
+    object_property_set_description(obj, "gic-version",
4a2fec
+                                    "Set GIC version. "
4a2fec
+                                    "Valid values are 2, 3 and host", NULL);
4a2fec
+
4a2fec
+    if (vmc->no_its) {
4a2fec
+        vms->its = false;
4a2fec
+    } else {
4a2fec
+        /* Default allows ITS instantiation */
4a2fec
+        vms->its = true;
4a2fec
+        object_property_add_bool(obj, "its", virt_get_its,
4a2fec
+                                 virt_set_its, NULL);
4a2fec
+        object_property_set_description(obj, "its",
4a2fec
+                                        "Set on/off to enable/disable "
4a2fec
+                                        "ITS instantiation",
4a2fec
+                                        NULL);
4a2fec
+    }
4a2fec
+
4a2fec
+    vms->memmap=a15memmap;
4a2fec
+    vms->irqmap=a15irqmap;
4a2fec
+}
4a2fec
+
1bdc94
+static void rhel750_virt_options(MachineClass *mc)
4a2fec
+{
4a2fec
+    SET_MACHINE_COMPAT(mc, ARM_RHEL_COMPAT);
4a2fec
+}
1bdc94
+DEFINE_RHEL_MACHINE_AS_LATEST(7, 5, 0)
4a2fec
diff --git a/hw/char/serial.c b/hw/char/serial.c
1bdc94
index eb72191..7647fac 100644
4a2fec
--- a/hw/char/serial.c
4a2fec
+++ b/hw/char/serial.c
4a2fec
@@ -30,6 +30,7 @@
4a2fec
 #include "qemu/timer.h"
4a2fec
 #include "exec/address-spaces.h"
4a2fec
 #include "qemu/error-report.h"
4a2fec
+#include "migration/migration.h"
4a2fec
 
4a2fec
 //#define DEBUG_SERIAL
4a2fec
 
1bdc94
@@ -691,6 +692,9 @@ static int serial_post_load(void *opaque, int version_id)
4a2fec
 static bool serial_thr_ipending_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
 
4a2fec
     if (s->ier & UART_IER_THRI) {
4a2fec
         bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
1bdc94
@@ -718,6 +722,10 @@ static const VMStateDescription vmstate_serial_thr_ipending = {
4a2fec
 static bool serial_tsr_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return s->tsr_retry != 0;
4a2fec
 }
4a2fec
 
1bdc94
@@ -737,6 +745,10 @@ static const VMStateDescription vmstate_serial_tsr = {
4a2fec
 static bool serial_recv_fifo_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return !fifo8_is_empty(&s->recv_fifo);
4a2fec
 
4a2fec
 }
1bdc94
@@ -755,6 +767,10 @@ static const VMStateDescription vmstate_serial_recv_fifo = {
4a2fec
 static bool serial_xmit_fifo_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return !fifo8_is_empty(&s->xmit_fifo);
4a2fec
 }
4a2fec
 
1bdc94
@@ -772,6 +788,10 @@ static const VMStateDescription vmstate_serial_xmit_fifo = {
4a2fec
 static bool serial_fifo_timeout_timer_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return timer_pending(s->fifo_timeout_timer);
4a2fec
 }
4a2fec
 
1bdc94
@@ -789,6 +809,10 @@ static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
4a2fec
 static bool serial_timeout_ipending_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return s->timeout_ipending != 0;
4a2fec
 }
4a2fec
 
1bdc94
@@ -806,6 +830,10 @@ static const VMStateDescription vmstate_serial_timeout_ipending = {
4a2fec
 static bool serial_poll_needed(void *opaque)
4a2fec
 {
4a2fec
     SerialState *s = (SerialState *)opaque;
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return s->poll_msl >= 0;
4a2fec
 }
4a2fec
 
4a2fec
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
1bdc94
index d116651..feacb45 100644
4a2fec
--- a/hw/display/cirrus_vga.c
4a2fec
+++ b/hw/display/cirrus_vga.c
1bdc94
@@ -3060,7 +3060,7 @@ static void isa_cirrus_vga_realizefn(DeviceState *dev, Error **errp)
4a2fec
 
4a2fec
 static Property isa_cirrus_vga_properties[] = {
4a2fec
     DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState,
4a2fec
-                       cirrus_vga.vga.vram_size_mb, 4),
4a2fec
+                       cirrus_vga.vga.vram_size_mb, 16),
4a2fec
     DEFINE_PROP_BOOL("blitter", struct ISACirrusVGAState,
4a2fec
                        cirrus_vga.enable_blitter, true),
4a2fec
     DEFINE_PROP_END_OF_LIST(),
1bdc94
@@ -3133,7 +3133,7 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Error **errp)
4a2fec
 
4a2fec
 static Property pci_vga_cirrus_properties[] = {
4a2fec
     DEFINE_PROP_UINT32("vgamem_mb", struct PCICirrusVGAState,
4a2fec
-                       cirrus_vga.vga.vram_size_mb, 4),
4a2fec
+                       cirrus_vga.vga.vram_size_mb, 16),
4a2fec
     DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
4a2fec
                      cirrus_vga.enable_blitter, true),
4a2fec
     DEFINE_PROP_END_OF_LIST(),
4a2fec
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
1bdc94
index 469834a..eb44d21 100644
4a2fec
--- a/hw/display/vga-isa.c
4a2fec
+++ b/hw/display/vga-isa.c
1bdc94
@@ -79,7 +79,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
4a2fec
 }
4a2fec
 
4a2fec
 static Property vga_isa_properties[] = {
4a2fec
-    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
4a2fec
+    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 16),
4a2fec
     DEFINE_PROP_END_OF_LIST(),
4a2fec
 };
4a2fec
 
4a2fec
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
1bdc94
index fa87a14..8c25538 100644
4a2fec
--- a/hw/i386/Makefile.objs
4a2fec
+++ b/hw/i386/Makefile.objs
1bdc94
@@ -10,3 +10,4 @@ obj-$(CONFIG_VMMOUSE) += vmmouse.o
1bdc94
 
4a2fec
 obj-y += kvmvapic.o
4a2fec
 obj-y += acpi-build.o
4a2fec
+obj-y += shadow-bios.o
1bdc94
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
1bdc94
index 3cf2a16..976d151 100644
1bdc94
--- a/hw/i386/acpi-build.c
1bdc94
+++ b/hw/i386/acpi-build.c
1bdc94
@@ -183,6 +183,9 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
1bdc94
         pm->fadt.reset_reg = r;
1bdc94
         pm->fadt.reset_val = 0xf;
1bdc94
         pm->fadt.flags |= 1 << ACPI_FADT_F_RESET_REG_SUP;
1bdc94
+        if (object_property_get_bool(lpc,
1bdc94
+                                     "__com.redhat_force-rev1-fadt", NULL))
1bdc94
+            pm->fadt.rev = 1;
1bdc94
         pm->cpu_hp_io_base = ICH9_CPU_HOTPLUG_IO_BASE;
1bdc94
     }
1bdc94
     assert(obj);
4a2fec
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
1bdc94
index ab4323d..d38a328 100644
4a2fec
--- a/hw/i386/pc.c
4a2fec
+++ b/hw/i386/pc.c
1bdc94
@@ -1417,7 +1417,8 @@ void pc_memory_init(PCMachineState *pcms,
1bdc94
     option_rom_mr = g_malloc(sizeof(*option_rom_mr));
1bdc94
     memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
1bdc94
                            &error_fatal);
1bdc94
-    if (pcmc->pci_enabled) {
1bdc94
+    /* RH difference: See bz 1489800, explicitly make ROM ro */
1bdc94
+    if (pcmc->pc_rom_ro) {
1bdc94
         memory_region_set_readonly(option_rom_mr, true);
1bdc94
     }
1bdc94
     memory_region_add_subregion_overlap(rom_memory,
1bdc94
@@ -2360,6 +2361,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
1bdc94
     pcmc->acpi_data_size = 0x20000 + 0x8000;
1bdc94
     pcmc->save_tsc_khz = true;
1bdc94
     pcmc->linuxboot_dma_enabled = true;
1bdc94
+    pcmc->pc_rom_ro = true;
1bdc94
     mc->get_hotplug_handler = pc_get_hotpug_handler;
1bdc94
     mc->cpu_index_to_instance_props = pc_cpu_index_to_props;
1bdc94
     mc->get_default_cpu_node_id = pc_get_default_cpu_node_id;
1bdc94
@@ -2369,7 +2371,8 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
4a2fec
     mc->default_boot_order = "cad";
4a2fec
     mc->hot_add_cpu = pc_hot_add_cpu;
4a2fec
     mc->block_default_type = IF_IDE;
4a2fec
-    mc->max_cpus = 255;
4a2fec
+    /* 240: max CPU count for RHEL */
4a2fec
+    mc->max_cpus = 240;
4a2fec
     mc->reset = pc_machine_reset;
4a2fec
     hc->pre_plug = pc_machine_device_pre_plug_cb;
4a2fec
     hc->plug = pc_machine_device_plug_cb;
4a2fec
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
1bdc94
index 729a050..6794bb7 100644
4a2fec
--- a/hw/i386/pc_piix.c
4a2fec
+++ b/hw/i386/pc_piix.c
4a2fec
@@ -48,6 +48,7 @@
4a2fec
 #include "cpu.h"
1bdc94
 #include "qapi/error.h"
4a2fec
 #include "qemu/error-report.h"
4a2fec
+#include "migration/migration.h"
4a2fec
 #ifdef CONFIG_XEN
4a2fec
 #include <xen/hvm/hvm_info_table.h>
4a2fec
 #include "hw/xen/xen_pt.h"
4a2fec
@@ -168,8 +169,8 @@ static void pc_init1(MachineState *machine,
4a2fec
     if (pcmc->smbios_defaults) {
4a2fec
         MachineClass *mc = MACHINE_GET_CLASS(machine);
4a2fec
         /* These values are guest ABI, do not change */
4a2fec
-        smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
4a2fec
-                            mc->name, pcmc->smbios_legacy_mode,
4a2fec
+        smbios_set_defaults("Red Hat", "KVM",
4a2fec
+                            mc->desc, pcmc->smbios_legacy_mode,
4a2fec
                             pcmc->smbios_uuid_encoded,
4a2fec
                             SMBIOS_ENTRY_POINT_21);
4a2fec
     }
1bdc94
@@ -307,6 +308,7 @@ static void pc_init1(MachineState *machine,
4a2fec
  * HW_COMPAT_*, PC_COMPAT_*, or * pc_*_machine_options().
4a2fec
  */
4a2fec
 
4a2fec
+#if 0 /* Disabled for Red Hat Enterprise Linux */
4a2fec
 static void pc_compat_2_3(MachineState *machine)
4a2fec
 {
4a2fec
     PCMachineState *pcms = PC_MACHINE(machine);
1bdc94
@@ -1135,3 +1137,891 @@ static void xenfv_machine_options(MachineClass *m)
4a2fec
 DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
4a2fec
                   xenfv_machine_options);
4a2fec
 #endif
4a2fec
+machine_init(pc_machine_init);
4a2fec
+
4a2fec
+#endif  /* Disabled for Red Hat Enterprise Linux */
4a2fec
+
4a2fec
+/* Red Hat Enterprise Linux machine types */
4a2fec
+
4a2fec
+/* Options for the latest rhel7 machine type */
4a2fec
+static void pc_machine_rhel7_options(MachineClass *m)
4a2fec
+{
1bdc94
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
+    m->family = "pc_piix_Y";
4a2fec
+    m->default_machine_opts = "firmware=bios-256k.bin";
1bdc94
+    pcmc->default_nic_model = "e1000";
4a2fec
+    m->default_display = "std";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL_COMPAT);
4a2fec
+    m->alias = "pc";
4a2fec
+    m->is_default = 1;
4a2fec
+}
4a2fec
+
1bdc94
+static void pc_init_rhel750(MachineState *machine)
1bdc94
+{
1bdc94
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
1bdc94
+             TYPE_I440FX_PCI_DEVICE);
1bdc94
+}
1bdc94
+
1bdc94
+static void pc_machine_rhel750_options(MachineClass *m)
1bdc94
+{
1bdc94
+    pc_machine_rhel7_options(m);
1bdc94
+    m->desc = "RHEL 7.5.0 PC (i440FX + PIIX, 1996)";
1bdc94
+}
1bdc94
+
1bdc94
+DEFINE_PC_MACHINE(rhel750, "pc-i440fx-rhel7.5.0", pc_init_rhel750,
1bdc94
+                  pc_machine_rhel750_options);
1bdc94
+
4a2fec
+static void pc_init_rhel740(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_machine_rhel740_options(MachineClass *m)
4a2fec
+{
1bdc94
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
1bdc94
+    pc_machine_rhel750_options(m);
1bdc94
+    m->alias = NULL;
1bdc94
+    m->is_default = 0;
4a2fec
+    m->desc = "RHEL 7.4.0 PC (i440FX + PIIX, 1996)";
1bdc94
+    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
1bdc94
+    pcmc->pc_rom_ro = false;
1bdc94
+    SET_MACHINE_COMPAT(m, PC_RHEL7_4_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel740, "pc-i440fx-rhel7.4.0", pc_init_rhel740,
4a2fec
+                  pc_machine_rhel740_options);
4a2fec
+
4a2fec
+static void pc_init_rhel730(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_machine_rhel730_options(MachineClass *m)
4a2fec
+{
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
+    pc_machine_rhel740_options(m);
4a2fec
+    m->alias = NULL;
4a2fec
+    m->is_default = 0;
4a2fec
+    m->desc = "RHEL 7.3.0 PC (i440FX + PIIX, 1996)";
4a2fec
+    pcmc->linuxboot_dma_enabled = false;
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL7_3_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel730, "pc-i440fx-rhel7.3.0", pc_init_rhel730,
4a2fec
+                  pc_machine_rhel730_options);
4a2fec
+
4a2fec
+
4a2fec
+static void pc_init_rhel720(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_machine_rhel720_options(MachineClass *m)
4a2fec
+{
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
+    pc_machine_rhel730_options(m);
4a2fec
+    m->desc = "RHEL 7.2.0 PC (i440FX + PIIX, 1996)";
4a2fec
+    /* From pc_i440fx_2_5_machine_options */
4a2fec
+    pcmc->save_tsc_khz = false;
4a2fec
+    m->legacy_fw_cfg_order = 1;
4a2fec
+    /* Note: broken_reserved_end was already in 7.2 */
4a2fec
+    /* From pc_i440fx_2_6_machine_options */
4a2fec
+    pcmc->legacy_cpu_hotplug = true;
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL7_2_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel720, "pc-i440fx-rhel7.2.0", pc_init_rhel720,
4a2fec
+                  pc_machine_rhel720_options);
4a2fec
+
4a2fec
+static void pc_compat_rhel710(MachineState *machine)
4a2fec
+{
4a2fec
+    PCMachineState *pcms = PC_MACHINE(machine);
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
4a2fec
+
4a2fec
+    /* From pc_compat_2_2 */
4a2fec
+    pcmc->rsdp_in_ram = false;
4a2fec
+    machine->suppress_vmdesc = true;
4a2fec
+
4a2fec
+    /* From pc_compat_2_1 */
4a2fec
+    pcmc->smbios_uuid_encoded = false;
4a2fec
+    x86_cpu_change_kvm_default("svm", NULL);
4a2fec
+    pcmc->enforce_aligned_dimm = false;
4a2fec
+
4a2fec
+    /* Disable all the extra subsections that were added in 2.2 */
4a2fec
+    migrate_pre_2_2 = true;
4a2fec
+
4a2fec
+    /* From pc_i440fx_2_4_machine_options */
4a2fec
+    pcmc->broken_reserved_end = true;
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel710(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel710(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_machine_rhel710_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel720_options(m);
4a2fec
+    m->family = "pc_piix_Y";
4a2fec
+    m->desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)";
4a2fec
+    m->default_display = "cirrus";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL7_1_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel710, "pc-i440fx-rhel7.1.0", pc_init_rhel710,
4a2fec
+                  pc_machine_rhel710_options);
4a2fec
+
4a2fec
+static void pc_compat_rhel700(MachineState *machine)
4a2fec
+{
4a2fec
+    PCMachineState *pcms = PC_MACHINE(machine);
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
4a2fec
+
4a2fec
+    pc_compat_rhel710(machine);
4a2fec
+
4a2fec
+    /* Upstream enables it for everyone, we're a little more selective */
4a2fec
+    x86_cpu_change_kvm_default("x2apic", NULL);
4a2fec
+    x86_cpu_change_kvm_default("svm", NULL);
4a2fec
+    pcmc->legacy_acpi_table_size = 6418; /* see pc_compat_2_0() */
4a2fec
+    pcmc->smbios_legacy_mode = true;
4a2fec
+    pcmc->has_reserved_memory = false;
4a2fec
+    migrate_cve_2014_5263_xhci_fields = true;
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel700(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel700(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_machine_rhel700_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel710_options(m);
4a2fec
+    m->family = "pc_piix_Y";
4a2fec
+    m->desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL7_0_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel700, "pc-i440fx-rhel7.0.0", pc_init_rhel700,
4a2fec
+                  pc_machine_rhel700_options);
4a2fec
+
4a2fec
+#define PC_RHEL6_6_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "scsi-hd",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "scsi-cd",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "scsi-disk",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "ide-hd",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "ide-cd",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "ide-drive",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-blk-pci",\
4a2fec
+            .property = "discard_granularity",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-serial-pci",\
4a2fec
+            .property = "vectors",\
4a2fec
+            /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
4a2fec
+            .value    = stringify(0xFFFFFFFF),\
4a2fec
+        },{\
4a2fec
+            .driver   = "486-" TYPE_X86_CPU,\
4a2fec
+            .property = "model",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-tablet",\
4a2fec
+            .property = "usb_version",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "mq",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "VGA",\
4a2fec
+            .property = "mmio",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-blk-pci",\
4a2fec
+            .property = "config-wce",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = TYPE_ISA_FDC,\
4a2fec
+            .property = "check_media_rate",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-balloon-pci",\
4a2fec
+            .property = "class",\
4a2fec
+            .value    = stringify(PCI_CLASS_MEMORY_RAM),\
4a2fec
+        },{\
4a2fec
+            .driver   = TYPE_PCI_DEVICE,\
4a2fec
+            .property = "command_serr_enable",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "AC97",\
4a2fec
+            .property = "use_broken_id",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "intel-hda",\
4a2fec
+            .property = "msi",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver = "qemu32-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver = "486-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "qemu32-" TYPE_X86_CPU,\
4a2fec
+            .property = "model",\
4a2fec
+            .value    = stringify(3),\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-ccid",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "1",\
4a2fec
+        },{\
4a2fec
+            .driver   = "ne2k_pci",\
4a2fec
+            .property = "romfile",\
4a2fec
+            .value    = "rhel6-ne2k_pci.rom",\
4a2fec
+        },{\
4a2fec
+            .driver   = "pcnet",\
4a2fec
+            .property = "romfile",\
4a2fec
+            .value    = "rhel6-pcnet.rom",\
4a2fec
+        },{\
4a2fec
+            .driver   = "rtl8139",\
4a2fec
+            .property = "romfile",\
4a2fec
+            .value    = "rhel6-rtl8139.rom",\
4a2fec
+        },{\
4a2fec
+            .driver   = "e1000",\
4a2fec
+            .property = "romfile",\
4a2fec
+            .value    = "rhel6-e1000.rom",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "romfile",\
4a2fec
+            .value    = "rhel6-virtio.rom",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "pentium" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "apic",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "pentium2" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "apic",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "pentium3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "apic",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Conroe" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Penryn" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Nehalem" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "x2apic",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "x2apic",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "pclmulqdq",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "pclmulqdq",\
1bdc94
+            .value = "off",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "fxsr",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "fxsr",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "mmx",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "mmx",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "pat",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "pat",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "cmov",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "cmov",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "pge",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "pge",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "apic",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "cx8",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "cx8",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "mce",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "mce",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "pae",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "pae",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "msr",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "msr",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "tsc",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "tsc",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "pse",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "pse",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "de",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "de",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "fpu",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "fpu",\
1bdc94
+            .value = "on",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "rdtscp",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "rdtscp",\
1bdc94
+            .value = "off",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "smap",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL6_6_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "smap",\
1bdc94
+            .value = "off",\
1bdc94
+        },\
4a2fec
+        {\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "rdtscp",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "on",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "x2apic",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "3dnow",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "3dnowext",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "virtio-net-pci",\
4a2fec
+            .property = "__com.redhat_rhel6_ctrl_guest_workaround", \
4a2fec
+            .value = "on",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel660(MachineState *machine)
4a2fec
+{
4a2fec
+    PCMachineState *pcms = PC_MACHINE(machine);
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
4a2fec
+
4a2fec
+    pc_compat_rhel700(machine);
1bdc94
+    if (!machine->cpu_type) {
1bdc94
+        machine->cpu_type = "cpu64-rhel6";
4a2fec
+    }
4a2fec
+
4a2fec
+    x86_cpu_change_kvm_default("kvm-pv-unhalt", NULL);
4a2fec
+
4a2fec
+    pcmc->gigabyte_align = false;
4a2fec
+    shadow_bios_after_incoming = true;
4a2fec
+    ich9_uhci123_irqpin_override = true;
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel660(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel660(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel660_options(MachineClass *m)
4a2fec
+{
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
+    pc_machine_rhel700_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.6.0 PC";
4a2fec
+    m->rom_file_has_mr = false;
4a2fec
+    m->default_machine_opts = "firmware=bios.bin";
4a2fec
+    pcmc->has_acpi_build = false;
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_6_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel660, "rhel6.6.0", pc_init_rhel660,
4a2fec
+                  pc_machine_rhel660_options);
4a2fec
+
4a2fec
+#define PC_RHEL6_5_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = TYPE_USB_DEVICE,\
4a2fec
+            .property = "msos-desc",\
4a2fec
+            .value    = "no",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel650(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel660(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel650(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel650(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel650_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel660_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.5.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_5_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel650, "rhel6.5.0", pc_init_rhel650,
4a2fec
+                  pc_machine_rhel650_options);
4a2fec
+
4a2fec
+#define PC_RHEL6_4_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "virtio-scsi-pci",\
4a2fec
+            .property = "vectors",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "hda-micro",\
4a2fec
+            .property = "mixer",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "hda-duplex",\
4a2fec
+            .property = "mixer",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "hda-output",\
4a2fec
+            .property = "mixer",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "ctrl_mac_addr",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "sep",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "virtio-net-pci",\
4a2fec
+            .property = "__com.redhat_rhel6_ctrl_guest_workaround", \
4a2fec
+            .value = "off",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel640(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel650(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel640(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel640(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel640_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel650_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.4.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_4_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel640, "rhel6.4.0", pc_init_rhel640,
4a2fec
+                  pc_machine_rhel640_options);
4a2fec
+
4a2fec
+#define PC_RHEL6_3_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "Conroe-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "Penryn-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "Nehalem-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "e1000",\
4a2fec
+            .property = "autonegotiation",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "qxl",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(3),\
4a2fec
+        },{\
4a2fec
+            .driver   = "qxl-vga",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(3),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-scsi-pci",\
4a2fec
+            .property = "hotplug",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-scsi-pci",\
4a2fec
+            .property = "param_change",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "pmu",\
4a2fec
+            .value = "on",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-hub",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "314159",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-storage",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "1",\
4a2fec
+        },\
4a2fec
+        {\
4a2fec
+            .driver = "SandyBridge" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "tsc-deadline",\
4a2fec
+            .value = "off",\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL6_3_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver = "SandyBridge-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "tsc-deadline",\
1bdc94
+            .value = "off",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel630(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel640(machine);
4a2fec
+    x86_cpu_change_kvm_default("kvm-pv-eoi",NULL);
4a2fec
+    enable_compat_apic_id_mode();
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel630(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel630(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel630_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel640_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.3.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_3_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel630, "rhel6.3.0", pc_init_rhel630,
4a2fec
+                  pc_machine_rhel630_options);
4a2fec
+
4a2fec
+
4a2fec
+#define PC_RHEL6_2_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "pmu",\
4a2fec
+            .value = "off",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel620(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel630(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel620(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel620(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel620_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel630_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.2.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_2_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel620, "rhel6.2.0", pc_init_rhel620,
4a2fec
+                  pc_machine_rhel620_options);
4a2fec
+
4a2fec
+/*
4a2fec
+ * NOTE: We don't have the event_idx compat entry for the
4a2fec
+ * virtio-balloon-pci driver because RHEL6 doesn't disable
4a2fec
+ * it either due to a bug (see RHBZ 1029539 fo more info)
4a2fec
+ */
4a2fec
+#define PC_RHEL6_1_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "PIIX4_PM",\
4a2fec
+            .property = "disable_s3",\
4a2fec
+            .value    = "0",\
4a2fec
+        },{\
4a2fec
+            .driver   = "PIIX4_PM",\
4a2fec
+            .property = "disable_s4",\
4a2fec
+            .value    = "0",\
4a2fec
+        },{\
4a2fec
+            .driver   = "qxl",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "qxl-vga",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-blk-pci",\
4a2fec
+            .property = "event_idx",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-serial-pci",\
4a2fec
+            .property = "event_idx",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "event_idx",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-kbd",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "1",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-mouse",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "1",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-tablet",\
4a2fec
+            .property = "serial",\
4a2fec
+            .value    = "1",\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel610(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel620(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel610(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel610(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel610_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel620_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.1.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_1_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel610, "rhel6.1.0", pc_init_rhel610,
4a2fec
+                  pc_machine_rhel610_options);
4a2fec
+
4a2fec
+#define PC_RHEL6_0_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "qxl",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "qxl-vga",\
4a2fec
+            .property = "revision",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "VGA",\
4a2fec
+            .property = "rombar",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },
4a2fec
+
4a2fec
+static void pc_compat_rhel600(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel610(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_init_rhel600(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_compat_rhel600(machine);
4a2fec
+    pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
4a2fec
+             TYPE_I440FX_PCI_DEVICE);}
4a2fec
+
4a2fec
+static void pc_machine_rhel600_options(MachineClass *m)
4a2fec
+{
4a2fec
+    pc_machine_rhel610_options(m);
4a2fec
+    m->family = "pc_piix_Z";
4a2fec
+    m->desc = "RHEL 6.0.0 PC";
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL6_0_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(rhel600, "rhel6.0.0", pc_init_rhel600,
4a2fec
+                  pc_machine_rhel600_options);
4a2fec
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
1bdc94
index 9ae9163..ecd6255 100644
4a2fec
--- a/hw/i386/pc_q35.c
4a2fec
+++ b/hw/i386/pc_q35.c
1bdc94
@@ -143,8 +143,8 @@ static void pc_q35_init(MachineState *machine)
4a2fec
 
4a2fec
     if (pcmc->smbios_defaults) {
4a2fec
         /* These values are guest ABI, do not change */
4a2fec
-        smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
4a2fec
-                            mc->name, pcmc->smbios_legacy_mode,
4a2fec
+        smbios_set_defaults("Red Hat", "KVM",
4a2fec
+                            mc->desc, pcmc->smbios_legacy_mode,
4a2fec
                             pcmc->smbios_uuid_encoded,
4a2fec
                             SMBIOS_ENTRY_POINT_21);
4a2fec
     }
1bdc94
@@ -292,6 +292,7 @@ static void pc_q35_init(MachineState *machine)
4a2fec
     DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
4a2fec
 
4a2fec
 
4a2fec
+#if 0 /* Disabled for Red Hat Enterprise Linux */
4a2fec
 static void pc_q35_machine_options(MachineClass *m)
4a2fec
 {
1bdc94
     PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
1bdc94
@@ -404,3 +405,72 @@ static void pc_q35_2_4_machine_options(MachineClass *m)
4a2fec
 
4a2fec
 DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
4a2fec
                    pc_q35_2_4_machine_options);
4a2fec
+#endif  /* Disabled for Red Hat Enterprise Linux */
4a2fec
+
4a2fec
+/* Red Hat Enterprise Linux machine types */
4a2fec
+
4a2fec
+/* Options for the latest rhel7 q35 machine type */
4a2fec
+static void pc_q35_machine_rhel7_options(MachineClass *m)
4a2fec
+{
1bdc94
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
1bdc94
+    pcmc->default_nic_model = "e1000e";
4a2fec
+    m->family = "pc_q35_Z";
4a2fec
+    m->default_machine_opts = "firmware=bios-256k.bin";
4a2fec
+    m->default_display = "std";
4a2fec
+    m->no_floppy = 1;
1bdc94
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_SYS_BUS_DEVICE);    m->alias = "q35";
4a2fec
+    m->max_cpus = 384;
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL_COMPAT);
4a2fec
+}
4a2fec
+
1bdc94
+static void pc_q35_init_rhel750(MachineState *machine)
1bdc94
+{
1bdc94
+    pc_q35_init(machine);
1bdc94
+}
1bdc94
+
1bdc94
+static void pc_q35_machine_rhel750_options(MachineClass *m)
1bdc94
+{
1bdc94
+    pc_q35_machine_rhel7_options(m);
1bdc94
+    m->desc = "RHEL-7.5.0 PC (Q35 + ICH9, 2009)";
1bdc94
+}
1bdc94
+
1bdc94
+DEFINE_PC_MACHINE(q35_rhel750, "pc-q35-rhel7.5.0", pc_q35_init_rhel750,
1bdc94
+                  pc_q35_machine_rhel750_options);
1bdc94
+
4a2fec
+static void pc_q35_init_rhel740(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_q35_init(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_q35_machine_rhel740_options(MachineClass *m)
4a2fec
+{
1bdc94
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
1bdc94
+    pc_q35_machine_rhel750_options(m);
1bdc94
+    m->alias = NULL;
4a2fec
+    m->desc = "RHEL-7.4.0 PC (Q35 + ICH9, 2009)";
1bdc94
+    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
1bdc94
+    pcmc->pc_rom_ro = false;
1bdc94
+    SET_MACHINE_COMPAT(m, PC_RHEL7_4_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(q35_rhel740, "pc-q35-rhel7.4.0", pc_q35_init_rhel740,
4a2fec
+                  pc_q35_machine_rhel740_options);
4a2fec
+
4a2fec
+static void pc_q35_init_rhel730(MachineState *machine)
4a2fec
+{
4a2fec
+    pc_q35_init(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void pc_q35_machine_rhel730_options(MachineClass *m)
4a2fec
+{
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
+    pc_q35_machine_rhel740_options(m);
4a2fec
+    m->alias = NULL;
4a2fec
+    m->desc = "RHEL-7.3.0 PC (Q35 + ICH9, 2009)";
4a2fec
+    m->max_cpus = 255;
4a2fec
+    pcmc->linuxboot_dma_enabled = false;
4a2fec
+    SET_MACHINE_COMPAT(m, PC_RHEL7_3_COMPAT);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_PC_MACHINE(q35_rhel730, "pc-q35-rhel7.3.0", pc_q35_init_rhel730,
4a2fec
+                  pc_q35_machine_rhel730_options);
4a2fec
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
1bdc94
index 73ac783..2a6de35 100644
4a2fec
--- a/hw/i386/pc_sysfw.c
4a2fec
+++ b/hw/i386/pc_sysfw.c
1bdc94
@@ -207,6 +207,13 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
4a2fec
         (bios_size % 65536) != 0) {
4a2fec
         goto bios_error;
4a2fec
     }
4a2fec
+    if (shadow_bios_after_incoming && bios_size != 128 * 1024) {
4a2fec
+        MachineClass *mc;
4a2fec
+
4a2fec
+        mc = MACHINE_GET_CLASS(current_machine);
4a2fec
+        error_report("machine %s only supports a 128KB BIOS image", mc->name);
4a2fec
+        exit(1);
4a2fec
+    }
4a2fec
     bios = g_malloc(sizeof(*bios));
4a2fec
     memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
4a2fec
     if (!isapc_ram_fw) {
1bdc94
@@ -254,6 +261,15 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
4a2fec
         return;
4a2fec
     }
4a2fec
 
4a2fec
+    if (shadow_bios_after_incoming) {
4a2fec
+        MachineClass *mc;
4a2fec
+
4a2fec
+        mc = MACHINE_GET_CLASS(current_machine);
4a2fec
+        error_report("flash-based firmware is not supported by machine %s",
4a2fec
+                     mc->name);
4a2fec
+        exit(1);
4a2fec
+    }
4a2fec
+
4a2fec
     if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
4a2fec
         /* Older KVM cannot execute from device memory. So, flash memory
4a2fec
          * cannot be used unless the readonly memory kvm capability is present. */
4a2fec
diff --git a/hw/i386/shadow-bios.c b/hw/i386/shadow-bios.c
4a2fec
new file mode 100644
4a2fec
index 0000000..65a4cb8
4a2fec
--- /dev/null
4a2fec
+++ b/hw/i386/shadow-bios.c
4a2fec
@@ -0,0 +1,64 @@
4a2fec
+#include "qemu/osdep.h"
4a2fec
+#include "sysemu/sysemu.h"
4a2fec
+#include "target/i386/cpu.h"
4a2fec
+#include "exec/ram_addr.h"
4a2fec
+#include "qemu/cutils.h"
4a2fec
+
4a2fec
+void shadow_bios(void)
4a2fec
+{
4a2fec
+    RAMBlock *block, *ram, *oprom, *bios;
4a2fec
+    size_t one_meg, oprom_size, bios_size;
4a2fec
+    uint8_t *cd_seg_host, *ef_seg_host;
4a2fec
+
4a2fec
+    ram = NULL;
4a2fec
+    oprom = NULL;
4a2fec
+    bios = NULL;
4a2fec
+    rcu_read_lock();
4a2fec
+    QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
4a2fec
+        if (strcmp("pc.ram", block->idstr) == 0) {
4a2fec
+            assert(ram == NULL);
4a2fec
+            ram = block;
4a2fec
+        } else if (strcmp("pc.rom", block->idstr) == 0) {
4a2fec
+            assert(oprom == NULL);
4a2fec
+            oprom = block;
4a2fec
+        } else if (strcmp("pc.bios", block->idstr) == 0) {
4a2fec
+            assert(bios == NULL);
4a2fec
+            bios = block;
4a2fec
+        }
4a2fec
+    }
4a2fec
+    assert(ram != NULL);
4a2fec
+    assert(oprom != NULL);
4a2fec
+    assert(bios != NULL);
4a2fec
+    assert(memory_region_is_ram(ram->mr));
4a2fec
+    assert(memory_region_is_ram(oprom->mr));
4a2fec
+    assert(memory_region_is_ram(bios->mr));
4a2fec
+    assert(int128_eq(ram->mr->size, int128_make64(ram->used_length)));
4a2fec
+    assert(int128_eq(oprom->mr->size, int128_make64(oprom->used_length)));
4a2fec
+    assert(int128_eq(bios->mr->size, int128_make64(bios->used_length)));
4a2fec
+
4a2fec
+    one_meg = 1024 * 1024;
4a2fec
+    oprom_size = 128 * 1024;
4a2fec
+    bios_size = 128 * 1024;
4a2fec
+    assert(ram->used_length >= one_meg);
4a2fec
+    assert(oprom->used_length == oprom_size);
4a2fec
+    assert(bios->used_length == bios_size);
4a2fec
+
4a2fec
+    ef_seg_host = memory_region_get_ram_ptr(ram->mr) + (one_meg - bios_size);
4a2fec
+    cd_seg_host = ef_seg_host - oprom_size;
4a2fec
+
4a2fec
+    /* This is a crude hack, but we must distinguish a rhel6.x.0 machtype guest
4a2fec
+     * coming in from a RHEL-6 emulator (where shadowing has had no effect on
4a2fec
+     * "pc.ram") from a similar guest coming in from a RHEL-7 emulator (where
4a2fec
+     * shadowing has worked). In the latter case we must not trample the live
4a2fec
+     * SeaBIOS variables in "pc.ram".
4a2fec
+     */
4a2fec
+    if (buffer_is_zero(ef_seg_host, bios_size)) {
4a2fec
+        fprintf(stderr, "copying E and F segments from pc.bios to pc.ram\n");
4a2fec
+        memcpy(ef_seg_host, memory_region_get_ram_ptr(bios->mr), bios_size);
4a2fec
+    }
4a2fec
+    if (buffer_is_zero(cd_seg_host, oprom_size)) {
4a2fec
+        fprintf(stderr, "copying C and D segments from pc.rom to pc.ram\n");
4a2fec
+        memcpy(cd_seg_host, memory_region_get_ram_ptr(oprom->mr), oprom_size);
4a2fec
+    }
4a2fec
+    rcu_read_unlock();
4a2fec
+}
4a2fec
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
1bdc94
index 742cd0a..479ac77 100644
4a2fec
--- a/hw/net/e1000.c
4a2fec
+++ b/hw/net/e1000.c
1bdc94
@@ -1663,6 +1663,16 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp)
4a2fec
 
4a2fec
     pci_conf = pci_dev->config;
4a2fec
 
4a2fec
+    if (!(d->compat_flags & E1000_FLAG_AUTONEG)) {
4a2fec
+        /*
4a2fec
+         * We have no capabilities, so capability list bit should normally be 0.
4a2fec
+         * Keep it on for compat machine types to avoid breaking migration.
4a2fec
+         * HACK: abuse E1000_FLAG_AUTONEG, which is off exactly for
4a2fec
+         * the machine types that need this.
4a2fec
+         */
4a2fec
+        pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST);
4a2fec
+    }
4a2fec
+
4a2fec
     /* TODO: RST# value should be 0, PCI spec 6.2.4 */
4a2fec
     pci_conf[PCI_CACHE_LINE_SIZE] = 0x10;
4a2fec
 
1bdc94
@@ -1727,7 +1737,7 @@ static void e1000_class_init(ObjectClass *klass, void *data)
4a2fec
 
4a2fec
     k->realize = pci_e1000_realize;
4a2fec
     k->exit = pci_e1000_uninit;
4a2fec
-    k->romfile = "efi-e1000.rom";
4a2fec
+    k->romfile = "pxe-e1000.rom";
4a2fec
     k->vendor_id = PCI_VENDOR_ID_INTEL;
4a2fec
     k->device_id = info->device_id;
4a2fec
     k->revision = info->revision;
1bdc94
@@ -1763,7 +1773,7 @@ static const TypeInfo e1000_base_info = {
4a2fec
 
4a2fec
 static const E1000Info e1000_devices[] = {
4a2fec
     {
4a2fec
-        .name      = "e1000",
4a2fec
+        .name      = "e1000-82540em",
4a2fec
         .device_id = E1000_DEV_ID_82540EM,
4a2fec
         .revision  = 0x03,
4a2fec
         .phy_id2   = E1000_PHY_ID2_8254xx_DEFAULT,
1bdc94
@@ -1784,6 +1794,11 @@ static const E1000Info e1000_devices[] = {
1bdc94
 #endif
4a2fec
 };
4a2fec
 
4a2fec
+static const TypeInfo e1000_default_info = {
4a2fec
+    .name          = "e1000",
4a2fec
+    .parent        = "e1000-82540em",
4a2fec
+};
4a2fec
+
4a2fec
 static void e1000_register_types(void)
4a2fec
 {
4a2fec
     int i;
1bdc94
@@ -1801,6 +1816,7 @@ static void e1000_register_types(void)
4a2fec
 
4a2fec
         type_register(&type_info);
4a2fec
     }
4a2fec
+    type_register_static(&e1000_default_info);
4a2fec
 }
4a2fec
 
4a2fec
 type_init(e1000_register_types)
1bdc94
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
1bdc94
index c934c22..7dd8744 100644
1bdc94
--- a/hw/net/e1000e.c
1bdc94
+++ b/hw/net/e1000e.c
1bdc94
@@ -74,6 +74,11 @@ typedef struct E1000EState {
1bdc94
 
1bdc94
     E1000ECore core;
1bdc94
 
1bdc94
+    /* 7.3 had the intr_state field that was in the original e1000e code
1bdc94
+     * but that was removed prior to 2.7's release
1bdc94
+     */
1bdc94
+    bool redhat_7_3_intr_state_enable;
1bdc94
+    uint32_t redhat_7_3_intr_state;
1bdc94
 } E1000EState;
1bdc94
 
1bdc94
 #define E1000E_MMIO_IDX     0
1bdc94
@@ -89,6 +94,10 @@ typedef struct E1000EState {
1bdc94
 #define E1000E_MSIX_TABLE   (0x0000)
1bdc94
 #define E1000E_MSIX_PBA     (0x2000)
1bdc94
 
1bdc94
+/* Values as in RHEL 7.3 build and original upstream */
1bdc94
+#define RH_E1000E_USE_MSI     BIT(0)
1bdc94
+#define RH_E1000E_USE_MSIX    BIT(1)
1bdc94
+
1bdc94
 static uint64_t
1bdc94
 e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size)
1bdc94
 {
1bdc94
@@ -300,6 +309,8 @@ e1000e_init_msix(E1000EState *s)
1bdc94
     } else {
1bdc94
         if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) {
1bdc94
             msix_uninit(d, &s->msix, &s->msix);
1bdc94
+        } else {
1bdc94
+            s->redhat_7_3_intr_state |= RH_E1000E_USE_MSIX;
1bdc94
         }
1bdc94
     }
1bdc94
 }
1bdc94
@@ -471,6 +482,8 @@ static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp)
1bdc94
     ret = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
1bdc94
     if (ret) {
1bdc94
         trace_e1000e_msi_init_fail(ret);
1bdc94
+    } else {
1bdc94
+        s->redhat_7_3_intr_state |= RH_E1000E_USE_MSI;
1bdc94
     }
1bdc94
 
1bdc94
     if (e1000e_add_pm_capability(pci_dev, e1000e_pmrb_offset,
1bdc94
@@ -594,6 +607,11 @@ static const VMStateDescription e1000e_vmstate_intr_timer = {
1bdc94
     VMSTATE_STRUCT_ARRAY(_f, _s, _num, 0,                           \
1bdc94
                          e1000e_vmstate_intr_timer, E1000IntrDelayTimer)
1bdc94
 
1bdc94
+static bool rhel_7_3_check(void *opaque, int version_id)
1bdc94
+{
1bdc94
+    return ((E1000EState *)opaque)->redhat_7_3_intr_state_enable;
1bdc94
+}
1bdc94
+
1bdc94
 static const VMStateDescription e1000e_vmstate = {
1bdc94
     .name = "e1000e",
1bdc94
     .version_id = 1,
1bdc94
@@ -605,6 +623,7 @@ static const VMStateDescription e1000e_vmstate = {
1bdc94
         VMSTATE_MSIX(parent_obj, E1000EState),
1bdc94
 
1bdc94
         VMSTATE_UINT32(ioaddr, E1000EState),
1bdc94
+        VMSTATE_UINT32_TEST(redhat_7_3_intr_state, E1000EState, rhel_7_3_check),
1bdc94
         VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState),
1bdc94
         VMSTATE_UINT8(core.rx_desc_len, E1000EState),
1bdc94
         VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState,
1bdc94
@@ -653,6 +672,8 @@ static PropertyInfo e1000e_prop_disable_vnet,
1bdc94
 
1bdc94
 static Property e1000e_properties[] = {
1bdc94
     DEFINE_NIC_PROPERTIES(E1000EState, conf),
1bdc94
+    DEFINE_PROP_BOOL("__redhat_e1000e_7_3_intr_state", E1000EState,
1bdc94
+                        redhat_7_3_intr_state_enable, false),
1bdc94
     DEFINE_PROP_SIGNED("disable_vnet_hdr", E1000EState, disable_vnet, false,
1bdc94
                         e1000e_prop_disable_vnet, bool),
1bdc94
     DEFINE_PROP_SIGNED("subsys_ven", E1000EState, subsys_ven,
4a2fec
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
1bdc94
index 3a9fc89..c629530 100644
4a2fec
--- a/hw/net/ne2000.c
4a2fec
+++ b/hw/net/ne2000.c
1bdc94
@@ -769,7 +769,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data)
4a2fec
 
4a2fec
     k->realize = pci_ne2000_realize;
4a2fec
     k->exit = pci_ne2000_exit;
4a2fec
-    k->romfile = "efi-ne2k_pci.rom",
4a2fec
+    k->romfile = "pxe-ne2k_pci.rom",
4a2fec
     k->vendor_id = PCI_VENDOR_ID_REALTEK;
4a2fec
     k->device_id = PCI_DEVICE_ID_REALTEK_8029;
4a2fec
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
4a2fec
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
1bdc94
index 70dc8b3..35b6d8a 100644
4a2fec
--- a/hw/net/pcnet-pci.c
4a2fec
+++ b/hw/net/pcnet-pci.c
1bdc94
@@ -347,7 +347,7 @@ static void pcnet_class_init(ObjectClass *klass, void *data)
4a2fec
 
4a2fec
     k->realize = pci_pcnet_realize;
4a2fec
     k->exit = pci_pcnet_uninit;
4a2fec
-    k->romfile = "efi-pcnet.rom",
4a2fec
+    k->romfile = "pxe-pcnet.rom",
4a2fec
     k->vendor_id = PCI_VENDOR_ID_AMD;
4a2fec
     k->device_id = PCI_DEVICE_ID_AMD_LANCE;
4a2fec
     k->revision = 0x10;
4a2fec
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1bdc94
index 46daa16..bc37326 100644
4a2fec
--- a/hw/net/rtl8139.c
4a2fec
+++ b/hw/net/rtl8139.c
1bdc94
@@ -3174,7 +3174,7 @@ static int rtl8139_pre_save(void *opaque)
1bdc94
 
1bdc94
 static const VMStateDescription vmstate_rtl8139 = {
1bdc94
     .name = "rtl8139",
1bdc94
-    .version_id = 5,
1bdc94
+    .version_id = 4,
1bdc94
     .minimum_version_id = 3,
1bdc94
     .post_load = rtl8139_post_load,
1bdc94
     .pre_save  = rtl8139_pre_save,
1bdc94
@@ -3255,7 +3255,9 @@ static const VMStateDescription vmstate_rtl8139 = {
1bdc94
         VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State),
1bdc94
         VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State),
1bdc94
         VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State),
1bdc94
+#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */
1bdc94
         VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5),
1bdc94
+#endif
1bdc94
         VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State),
1bdc94
         VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State),
1bdc94
 
1bdc94
@@ -3425,7 +3427,7 @@ static void rtl8139_class_init(ObjectClass *klass, void *data)
4a2fec
 
4a2fec
     k->realize = pci_rtl8139_realize;
4a2fec
     k->exit = pci_rtl8139_uninit;
4a2fec
-    k->romfile = "efi-rtl8139.rom";
4a2fec
+    k->romfile = "pxe-rtl8139.rom";
4a2fec
     k->vendor_id = PCI_VENDOR_ID_REALTEK;
4a2fec
     k->device_id = PCI_DEVICE_ID_REALTEK_8139;
4a2fec
     k->revision = RTL8139_PCI_REVID; /* >=0x20 is for 8139C+ */
4a2fec
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
1bdc94
index 6a92b20..3ea94de 100644
4a2fec
--- a/hw/ppc/spapr.c
4a2fec
+++ b/hw/ppc/spapr.c
1bdc94
@@ -3935,6 +3935,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
1bdc94
     smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN;
1bdc94
     smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN;
1bdc94
     spapr_caps_add_properties(smc, &error_abort);
1bdc94
+    smc->has_power9_support = true;
1bdc94
 }
1bdc94
 
1bdc94
 static const TypeInfo spapr_machine_info = {
1bdc94
@@ -3985,6 +3986,7 @@ static const TypeInfo spapr_machine_info = {
4a2fec
     }                                                                \
4a2fec
     type_init(spapr_machine_register_##suffix)
4a2fec
 
4a2fec
+#if 0 /* Disabled for Red Hat Enterprise Linux */
4a2fec
 /*
1bdc94
  * pseries-2.12
4a2fec
  */
1bdc94
@@ -4136,7 +4138,9 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false);
4a2fec
         .property = "pre-2.8-migration",            \
4a2fec
         .value    = "on",                           \
4a2fec
     },
4a2fec
+#endif
4a2fec
 
1bdc94
+#if defined(CONFIG_RHV)
4a2fec
 static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
4a2fec
                               uint64_t *buid, hwaddr *pio,
1bdc94
                               hwaddr *mmio32, hwaddr *mmio64,
1bdc94
@@ -4185,7 +4189,9 @@ static void phb_placement_2_7(sPAPRMachineState *spapr, uint32_t index,
1bdc94
      * window into contiguous 32-bit and 64-bit windows
4a2fec
      */
4a2fec
 }
1bdc94
+#endif /* CONFIG_RHV */
4a2fec
 
4a2fec
+#if 0 /* Disabled for Red Hat Enterprise Linux */
4a2fec
 static void spapr_machine_2_7_instance_options(MachineState *machine)
4a2fec
 {
4a2fec
     sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
1bdc94
@@ -4345,6 +4351,213 @@ static void spapr_machine_2_1_class_options(MachineClass *mc)
4a2fec
     SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_1);
4a2fec
 }
4a2fec
 DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
4a2fec
+#endif
4a2fec
+
4a2fec
+/*
1bdc94
+ * pseries-rhel7.5.0
4a2fec
+ */
1bdc94
+
1bdc94
+static void spapr_machine_rhel750_instance_options(MachineState *machine)
4a2fec
+{
4a2fec
+}
4a2fec
+
1bdc94
+static void spapr_machine_rhel750_class_options(MachineClass *mc)
4a2fec
+{
4a2fec
+    /* Defaults for the latest behaviour inherited from the base class */
4a2fec
+}
4a2fec
+
1bdc94
+DEFINE_SPAPR_MACHINE(rhel750, "rhel7.5.0", true);
1bdc94
+
1bdc94
+/*
1bdc94
+ * pseries-rhel7.5.0-sxxm
1bdc94
+ *
1bdc94
+ * pseries-rhel7.5.0 with speculative execution exploit mitigations enabled by default
1bdc94
+ */
1bdc94
+static void spapr_machine_rhel750sxxm_instance_options(MachineState *machine)
1bdc94
+{
1bdc94
+    spapr_machine_rhel750_instance_options(machine);
1bdc94
+}
4a2fec
+
1bdc94
+static void spapr_machine_rhel750sxxm_class_options(MachineClass *mc)
1bdc94
+{
1bdc94
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
1bdc94
+
1bdc94
+    spapr_machine_rhel750_class_options(mc);
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
1bdc94
+}
1bdc94
+
1bdc94
+DEFINE_SPAPR_MACHINE(rhel750sxxm, "rhel7.5.0-sxxm", false);
1bdc94
+
1bdc94
+#if defined(CONFIG_RHV)
4a2fec
+
4a2fec
+/*
4a2fec
+ * pseries-rhel7.4.0
1bdc94
+ * like SPAPR_COMPAT_2_9
4a2fec
+ */
4a2fec
+
1bdc94
+#define SPAPR_COMPAT_RHEL7_4                                           \
1bdc94
+    HW_COMPAT_RHEL7_4                                                  \
1bdc94
+    {                                                                  \
1bdc94
+        .driver = TYPE_POWERPC_CPU,                                    \
1bdc94
+        .property = "pre-2.10-migration",                              \
1bdc94
+        .value    = "on",                                              \
1bdc94
+    },                                                                 \
1bdc94
+
4a2fec
+static void spapr_machine_rhel740_instance_options(MachineState *machine)
4a2fec
+{
1bdc94
+    spapr_machine_rhel750_instance_options(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void spapr_machine_rhel740_class_options(MachineClass *mc)
4a2fec
+{
1bdc94
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
1bdc94
+
1bdc94
+    spapr_machine_rhel750_class_options(mc);
1bdc94
+    SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_RHEL7_4);
1bdc94
+    mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
1bdc94
+    smc->has_power9_support = false;
1bdc94
+    smc->pre_2_10_has_unused_icps = true;
1bdc94
+    smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON;
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_SPAPR_MACHINE(rhel740, "rhel7.4.0", false);
4a2fec
+
4a2fec
+/*
1bdc94
+ * pseries-rhel7.4.0-sxxm
1bdc94
+ *
1bdc94
+ * pseries-rhel7.4.0 with speculative execution exploit mitigations enabled by default
1bdc94
+ */
1bdc94
+static void spapr_machine_rhel740sxxm_instance_options(MachineState *machine)
1bdc94
+{
1bdc94
+    spapr_machine_rhel740_instance_options(machine);
1bdc94
+}
1bdc94
+
1bdc94
+static void spapr_machine_rhel740sxxm_class_options(MachineClass *mc)
1bdc94
+{
1bdc94
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
1bdc94
+
1bdc94
+    spapr_machine_rhel740_class_options(mc);
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
1bdc94
+}
1bdc94
+
1bdc94
+DEFINE_SPAPR_MACHINE(rhel740sxxm, "rhel7.4.0-sxxm", false);
1bdc94
+
1bdc94
+/*
4a2fec
+ * pseries-rhel7.3.0
4a2fec
+ * like SPAPR_COMPAT_2_6/_2_7/_2_8 but "ddw" has been backported to RHEL7_3
4a2fec
+ */
4a2fec
+#define SPAPR_COMPAT_RHEL7_3 \
4a2fec
+    HW_COMPAT_RHEL7_3                               \
4a2fec
+    {                                               \
4a2fec
+        .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,     \
4a2fec
+        .property = "mem_win_size",                 \
4a2fec
+        .value    = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE),\
4a2fec
+    },                                              \
4a2fec
+    {                                               \
4a2fec
+        .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,     \
4a2fec
+        .property = "mem64_win_size",               \
4a2fec
+        .value    = "0",                            \
4a2fec
+    },                                              \
4a2fec
+    {                                               \
4a2fec
+        .driver = TYPE_POWERPC_CPU,                 \
4a2fec
+        .property = "pre-2.8-migration",            \
4a2fec
+        .value    = "on",                           \
4a2fec
+    },                                              \
4a2fec
+    {                                               \
4a2fec
+        .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,       \
4a2fec
+        .property = "pre-2.8-migration",            \
4a2fec
+        .value    = "on",                           \
4a2fec
+    },                                              \
4a2fec
+    {                                               \
4a2fec
+        .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,     \
4a2fec
+        .property = "pcie-extended-configuration-space",\
4a2fec
+        .value    = "off",                          \
4a2fec
+    },
4a2fec
+
4a2fec
+static void spapr_machine_rhel730_instance_options(MachineState *machine)
4a2fec
+{
4a2fec
+    sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
4a2fec
+
4a2fec
+    spapr_machine_rhel740_instance_options(machine);
4a2fec
+    spapr->use_hotplug_event_source = false;
4a2fec
+}
4a2fec
+
4a2fec
+static void spapr_machine_rhel730_class_options(MachineClass *mc)
4a2fec
+{
4a2fec
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
4a2fec
+
4a2fec
+    spapr_machine_rhel740_class_options(mc);
1bdc94
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3");
4a2fec
+    SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_RHEL7_3);
4a2fec
+    smc->phb_placement = phb_placement_2_7;
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_SPAPR_MACHINE(rhel730, "rhel7.3.0", false);
4a2fec
+
4a2fec
+/*
1bdc94
+ * pseries-rhel7.3.0-sxxm
1bdc94
+ *
1bdc94
+ * pseries-rhel7.3.0 with speculative execution exploit mitigations enabled by default
1bdc94
+ */
1bdc94
+static void spapr_machine_rhel730sxxm_instance_options(MachineState *machine)
1bdc94
+{
1bdc94
+    spapr_machine_rhel730_instance_options(machine);
1bdc94
+}
1bdc94
+
1bdc94
+static void spapr_machine_rhel730sxxm_class_options(MachineClass *mc)
1bdc94
+{
1bdc94
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
1bdc94
+
1bdc94
+    spapr_machine_rhel730_class_options(mc);
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
1bdc94
+    smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
1bdc94
+}
1bdc94
+
1bdc94
+DEFINE_SPAPR_MACHINE(rhel730sxxm, "rhel7.3.0-sxxm", false);
1bdc94
+
1bdc94
+/*
4a2fec
+ * pseries-rhel7.2.0
4a2fec
+ */
4a2fec
+/* Should be like SPAPR_COMPAT_2_5 + 2_4 + 2_3, but "dynamic-reconfiguration"
4a2fec
+ * has been backported to RHEL7_2 so we don't need it here.
4a2fec
+ */
4a2fec
+
4a2fec
+#define SPAPR_COMPAT_RHEL7_2 \
4a2fec
+    HW_COMPAT_RHEL7_2 \
4a2fec
+    { \
4a2fec
+        .driver   = "spapr-vlan", \
4a2fec
+        .property = "use-rx-buffer-pools", \
4a2fec
+        .value    = "off", \
4a2fec
+    },{ \
4a2fec
+        .driver   = TYPE_SPAPR_PCI_HOST_BRIDGE,\
4a2fec
+        .property = "ddw",\
4a2fec
+        .value    = stringify(off),\
4a2fec
+    },
4a2fec
+
4a2fec
+
4a2fec
+static void spapr_machine_rhel720_instance_options(MachineState *machine)
4a2fec
+{
4a2fec
+    spapr_machine_rhel730_instance_options(machine);
4a2fec
+}
4a2fec
+
4a2fec
+static void spapr_machine_rhel720_class_options(MachineClass *mc)
4a2fec
+{
4a2fec
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
4a2fec
+
4a2fec
+    spapr_machine_rhel730_class_options(mc);
4a2fec
+    smc->use_ohci_by_default = true;
4a2fec
+    mc->has_hotpluggable_cpus = NULL;
4a2fec
+    SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_RHEL7_2);
4a2fec
+}
4a2fec
+
4a2fec
+DEFINE_SPAPR_MACHINE(rhel720, "rhel7.2.0", false);
1bdc94
+#endif /* CONFIG_RHV */
4a2fec
 
4a2fec
 static void spapr_machine_register_types(void)
4a2fec
 {
1bdc94
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
1bdc94
index 1eda854..c5f0c72 100644
1bdc94
--- a/hw/ppc/spapr_cpu_core.c
1bdc94
+++ b/hw/ppc/spapr_cpu_core.c
1bdc94
@@ -21,6 +21,7 @@
1bdc94
 #include "sysemu/numa.h"
1bdc94
 #include "sysemu/hw_accel.h"
1bdc94
 #include "qemu/error-report.h"
1bdc94
+#include "cpu-models.h"
1bdc94
 
1bdc94
 static void spapr_cpu_reset(void *opaque)
1bdc94
 {
1bdc94
@@ -62,6 +63,7 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu,
1bdc94
                            Error **errp)
1bdc94
 {
1bdc94
     CPUPPCState *env = &cpu->env;
1bdc94
+    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
1bdc94
 
1bdc94
     /* Set time-base frequency to 512 MHz */
1bdc94
     cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ);
1bdc94
@@ -69,6 +71,17 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu,
1bdc94
     /* Enable PAPR mode in TCG or KVM */
1bdc94
     cpu_ppc_set_papr(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
1bdc94
 
1bdc94
+    if (!smc->has_power9_support &&
1bdc94
+        (((spapr->max_compat_pvr &&
1bdc94
+           ppc_compat_cmp(spapr->max_compat_pvr,
1bdc94
+                          CPU_POWERPC_LOGICAL_3_00) >= 0)) ||
1bdc94
+          (!spapr->max_compat_pvr &&
1bdc94
+           ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) {
1bdc94
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
1bdc94
+                  "POWER9 CPU is not supported by this machine class");
1bdc94
+        return;
1bdc94
+    }
1bdc94
+
1bdc94
     qemu_register_reset(spapr_cpu_reset, cpu);
1bdc94
     spapr_cpu_reset(cpu);
1bdc94
 }
1bdc94
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
1bdc94
index 435f7c9..3956ac3 100644
1bdc94
--- a/hw/s390x/s390-virtio-ccw.c
1bdc94
+++ b/hw/s390x/s390-virtio-ccw.c
1bdc94
@@ -647,7 +647,7 @@ bool css_migration_enabled(void)
1bdc94
     {                                                                         \
1bdc94
         MachineClass *mc = MACHINE_CLASS(oc);                                 \
1bdc94
         ccw_machine_##suffix##_class_options(mc);                             \
1bdc94
-        mc->desc = "VirtIO-ccw based S390 machine v" verstr;                  \
1bdc94
+        mc->desc = "VirtIO-ccw based S390 machine " verstr;                   \
1bdc94
         if (latest) {                                                         \
1bdc94
             mc->alias = "s390-ccw-virtio";                                    \
1bdc94
             mc->is_default = 1;                                               \
1bdc94
@@ -682,6 +682,8 @@ bool css_migration_enabled(void)
1bdc94
 #define CCW_COMPAT_2_10 \
1bdc94
         HW_COMPAT_2_10
1bdc94
 
1bdc94
+#if 0 /* Disabled for Red Hat Enterprise Linux */
1bdc94
+
1bdc94
 #define CCW_COMPAT_2_9 \
1bdc94
         HW_COMPAT_2_9 \
1bdc94
         {\
1bdc94
@@ -879,6 +881,19 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
1bdc94
 }
1bdc94
 DEFINE_CCW_MACHINE(2_4, "2.4", false);
1bdc94
 
1bdc94
+#else
1bdc94
+
1bdc94
+static void ccw_machine_rhel750_instance_options(MachineState *machine)
1bdc94
+{
1bdc94
+}
1bdc94
+
1bdc94
+static void ccw_machine_rhel750_class_options(MachineClass *mc)
1bdc94
+{
1bdc94
+}
1bdc94
+DEFINE_CCW_MACHINE(rhel750, "rhel7.5.0", true);
1bdc94
+
1bdc94
+#endif
1bdc94
+
1bdc94
 static void ccw_machine_register_types(void)
1bdc94
 {
1bdc94
     type_register_static(&ccw_machine_info);
4a2fec
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
1bdc94
index 27a07e9..df8f0ae 100644
4a2fec
--- a/hw/smbios/smbios.c
4a2fec
+++ b/hw/smbios/smbios.c
1bdc94
@@ -778,6 +778,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
4a2fec
     SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
4a2fec
     SMBIOS_SET_DEFAULT(type1.product, product);
4a2fec
     SMBIOS_SET_DEFAULT(type1.version, version);
4a2fec
+    SMBIOS_SET_DEFAULT(type1.family, "Red Hat Enterprise Linux");
4a2fec
     SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer);
4a2fec
     SMBIOS_SET_DEFAULT(type2.product, product);
4a2fec
     SMBIOS_SET_DEFAULT(type2.version, version);
4a2fec
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
1bdc94
index 6190b6f..ad2ad2d 100644
4a2fec
--- a/hw/timer/i8254_common.c
4a2fec
+++ b/hw/timer/i8254_common.c
1bdc94
@@ -268,7 +268,7 @@ static const VMStateDescription vmstate_pit_common = {
4a2fec
     .pre_save = pit_dispatch_pre_save,
4a2fec
     .post_load = pit_dispatch_post_load,
4a2fec
     .fields = (VMStateField[]) {
4a2fec
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
4a2fec
+        VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */
4a2fec
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
4a2fec
                              vmstate_pit_channel, PITChannelState),
4a2fec
         VMSTATE_INT64(channels[0].next_transition_time,
4a2fec
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
1bdc94
index 6f1f723..68c353f 100644
4a2fec
--- a/hw/timer/mc146818rtc.c
4a2fec
+++ b/hw/timer/mc146818rtc.c
1bdc94
@@ -34,6 +34,7 @@
1bdc94
 #include "qapi/qapi-commands-misc.h"
1bdc94
 #include "qapi/qapi-events-misc.h"
4a2fec
 #include "qapi/visitor.h"
4a2fec
+#include "migration/migration.h"
4a2fec
 
4a2fec
 #ifdef TARGET_I386
4a2fec
 #include "hw/i386/apic.h"
1bdc94
@@ -839,6 +840,11 @@ static int rtc_post_load(void *opaque, int version_id)
4a2fec
 static bool rtc_irq_reinject_on_ack_count_needed(void *opaque)
4a2fec
 {
4a2fec
     RTCState *s = (RTCState *)opaque;
4a2fec
+
4a2fec
+    if (migrate_pre_2_2) {
4a2fec
+        return false;
4a2fec
+    }
4a2fec
+
4a2fec
     return s->irq_reinject_on_ack_count != 0;
4a2fec
 }
4a2fec
 
4a2fec
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
1bdc94
index 836b11f..86d6ab8 100644
4a2fec
--- a/hw/usb/hcd-uhci.c
4a2fec
+++ b/hw/usb/hcd-uhci.c
4a2fec
@@ -152,6 +152,8 @@ typedef struct UHCI_QH {
4a2fec
     uint32_t el_link;
4a2fec
 } UHCI_QH;
4a2fec
 
4a2fec
+bool ich9_uhci123_irqpin_override;
4a2fec
+
4a2fec
 static void uhci_async_cancel(UHCIAsync *async);
4a2fec
 static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td);
4a2fec
 static void uhci_resume(void *opaque);
4a2fec
@@ -1214,12 +1216,23 @@ static void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
4a2fec
     UHCIState *s = UHCI(dev);
4a2fec
     uint8_t *pci_conf = s->dev.config;
4a2fec
     int i;
4a2fec
+    int irq_pin;
4a2fec
 
4a2fec
     pci_conf[PCI_CLASS_PROG] = 0x00;
4a2fec
     /* TODO: reset value should be 0. */
4a2fec
     pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
4a2fec
 
4a2fec
-    pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
4a2fec
+    if (ich9_uhci123_irqpin_override &&
4a2fec
+        u->info.vendor_id == PCI_VENDOR_ID_INTEL &&
4a2fec
+        (u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI1 ||
4a2fec
+         u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI2 ||
4a2fec
+         u->info.device_id == PCI_DEVICE_ID_INTEL_82801I_UHCI3)) {
4a2fec
+        fprintf(stderr, "RHEL-6 compat: %s: irq_pin = 3\n", u->info.name);
4a2fec
+        irq_pin = 3;
4a2fec
+    } else {
4a2fec
+        irq_pin = u->info.irq_pin;
4a2fec
+    }
4a2fec
+    pci_config_set_interrupt_pin(pci_conf, irq_pin + 1);
4a2fec
 
4a2fec
     if (s->masterbus) {
4a2fec
         USBPort *ports[NB_PORTS];
4a2fec
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
1bdc94
index 721beb5..883141f 100644
4a2fec
--- a/hw/usb/hcd-xhci.c
4a2fec
+++ b/hw/usb/hcd-xhci.c
1bdc94
@@ -3555,9 +3555,27 @@ static const VMStateDescription vmstate_xhci_slot = {
4a2fec
     }
4a2fec
 };
4a2fec
 
1bdc94
+static int xhci_event_pre_save(void *opaque)
4a2fec
+{
4a2fec
+    XHCIEvent *s = opaque;
4a2fec
+
4a2fec
+    s->cve_2014_5263_a = ((uint8_t *)&s->type)[0];
4a2fec
+    s->cve_2014_5263_b = ((uint8_t *)&s->type)[1];
1bdc94
+
1bdc94
+    return 0;
4a2fec
+}
4a2fec
+
4a2fec
+bool migrate_cve_2014_5263_xhci_fields;
4a2fec
+
4a2fec
+static bool xhci_event_cve_2014_5263(void *opaque, int version_id)
4a2fec
+{
4a2fec
+    return migrate_cve_2014_5263_xhci_fields;
4a2fec
+}
4a2fec
+
4a2fec
 static const VMStateDescription vmstate_xhci_event = {
4a2fec
     .name = "xhci-event",
4a2fec
     .version_id = 1,
4a2fec
+    .pre_save = xhci_event_pre_save,
4a2fec
     .fields = (VMStateField[]) {
4a2fec
         VMSTATE_UINT32(type,   XHCIEvent),
4a2fec
         VMSTATE_UINT32(ccode,  XHCIEvent),
1bdc94
@@ -3566,6 +3584,8 @@ static const VMStateDescription vmstate_xhci_event = {
4a2fec
         VMSTATE_UINT32(flags,  XHCIEvent),
4a2fec
         VMSTATE_UINT8(slotid,  XHCIEvent),
4a2fec
         VMSTATE_UINT8(epid,    XHCIEvent),
4a2fec
+        VMSTATE_UINT8_TEST(cve_2014_5263_a, XHCIEvent, xhci_event_cve_2014_5263),
4a2fec
+        VMSTATE_UINT8_TEST(cve_2014_5263_b, XHCIEvent, xhci_event_cve_2014_5263),
4a2fec
         VMSTATE_END_OF_LIST()
4a2fec
     }
4a2fec
 };
4a2fec
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
4a2fec
index fc36a4c..89d4cf7 100644
4a2fec
--- a/hw/usb/hcd-xhci.h
4a2fec
+++ b/hw/usb/hcd-xhci.h
4a2fec
@@ -153,6 +153,8 @@ typedef struct XHCIEvent {
4a2fec
     uint32_t flags;
4a2fec
     uint8_t slotid;
4a2fec
     uint8_t epid;
4a2fec
+    uint8_t cve_2014_5263_a;
4a2fec
+    uint8_t cve_2014_5263_b;
4a2fec
 } XHCIEvent;
4a2fec
 
4a2fec
 typedef struct XHCIInterrupter {
4a2fec
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
1bdc94
index e3e49d6..18f7c2c 100644
4a2fec
--- a/hw/virtio/virtio-pci.c
4a2fec
+++ b/hw/virtio/virtio-pci.c
1bdc94
@@ -2422,7 +2422,7 @@ static void virtio_net_pci_class_init(ObjectClass *klass, void *data)
4a2fec
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
4a2fec
     VirtioPCIClass *vpciklass = VIRTIO_PCI_CLASS(klass);
4a2fec
 
4a2fec
-    k->romfile = "efi-virtio.rom";
4a2fec
+    k->romfile = "pxe-virtio.rom";
4a2fec
     k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
4a2fec
     k->device_id = PCI_DEVICE_ID_VIRTIO_NET;
4a2fec
     k->revision = VIRTIO_PCI_ABI_VERSION;
4a2fec
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
1bdc94
index 006d3d1..4bcb4f4 100644
4a2fec
--- a/hw/virtio/virtio.c
4a2fec
+++ b/hw/virtio/virtio.c
4a2fec
@@ -24,6 +24,7 @@
4a2fec
 #include "hw/virtio/virtio-access.h"
4a2fec
 #include "sysemu/dma.h"
4a2fec
 
4a2fec
+#include "standard-headers/linux/virtio_net.h"
4a2fec
 /*
4a2fec
  * The alignment to use between consumer and producer parts of vring.
4a2fec
  * x86 pagesize again. This is the default, used by transports like PCI
1bdc94
@@ -1991,7 +1992,24 @@ const VMStateInfo  virtio_vmstate_info = {
4a2fec
 static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
4a2fec
 {
4a2fec
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
4a2fec
-    bool bad = (val & ~(vdev->host_features)) != 0;
4a2fec
+    bool bad;
4a2fec
+    uint64_t ctrl_guest_mask = 1ull << VIRTIO_NET_F_CTRL_GUEST_OFFLOADS;
4a2fec
+
4a2fec
+    if (vdev->rhel6_ctrl_guest_workaround && (val & ctrl_guest_mask) &&
4a2fec
+          !(vdev->host_features & ctrl_guest_mask)) {
4a2fec
+        /*
4a2fec
+         * This works around a mistake in the definition of the rhel6.[56].0
4a2fec
+         * machinetypes, ctrl-guest-offload was not set in qemu-kvm-rhev for
4a2fec
+         * those machine types, but is set on the rhel6 qemu-kvm-rhev build.
4a2fec
+         * If an incoming rhel6 guest uses it then we need to allow it.
4a2fec
+         * Note: There's a small race where a guest read the flag but didn't
4a2fec
+         * declare it's useage yet.
4a2fec
+         */
4a2fec
+        fprintf(stderr, "RHEL6 ctrl_guest_offload workaround\n");
4a2fec
+        vdev->host_features |= ctrl_guest_mask;
4a2fec
+    }
4a2fec
+
4a2fec
+    bad = (val & ~(vdev->host_features)) != 0;
4a2fec
 
4a2fec
     val &= vdev->host_features;
4a2fec
     if (k->set_features) {
1bdc94
@@ -2566,6 +2584,8 @@ static void virtio_device_instance_finalize(Object *obj)
4a2fec
 
4a2fec
 static Property virtio_properties[] = {
4a2fec
     DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features),
4a2fec
+    DEFINE_PROP_BOOL("__com.redhat_rhel6_ctrl_guest_workaround", VirtIODevice,
4a2fec
+                     rhel6_ctrl_guest_workaround, false),
4a2fec
     DEFINE_PROP_END_OF_LIST(),
4a2fec
 };
4a2fec
 
1bdc94
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
1bdc94
index 59aeb06..7b5cc25 100644
1bdc94
--- a/include/hw/acpi/ich9.h
1bdc94
+++ b/include/hw/acpi/ich9.h
1bdc94
@@ -61,6 +61,9 @@ typedef struct ICH9LPCPMRegs {
1bdc94
     uint8_t smm_enabled;
1bdc94
     bool enable_tco;
1bdc94
     TCOIORegs tco_regs;
1bdc94
+
1bdc94
+    /* RH addition, see bz 1489800 */
1bdc94
+    bool force_rev1_fadt;
1bdc94
 } ICH9LPCPMRegs;
1bdc94
 
1bdc94
 #define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
4a2fec
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
1bdc94
index ba0c1a4..2e8e78a 100644
4a2fec
--- a/include/hw/arm/virt.h
4a2fec
+++ b/include/hw/arm/virt.h
1bdc94
@@ -109,6 +109,7 @@ typedef struct {
4a2fec
     int psci_conduit;
4a2fec
 } VirtMachineState;
4a2fec
 
4a2fec
+#if 0 /* disabled for Red Hat Enterprise Linux */
4a2fec
 #define TYPE_VIRT_MACHINE   MACHINE_TYPE_NAME("virt")
4a2fec
 #define VIRT_MACHINE(obj) \
4a2fec
     OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
1bdc94
@@ -117,6 +118,27 @@ typedef struct {
4a2fec
 #define VIRT_MACHINE_CLASS(klass) \
4a2fec
     OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
4a2fec
 
4a2fec
+#else
4a2fec
+#define TYPE_RHEL_MACHINE MACHINE_TYPE_NAME("virt-rhel")
4a2fec
+#define VIRT_MACHINE(obj) \
4a2fec
+    OBJECT_CHECK(VirtMachineState, (obj), TYPE_RHEL_MACHINE)
4a2fec
+#define VIRT_MACHINE_GET_CLASS(obj) \
4a2fec
+    OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_RHEL_MACHINE)
4a2fec
+#define VIRT_MACHINE_CLASS(klass) \
4a2fec
+    OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_RHEL_MACHINE)
4a2fec
+#endif
4a2fec
+
4a2fec
+/* This macro is for changes to properties that are RHEL specific,
4a2fec
+ * different to the current upstream and to be applied to the latest
4a2fec
+ * machine type.
4a2fec
+ */
4a2fec
+#define ARM_RHEL_COMPAT \
4a2fec
+    {\
4a2fec
+        .driver   = "virtio-net-pci",\
4a2fec
+        .property = "romfile",\
4a2fec
+        .value    = "",\
4a2fec
+    },
4a2fec
+
4a2fec
 void virt_acpi_setup(VirtMachineState *vms);
4a2fec
 
4a2fec
 #endif /* QEMU_ARM_VIRT_H */
4a2fec
diff --git a/include/hw/compat.h b/include/hw/compat.h
1bdc94
index 13242b8..503b5c8 100644
4a2fec
--- a/include/hw/compat.h
4a2fec
+++ b/include/hw/compat.h
1bdc94
@@ -255,4 +255,199 @@
4a2fec
         .value    = "on",\
1bdc94
     },
1bdc94
 
4a2fec
+/* Mostly like HW_COMPAT_2_1 but:
4a2fec
+ *    we don't need virtio-scsi-pci since 7.0 already had that on
4a2fec
+ *
1bdc94
+ * RH: Note, qemu-extended-regs should have been enabled in the 7.1
4a2fec
+ * machine type, but was accidentally turned off in 7.2 onwards.
4a2fec
+ *
4a2fec
+ */
4a2fec
+#define HW_COMPAT_RHEL7_1 \
4a2fec
+        { /* COMPAT_RHEL7.1 */ \
4a2fec
+            .driver   = "intel-hda-generic",\
4a2fec
+            .property = "old_msi_addr",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{\
4a2fec
+            .driver   = "VGA",\
4a2fec
+            .property = "qemu-extended-regs",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "secondary-vga",\
4a2fec
+            .property = "qemu-extended-regs",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-mouse",\
4a2fec
+            .property = "usb_version",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "usb-kbd",\
4a2fec
+            .property = "usb_version",\
4a2fec
+            .value    = stringify(1),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "virtio-pci-bus-master-bug-migration",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-blk-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-balloon-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-serial-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-9p-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-rng-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_1 - introduced with 2.10.0 */ \
4a2fec
+            .driver   = "migration",\
4a2fec
+            .property = "send-configuration",\
4a2fec
+            .value    = "off",\
4a2fec
+        },
4a2fec
+
4a2fec
+/* Mostly like HW_COMPAT_2_4 + 2_3 but:
4a2fec
+ *  we don't need "any_layout" as it has been backported to 7.2
4a2fec
+ */
4a2fec
+
4a2fec
+#define HW_COMPAT_RHEL7_2 \
4a2fec
+        {\
4a2fec
+            .driver   = "virtio-blk-device",\
4a2fec
+            .property = "scsi",\
4a2fec
+            .value    = "true",\
4a2fec
+        },{\
4a2fec
+            .driver   = "e1000-82540em",\
4a2fec
+            .property = "extra_mac_registers",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "x-disable-pcie",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "migrate-extra",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "fw_cfg_mem",\
4a2fec
+            .property = "dma_enabled",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "fw_cfg_io",\
4a2fec
+            .property = "dma_enabled",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "isa-fdc",\
4a2fec
+            .property = "fallback",\
4a2fec
+            .value    = "144",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "disable-modern",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "disable-legacy",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = TYPE_PCI_DEVICE,\
4a2fec
+            .property = "x-pcie-lnksta-dllla",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 */ \
4a2fec
+            .driver   = "virtio-pci",\
4a2fec
+            .property = "page-per-vq",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 from HW_COMPAT_2_4 added in 2.9 */ \
4a2fec
+            .driver   = "vmgenid",\
4a2fec
+            .property = "x-write-pointer-available",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 - introduced with 2.10.0 */ \
4a2fec
+            .driver   = "migration",\
4a2fec
+            .property = "send-section-footer",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ /* HW_COMPAT_RHEL7_2 - introduced with 2.10.0 */ \
4a2fec
+            .driver   = "migration",\
4a2fec
+            .property = "store-global-state",\
4a2fec
+            .value    = "off",\
4a2fec
+        },
4a2fec
+
4a2fec
+/* Mostly like HW_COMPAT_2_6 + HW_COMPAT_2_7 + HW_COMPAT_2_8 except
4a2fec
+ * disable-modern, disable-legacy, page-per-vq have already been
4a2fec
+ * backported to RHEL7.3
4a2fec
+ */
4a2fec
+#define HW_COMPAT_RHEL7_3 \
4a2fec
+    { /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-mmio",\
4a2fec
+        .property = "format_transport_address",\
4a2fec
+        .value    = "off",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-serial-device",\
4a2fec
+        .property = "emergency-write",\
4a2fec
+        .value    = "off",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "ioapic",\
4a2fec
+        .property = "version",\
4a2fec
+        .value    = "0x11",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "intel-iommu",\
4a2fec
+        .property = "x-buggy-eim",\
4a2fec
+        .value    = "true",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-pci",\
4a2fec
+        .property = "x-ignore-backend-features",\
4a2fec
+        .value    = "on",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "fw_cfg_mem",\
4a2fec
+        .property = "x-file-slots",\
4a2fec
+        .value    = stringify(0x10),\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "fw_cfg_io",\
4a2fec
+        .property = "x-file-slots",\
4a2fec
+        .value    = stringify(0x10),\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "pflash_cfi01",\
4a2fec
+        .property = "old-multiple-chip-handling",\
4a2fec
+        .value    = "on",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = TYPE_PCI_DEVICE,\
4a2fec
+        .property = "x-pcie-extcap-init",\
4a2fec
+        .value    = "off",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-pci",\
4a2fec
+        .property = "x-pcie-deverr-init",\
4a2fec
+        .value    = "off",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-pci",\
4a2fec
+        .property = "x-pcie-lnkctl-init",\
4a2fec
+        .value    = "off",\
4a2fec
+    },{ /* HW_COMPAT_RHEL7_3 */ \
4a2fec
+        .driver   = "virtio-pci",\
4a2fec
+        .property = "x-pcie-pm-init",\
4a2fec
+        .value    = "off",\
1bdc94
+    },{ /* HW_COMPAT_RHEL7_3 */ \
1bdc94
+        .driver   = "virtio-net-device",\
1bdc94
+        .property = "x-mtu-bypass-backend",\
1bdc94
+        .value    = "off",\
1bdc94
+    },{ /* HW_COMPAT_RHEL7_3 */ \
1bdc94
+        .driver   = "e1000e",\
1bdc94
+        .property = "__redhat_e1000e_7_3_intr_state",\
1bdc94
+        .value    = "on",\
1bdc94
+    },
1bdc94
+
1bdc94
+/* Mostly like HW_COMPAT_2_9 except
1bdc94
+ * x-mtu-bypass-backend, x-migrate-msix has already been
1bdc94
+ * backported to RHEL7.4. shpc was already on in 7.4.
1bdc94
+ */
1bdc94
+#define HW_COMPAT_RHEL7_4 \
1bdc94
+    { /* HW_COMPAT_RHEL7_4 */ \
1bdc94
+        .driver   = "intel-iommu",\
1bdc94
+        .property = "pt",\
1bdc94
+        .value    = "off",\
1bdc94
+    },
1bdc94
+
4a2fec
 #endif /* HW_COMPAT_H */
4a2fec
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
1bdc94
index ffee841..faddeba 100644
4a2fec
--- a/include/hw/i386/pc.h
4a2fec
+++ b/include/hw/i386/pc.h
1bdc94
@@ -142,6 +142,9 @@ struct PCMachineClass {
1bdc94
 
1bdc94
     /* use DMA capable linuxboot option rom */
1bdc94
     bool linuxboot_dma_enabled;
1bdc94
+
1bdc94
+    /* RH only, see bz 1489800 */
1bdc94
+    bool pc_rom_ro;
1bdc94
 };
1bdc94
 
1bdc94
 #define TYPE_PC_MACHINE "generic-pc-machine"
1bdc94
@@ -947,4 +950,555 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
4a2fec
     type_init(pc_machine_init_##suffix)
4a2fec
 
4a2fec
 extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
4a2fec
+
4a2fec
+/* See include/hw/compat.h for shared compatibility lists */
4a2fec
+
4a2fec
+/* This macro is for changes to properties that are RHEL specific,
4a2fec
+ * different to the current upstream and to be applied to the latest
4a2fec
+ * machine type.
4a2fec
+ */
4a2fec
+#define PC_RHEL_COMPAT \
4a2fec
+        { /* PC_RHEL_COMPAT */ \
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "host-phys-bits",\
4a2fec
+            .value = "on",\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL_COMPAT bz 1508330 */ \
1bdc94
+            .driver = "vfio-pci",\
1bdc94
+            .property = "x-no-geforce-quirks",\
1bdc94
+            .value = "on",\
1bdc94
+        },
1bdc94
+
1bdc94
+#define PC_RHEL7_4_COMPAT \
1bdc94
+        HW_COMPAT_RHEL7_4 \
1bdc94
+        { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_9 */ \
1bdc94
+            .driver   = "mch",\
1bdc94
+            .property = "extended-tseg-mbytes",\
1bdc94
+            .value    = stringify(0),\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL7_4_COMPAT bz 1489800 */ \
1bdc94
+            .driver   = "ICH9-LPC",\
1bdc94
+            .property = "__com.redhat_force-rev1-fadt",\
1bdc94
+            .value    = "on",\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_10 */ \
1bdc94
+            .driver   = "i440FX-pcihost",\
1bdc94
+            .property = "x-pci-hole64-fix",\
1bdc94
+            .value    = "off",\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_10 */ \
1bdc94
+            .driver   = "q35-pcihost",\
1bdc94
+            .property = "x-pci-hole64-fix",\
1bdc94
+            .value    = "off",\
4a2fec
+        },
4a2fec
+
1bdc94
+
4a2fec
+#define PC_RHEL7_3_COMPAT \
4a2fec
+        HW_COMPAT_RHEL7_3 \
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_8 */ \
4a2fec
+             .driver   = "kvmclock",\
4a2fec
+             .property = "x-mach-use-reliable-get-clock",\
4a2fec
+             .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "l3-cache",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "full-cpuid-auto-level",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "family",\
4a2fec
+            .value    = "15",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "model",\
4a2fec
+            .value    = "6",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "stepping",\
4a2fec
+            .value    = "1",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_7 */ \
4a2fec
+            .driver   = "isa-pcspk",\
4a2fec
+            .property = "migrate",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_6 */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "cpuid-0xb",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_8 */ \
4a2fec
+            .driver   = "ICH9-LPC",\
4a2fec
+            .property = "x-smi-broadcast",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_8 */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "vmware-cpuid-freq",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_8 */ \
4a2fec
+            .driver   = "Haswell-" TYPE_X86_CPU,\
4a2fec
+            .property = "stepping",\
4a2fec
+            .value    = "1",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_3_COMPAT from PC_COMPAT_2_3 added in 2.9 */ \
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "kvm-no-smi-migration",\
4a2fec
+            .value    = "on",\
1bdc94
+        },\
1bdc94
+        { /* PC_RHEL7_4_COMPAT from PC_COMPAT_2_10 */ \
1bdc94
+             .driver   = TYPE_X86_CPU,\
1bdc94
+             .property = "x-hv-max-vps",\
1bdc94
+             .value    = "0x40",\
4a2fec
+        },
4a2fec
+
4a2fec
+#define PC_RHEL7_2_COMPAT \
4a2fec
+        HW_COMPAT_RHEL7_2 \
4a2fec
+	{\
4a2fec
+		.driver = "phenom" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "rdtscp",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "sse4a",\
4a2fec
+            .value    = "on",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "abm",\
4a2fec
+            .value    = "on",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "Haswell-" TYPE_X86_CPU,\
4a2fec
+            .property = "abm",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver   = "Haswell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "abm",\
1bdc94
+            .value    = "off",\
1bdc94
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "Haswell-noTSX-" TYPE_X86_CPU,\
4a2fec
+            .property = "abm",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver   = "Haswell-noTSX-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "abm",\
1bdc94
+            .value    = "off",\
1bdc94
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "Broadwell-" TYPE_X86_CPU,\
4a2fec
+            .property = "abm",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver   = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "abm",\
1bdc94
+            .value    = "off",\
1bdc94
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "Broadwell-noTSX-" TYPE_X86_CPU,\
4a2fec
+            .property = "abm",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
1bdc94
+        { /* PC_RHEL7_2_COMPAT (copied from the entry above) */ \
1bdc94
+            .driver   = "Broadwell-noTSX-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+            .property = "abm",\
1bdc94
+            .value    = "off",\
1bdc94
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "host" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "host-cache-info",\
4a2fec
+            .value    = "on",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "check",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "qemu32" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "popcnt",\
4a2fec
+            .value    = "on",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = TYPE_X86_CPU,\
4a2fec
+            .property = "arat",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "usb-redir",\
4a2fec
+            .property = "streams",\
4a2fec
+            .value    = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver = TYPE_X86_CPU,\
4a2fec
+            .property = "fill-mtrr-mask",\
4a2fec
+            .value = "off",\
4a2fec
+        },\
4a2fec
+        { /* PC_RHEL7_2_COMPAT */ \
4a2fec
+            .driver   = "apic-common",\
4a2fec
+            .property = "legacy-instance-id",\
4a2fec
+            .value    = "on",\
4a2fec
+        },
4a2fec
+
4a2fec
+
4a2fec
+
4a2fec
+#define PC_RHEL7_1_COMPAT \
4a2fec
+        HW_COMPAT_RHEL7_1 \
4a2fec
+	{\
4a2fec
+		.driver = "kvm64" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "kvm32" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Conroe" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Penryn" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Nehalem" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "vme",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "vme",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "SandyBridge" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "SandyBridge-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "vme",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Haswell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "vme",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "vme",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G1" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G2" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G4" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G5" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vme",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Haswell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "f16c",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "f16c",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Haswell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "rdrand",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Haswell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "rdrand",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "f16c",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "f16c",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "rdrand",\
4a2fec
+		.value = "off",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_1_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Broadwell-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "rdrand",\
1bdc94
+		.value = "off",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "coreduo" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vmx",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "core2duo" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "vmx",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+        { /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(4),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "kvm64" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(5),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "pentium3" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(2),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "n270" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(5),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Conroe" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(4),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Penryn" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(4),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Nehalem" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-level",\
4a2fec
+            .value    = stringify(4),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "n270" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Penryn" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Conroe" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Nehalem" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "SandyBridge" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "IvyBridge" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Haswell" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Haswell-noTSX" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Broadwell" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },{ /* PC_RHEL7_1_COMPAT */ \
4a2fec
+            .driver   = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
4a2fec
+            .property = "min-xlevel",\
4a2fec
+            .value    = stringify(0x8000000a),\
4a2fec
+        },
4a2fec
+
4a2fec
+/*
4a2fec
+ * The PC_RHEL_*_COMPAT serve the same purpose for RHEL-7 machine
4a2fec
+ * types as the PC_COMPAT_* do for upstream types.
4a2fec
+ * PC_RHEL_7_*_COMPAT apply both to i440fx and q35 types.
4a2fec
+ * PC_RHEL6_*_COMPAT apply to i440fx types only, and therefore live
4a2fec
+ * in pc_piix.c.
4a2fec
+ */
4a2fec
+
4a2fec
+/*
4a2fec
+ * RHEL-7 is based on QEMU 1.5.3, so this needs the PC_COMPAT_*
4a2fec
+ * between our base and 1.5, less stuff backported to RHEL-7.0
4a2fec
+ * (usb-device.msos-desc), less stuff for devices we changed
4a2fec
+ * (qemu64-x86_64-cpu) or don't support (hpet, pci-serial-2x,
4a2fec
+ * pci-serial-4x) in 7.0.
4a2fec
+ */
4a2fec
+#define PC_RHEL7_0_COMPAT \
4a2fec
+        {\
4a2fec
+            .driver   = "virtio-scsi-pci",\
4a2fec
+            .property = "any_layout",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "PIIX4_PM",\
4a2fec
+            .property = "memory-hotplug-support",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "apic",\
4a2fec
+            .property = "version",\
4a2fec
+            .value    = stringify(0x11),\
4a2fec
+        },{\
4a2fec
+            .driver   = "nec-usb-xhci",\
4a2fec
+            .property = "superspeed-ports-first",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "nec-usb-xhci",\
4a2fec
+            .property = "force-pcie-endcap",\
4a2fec
+            .value    = "on",\
4a2fec
+        },{\
4a2fec
+            .driver   = "pci-serial",\
4a2fec
+            .property = "prog_if",\
4a2fec
+            .value    = stringify(0),\
4a2fec
+        },{\
4a2fec
+            .driver   = "virtio-net-pci",\
4a2fec
+            .property = "guest_announce",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "ICH9-LPC",\
4a2fec
+            .property = "memory-hotplug-support",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "xio3130-downstream",\
4a2fec
+            .property = COMPAT_PROP_PCP,\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "ioh3420",\
4a2fec
+            .property = COMPAT_PROP_PCP,\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "PIIX4_PM",\
4a2fec
+            .property = "acpi-pci-hotplug-with-bridge-support",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{\
4a2fec
+            .driver   = "e1000",\
4a2fec
+            .property = "mitigation",\
4a2fec
+            .value    = "off",\
4a2fec
+        },{ \
4a2fec
+            .driver   = "virtio-net-pci", \
4a2fec
+            .property = "ctrl_guest_offloads", \
4a2fec
+            .value    = "off", \
4a2fec
+        },\
4a2fec
+	{\
4a2fec
+		.driver = "Conroe" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Penryn" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Nehalem" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_0_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Nehalem-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "x2apic",\
1bdc94
+		.value = "on",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Westmere" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
1bdc94
+	{ /* PC_RHEL7_0_COMPAT (copied from the entry above) */ \
1bdc94
+		.driver = "Westmere-IBRS" "-" TYPE_X86_CPU,\
1bdc94
+		.property = "x2apic",\
1bdc94
+		.value = "on",\
1bdc94
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G1" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G2" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G3" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G4" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},\
4a2fec
+	{\
4a2fec
+		.driver = "Opteron_G5" "-" TYPE_X86_CPU,\
4a2fec
+		.property = "x2apic",\
4a2fec
+		.value = "on",\
4a2fec
+	},
4a2fec
 #endif
1bdc94
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
1bdc94
index d60b7c6..5118af6 100644
1bdc94
--- a/include/hw/ppc/spapr.h
1bdc94
+++ b/include/hw/ppc/spapr.h
1bdc94
@@ -98,6 +98,7 @@ struct sPAPRMachineClass {
1bdc94
     bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
1bdc94
     bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
1bdc94
     bool pre_2_10_has_unused_icps;
1bdc94
+    bool has_power9_support;
1bdc94
     void (*phb_placement)(sPAPRMachineState *spapr, uint32_t index,
1bdc94
                           uint64_t *buid, hwaddr *pio, 
1bdc94
                           hwaddr *mmio32, hwaddr *mmio64,
4a2fec
diff --git a/include/hw/usb.h b/include/hw/usb.h
1bdc94
index a5080ad..5b3fb1f 100644
4a2fec
--- a/include/hw/usb.h
4a2fec
+++ b/include/hw/usb.h
1bdc94
@@ -606,4 +606,11 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
4a2fec
                    uint8_t interface_class, uint8_t interface_subclass,
4a2fec
                    uint8_t interface_protocol);
4a2fec
 
4a2fec
+
4a2fec
+/* hcd-uhci.c -- RHEL-6 machine type compatibility */
4a2fec
+extern bool ich9_uhci123_irqpin_override;
4a2fec
+
4a2fec
+/* hcd-xhci.c -- rhel7.0.0 machine type compatibility */
4a2fec
+extern bool migrate_cve_2014_5263_xhci_fields;
4a2fec
+
4a2fec
 #endif
4a2fec
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
1bdc94
index 098bdaa..41e13d2 100644
4a2fec
--- a/include/hw/virtio/virtio.h
4a2fec
+++ b/include/hw/virtio/virtio.h
4a2fec
@@ -95,6 +95,7 @@ struct VirtIODevice
4a2fec
     uint8_t device_endian;
4a2fec
     bool use_guest_notifier_mask;
4a2fec
     AddressSpace *dma_as;
4a2fec
+    bool rhel6_ctrl_guest_workaround;
4a2fec
     QLIST_HEAD(, VirtQueue) *vector_queues;
4a2fec
 };
4a2fec
 
4a2fec
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
1bdc94
index 2b42151..5832c38 100644
4a2fec
--- a/include/sysemu/sysemu.h
4a2fec
+++ b/include/sysemu/sysemu.h
1bdc94
@@ -94,6 +94,8 @@ void qemu_add_machine_init_done_notifier(Notifier *notify);
4a2fec
 void qemu_remove_machine_init_done_notifier(Notifier *notify);
4a2fec
 
4a2fec
 void qemu_announce_self(void);
4a2fec
+extern bool shadow_bios_after_incoming;
4a2fec
+void shadow_bios(void);
4a2fec
 
4a2fec
 extern int autostart;
4a2fec
 
4a2fec
diff --git a/migration/migration.c b/migration/migration.c
1bdc94
index 52a5092..ceb1697 100644
4a2fec
--- a/migration/migration.c
4a2fec
+++ b/migration/migration.c
1bdc94
@@ -99,6 +99,8 @@ enum mig_rp_message_type {
4a2fec
     MIG_RP_MSG_MAX
4a2fec
 };
4a2fec
 
4a2fec
+bool migrate_pre_2_2;
4a2fec
+
4a2fec
 /* When we add fault tolerance, we could have several
4a2fec
    migrations at once.  For now we don't need to add
4a2fec
    dynamic creation of migration */
4a2fec
diff --git a/migration/migration.h b/migration/migration.h
1bdc94
index 8d2f320..06833d7 100644
4a2fec
--- a/migration/migration.h
4a2fec
+++ b/migration/migration.h
1bdc94
@@ -241,5 +241,10 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
4a2fec
 
1bdc94
 void dirty_bitmap_mig_before_vm_start(void);
1bdc94
 void init_dirty_bitmap_incoming_migration(void);
4a2fec
+/*
4a2fec
+ * Disables a load of subsections that were added in 2.2/rh7.2 for backwards
4a2fec
+ * migration compatibility.
4a2fec
+ */
4a2fec
+extern bool migrate_pre_2_2;
1bdc94
 
4a2fec
 #endif
4a2fec
diff --git a/migration/savevm.c b/migration/savevm.c
1bdc94
index e2be02a..56c9feb 100644
4a2fec
--- a/migration/savevm.c
4a2fec
+++ b/migration/savevm.c
1bdc94
@@ -45,6 +45,7 @@
1bdc94
 #include "qapi/qapi-commands-misc.h"
4a2fec
 #include "qapi/qmp/qerror.h"
4a2fec
 #include "qemu/error-report.h"
4a2fec
+#include "qemu/rcu_queue.h"
4a2fec
 #include "sysemu/cpus.h"
4a2fec
 #include "exec/memory.h"
4a2fec
 #include "exec/target_page.h"
1bdc94
@@ -83,6 +84,7 @@ enum qemu_vm_cmd {
4a2fec
     MIG_CMD_PACKAGED,          /* Send a wrapped stream within this stream */
4a2fec
     MIG_CMD_MAX
4a2fec
 };
4a2fec
+bool shadow_bios_after_incoming;
4a2fec
 
1bdc94
 #define MAX_VM_CMD_PACKAGED_SIZE UINT32_MAX
4a2fec
 static struct mig_cmd_args {
1bdc94
@@ -2204,6 +2206,13 @@ int qemu_loadvm_state(QEMUFile *f)
4a2fec
     }
4a2fec
 
4a2fec
     qemu_loadvm_state_cleanup();
4a2fec
+    /* Supplement SeaBIOS's shadowing now, because it was useless when the
4a2fec
+     * incoming VM started on the RHEL-6 emulator.
4a2fec
+     */
4a2fec
+    if (shadow_bios_after_incoming) {
4a2fec
+        shadow_bios();
4a2fec
+    }
4a2fec
+
4a2fec
     cpu_synchronize_all_post_init();
4a2fec
 
4a2fec
     return ret;
4a2fec
diff --git a/numa.c b/numa.c
1bdc94
index 1116c90..daf10d8 100644
4a2fec
--- a/numa.c
4a2fec
+++ b/numa.c
1bdc94
@@ -493,6 +493,19 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
4a2fec
         return;
4a2fec
     }
4a2fec
 
4a2fec
+    /* The shadow_bios_after_incoming hack at savevm.c:shadow_bios() is not
4a2fec
+     * able to handle the multiple memory blocks added when using NUMA
4a2fec
+     * memdevs. We can disallow -numa memdev= when using rhel6.* machine-types
4a2fec
+     * because RHEL-6 didn't support the NUMA memdev option.
4a2fec
+     */
4a2fec
+    if (shadow_bios_after_incoming) {
4a2fec
+        MachineClass *mc;
4a2fec
+        mc = MACHINE_GET_CLASS(current_machine);
4a2fec
+        error_report("-numa memdev is not supported by machine %s",
4a2fec
+                     mc->name);
4a2fec
+        exit(1);
4a2fec
+    }
4a2fec
+
4a2fec
     memory_region_init(mr, owner, name, ram_size);
1bdc94
     for (i = 0; i < nb_numa_nodes; i++) {
4a2fec
         uint64_t size = numa_info[i].node_mem;
4a2fec
diff --git a/qdev-monitor.c b/qdev-monitor.c
1bdc94
index 61e0300..f439b83 100644
4a2fec
--- a/qdev-monitor.c
4a2fec
+++ b/qdev-monitor.c
1bdc94
@@ -47,7 +47,6 @@ typedef struct QDevAlias
4a2fec
 
4a2fec
 /* Please keep this table sorted by typename. */
4a2fec
 static const QDevAlias qdev_alias_table[] = {
4a2fec
-    { "e1000", "e1000-82540em" },
4a2fec
     { "ich9-ahci", "ahci" },
4a2fec
     { "lsi53c895a", "lsi" },
1bdc94
     { "virtio-9p-ccw", "virtio-9p", QEMU_ARCH_S390X },
4a2fec
diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py
4a2fec
index bcef7ee..ffb13d1 100755
4a2fec
--- a/scripts/vmstate-static-checker.py
4a2fec
+++ b/scripts/vmstate-static-checker.py
4a2fec
@@ -104,7 +104,6 @@ def get_changed_sec_name(sec):
4a2fec
     # Section names can change -- see commit 292b1634 for an example.
4a2fec
     changes = {
4a2fec
         "ICH9 LPC": "ICH9-LPC",
4a2fec
-        "e1000-82540em": "e1000",
4a2fec
     }
4a2fec
 
4a2fec
     for item in changes:
4a2fec
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
1bdc94
index dfdfca7..8f111c5 100644
4a2fec
--- a/stubs/Makefile.objs
4a2fec
+++ b/stubs/Makefile.objs
1bdc94
@@ -44,3 +44,4 @@ stub-obj-y += xen-hvm.o
1bdc94
 stub-obj-y += pci-host-piix.o
1bdc94
 stub-obj-y += ram-block.o
1bdc94
 stub-obj-y += ide-isa.o
4a2fec
+stub-obj-y += shadow-bios.o
4a2fec
diff --git a/stubs/shadow-bios.c b/stubs/shadow-bios.c
4a2fec
new file mode 100644
4a2fec
index 0000000..c77cd7a
4a2fec
--- /dev/null
4a2fec
+++ b/stubs/shadow-bios.c
4a2fec
@@ -0,0 +1,7 @@
4a2fec
+#include "qemu/osdep.h"
4a2fec
+#include "sysemu/sysemu.h"
4a2fec
+
4a2fec
+void shadow_bios(void)
4a2fec
+{
4a2fec
+  abort();
4a2fec
+}
4a2fec
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
1bdc94
index f483a71..a9db495 100644
4a2fec
--- a/target/i386/cpu.c
4a2fec
+++ b/target/i386/cpu.c
1bdc94
@@ -819,11 +819,17 @@ struct X86CPUDefinition {
4a2fec
 
4a2fec
 static X86CPUDefinition builtin_x86_defs[] = {
4a2fec
     {
4a2fec
+        /* qemu64 is the default CPU model for all *-rhel7.* machine-types.
4a2fec
+         * The default on RHEL-6 was cpu64-rhel6.
4a2fec
+         * libvirt assumes that qemu64 is the default for _all_ machine-types,
4a2fec
+         * so we should try to keep qemu64 and cpu64-rhel6 as similar as
4a2fec
+         * possible.
4a2fec
+         */
4a2fec
         .name = "qemu64",
4a2fec
         .level = 0xd,
4a2fec
         .vendor = CPUID_VENDOR_AMD,
4a2fec
         .family = 6,
4a2fec
-        .model = 6,
4a2fec
+        .model = 13,
4a2fec
         .stepping = 3,
1bdc94
         .features[FEAT_1_EDX] = CPUID_SSE2 | CPUID_SSE | CPUID_FXSR |
1bdc94
             CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV |
1bdc94
@@ -2097,6 +2103,7 @@ static PropValue kvm_default_props[] = {
4a2fec
     { "acpi", "off" },
4a2fec
     { "monitor", "off" },
4a2fec
     { "svm", "off" },
4a2fec
+    { "kvm-pv-unhalt", "on" },
4a2fec
     { NULL, NULL },
4a2fec
 };
4a2fec
 
4a2fec
diff --git a/target/i386/machine.c b/target/i386/machine.c
1bdc94
index bd2d82e..c9a3b5c 100644
4a2fec
--- a/target/i386/machine.c
4a2fec
+++ b/target/i386/machine.c
1bdc94
@@ -893,6 +893,26 @@ static const VMStateDescription vmstate_msr_intel_pt = {
4a2fec
     }
4a2fec
 };
4a2fec
 
4a2fec
+static bool vmstate_xsave_needed(void *opaque)
4a2fec
+{
4a2fec
+    /* The xsave state is already on the main "cpu" section */
4a2fec
+    return false;
4a2fec
+}
4a2fec
+
4a2fec
+static const VMStateDescription vmstate_xsave ={
4a2fec
+    .name = "cpu/xsave",
4a2fec
+    .version_id = 1,
4a2fec
+    .minimum_version_id = 1,
4a2fec
+    .minimum_version_id_old = 1,
4a2fec
+    .needed = vmstate_xsave_needed,
4a2fec
+    .fields      = (VMStateField []) {
4a2fec
+    VMSTATE_UINT64_V(env.xcr0, X86CPU, 1),
4a2fec
+    VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 1),
4a2fec
+    VMSTATE_YMMH_REGS_VARS(env.xmm_regs, X86CPU, CPU_NB_REGS, 1),
4a2fec
+    VMSTATE_END_OF_LIST()
4a2fec
+    }
4a2fec
+};
4a2fec
+
4a2fec
 VMStateDescription vmstate_x86_cpu = {
4a2fec
     .name = "cpu",
4a2fec
     .version_id = 12,
1bdc94
@@ -1015,6 +1035,7 @@ VMStateDescription vmstate_x86_cpu = {
1bdc94
         &vmstate_spec_ctrl,
4a2fec
         &vmstate_mcg_ext_ctl,
1bdc94
         &vmstate_msr_intel_pt,
4a2fec
+        &vmstate_xsave,
4a2fec
         NULL
4a2fec
     }
4a2fec
 };
1bdc94
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
1bdc94
index 807c906..33658fb 100644
1bdc94
--- a/target/ppc/compat.c
1bdc94
+++ b/target/ppc/compat.c
1bdc94
@@ -105,6 +105,17 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr)
1bdc94
     return NULL;
1bdc94
 }
1bdc94
 
1bdc94
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2)
1bdc94
+{
1bdc94
+    const CompatInfo *compat1 = compat_by_pvr(pvr1);
1bdc94
+    const CompatInfo *compat2 = compat_by_pvr(pvr2);
1bdc94
+
1bdc94
+    g_assert(compat1);
1bdc94
+    g_assert(compat2);
1bdc94
+
1bdc94
+    return compat1 - compat2;
1bdc94
+}
1bdc94
+
1bdc94
 bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
1bdc94
                       uint32_t min_compat_pvr, uint32_t max_compat_pvr)
1bdc94
 {
1bdc94
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
1bdc94
index c621a6b..1932c2e 100644
1bdc94
--- a/target/ppc/cpu.h
1bdc94
+++ b/target/ppc/cpu.h
1bdc94
@@ -1391,6 +1391,7 @@ static inline int cpu_mmu_index (CPUPPCState *env, bool ifetch)
1bdc94
 
1bdc94
 /* Compatibility modes */
1bdc94
 #if defined(TARGET_PPC64)
1bdc94
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2);
1bdc94
 bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
1bdc94
                       uint32_t min_compat_pvr, uint32_t max_compat_pvr);
1bdc94
 void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp);
1bdc94
diff --git a/tests/Makefile.include b/tests/Makefile.include
1bdc94
index e4125a6..5cb1902 100644
1bdc94
--- a/tests/Makefile.include
1bdc94
+++ b/tests/Makefile.include
1bdc94
@@ -310,14 +310,14 @@ check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
1bdc94
 #check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
1bdc94
 check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
1bdc94
 check-qtest-ppc-y += tests/boot-serial-test$(EXESUF)
1bdc94
-check-qtest-ppc-y += tests/m48t59-test$(EXESUF)
1bdc94
-gcov-files-ppc-y += hw/timer/m48t59.c
1bdc94
+#check-qtest-ppc-y += tests/m48t59-test$(EXESUF)
1bdc94
+#gcov-files-ppc-y += hw/timer/m48t59.c
1bdc94
 
1bdc94
 check-qtest-ppc64-y = $(check-qtest-ppc-y)
1bdc94
 gcov-files-ppc64-y = $(subst ppc-softmmu/,ppc64-softmmu/,$(gcov-files-ppc-y))
1bdc94
 check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF)
1bdc94
 gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c
1bdc94
-check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF)
1bdc94
+#check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF)
1bdc94
 check-qtest-ppc64-y += tests/migration-test$(EXESUF)
1bdc94
 check-qtest-ppc64-y += tests/rtas-test$(EXESUF)
1bdc94
 check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
1bdc94
@@ -733,7 +733,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt
1bdc94
 tests/qmp-test$(EXESUF): tests/qmp-test.o
1bdc94
 tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
1bdc94
 tests/rtc-test$(EXESUF): tests/rtc-test.o
1bdc94
-tests/m48t59-test$(EXESUF): tests/m48t59-test.o
1bdc94
+#tests/m48t59-test$(EXESUF): tests/m48t59-test.o
1bdc94
 tests/endianness-test$(EXESUF): tests/endianness-test.o
1bdc94
 tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y)
1bdc94
 #tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y)
1bdc94
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
1bdc94
index 8b5ab1f..112869b 100644
1bdc94
--- a/tests/cpu-plug-test.c
1bdc94
+++ b/tests/cpu-plug-test.c
1bdc94
@@ -192,7 +192,8 @@ static void add_pseries_test_case(const char *mname)
1bdc94
     PlugTestData *data;
1bdc94
 
1bdc94
     if (!g_str_has_prefix(mname, "pseries-") ||
1bdc94
-        (g_str_has_prefix(mname, "pseries-2.") && atoi(&mname[10]) < 7)) {
1bdc94
+        (g_str_has_prefix(mname, "pseries-2.") && atoi(&mname[10]) < 7) ||
1bdc94
+        strcmp(mname,"pseries-rhel7.2.0") == 0) {
1bdc94
         return;
1bdc94
     }
1bdc94
     data = g_new(PlugTestData, 1);
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec