ddf19c
From 113078b23a4747b07eb363719d7cbc0af403dd2a Mon Sep 17 00:00:00 2001
ddf19c
From: Miroslav Rezanina <mrezanin@redhat.com>
ddf19c
Date: Fri, 11 Jan 2019 09:54:45 +0100
ddf19c
Subject: Machine type related general changes
ddf19c
ddf19c
This patch is first part of original "Add RHEL machine types" patch we
ddf19c
split to allow easier review. It contains changes not related to any
ddf19c
architecture.
ddf19c
ddf19c
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ddf19c
ddf19c
Rebase changes (4.0.0):
ddf19c
- Remove e1000 device duplication changes to reflect upstream solution
ddf19c
- Rewrite machine compat properties to upstream solution
ddf19c
ddf19c
Rebase changes (4.1.0):
ddf19c
- Removed optional flag for machine compat properties (upstream)
ddf19c
- Remove c3e002cb chunk from hw/net/e1000.c
ddf19c
- Reorder compat structures
ddf19c
- Use one format for compat scructures
ddf19c
- Added compat for virtio-balloon-pci.any_layout for rhel71
ddf19c
ddf19c
Merged patches (4.0.0):
ddf19c
- d4c0957 compat: Generic HW_COMPAT_RHEL7_6
ddf19c
- cbac773 virtio: Make disable-legacy/disable-modern compat properties optional
ddf19c
ddf19c
Merged patches (4.1.0):
ddf19c
- 479ad30 redhat: fix cut'n'paste garbage in hw_compat comments
ddf19c
- f19738e compat: Generic hw_compat_rhel_8_0
ddf19c
ddf19c
Merged patches (4.2.0):
ddf19c
- 9f2bfaa machine types: Update hw_compat_rhel_8_0 from hw_compat_4_0
ddf19c
- ca4a5e8 virtio: Make disable-legacy/disable-modern compat properties optional
ddf19c
- compat: Generic hw_compat_rhel_8_1 (patch 93040/92956)
ddf19c
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/acpi/ich9.c          |  16 ++++
ddf19c
 hw/acpi/piix4.c         |   5 +-
ddf19c
 hw/char/serial.c        |  16 ++++
ddf19c
 hw/core/machine.c       | 170 ++++++++++++++++++++++++++++++++++++++++
ddf19c
 hw/display/vga-isa.c    |   2 +-
ddf19c
 hw/net/e1000e.c         |  21 +++++
ddf19c
 hw/net/rtl8139.c        |   4 +-
ddf19c
 hw/rtc/mc146818rtc.c    |   6 ++
ddf19c
 hw/smbios/smbios.c      |   1 +
ddf19c
 hw/timer/i8254_common.c |   2 +-
ddf19c
 hw/usb/hcd-uhci.c       |   4 +-
ddf19c
 hw/usb/hcd-xhci.c       |  20 +++++
ddf19c
 hw/usb/hcd-xhci.h       |   2 +
ddf19c
 include/hw/acpi/ich9.h  |   3 +
ddf19c
 include/hw/boards.h     |  24 ++++++
ddf19c
 include/hw/usb.h        |   4 +
ddf19c
 migration/migration.c   |   2 +
ddf19c
 migration/migration.h   |   5 ++
ddf19c
 18 files changed, 301 insertions(+), 6 deletions(-)
ddf19c
ddf19c
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
ddf19c
index ab203ad448..7ec26884e8 100644
ddf19c
--- a/hw/acpi/ich9.c
ddf19c
+++ b/hw/acpi/ich9.c
ddf19c
@@ -444,6 +444,18 @@ static void ich9_pm_set_enable_tco(Object *obj, bool value, Error **errp)
ddf19c
     s->pm.enable_tco = value;
ddf19c
 }
ddf19c
 
ddf19c
+static bool ich9_pm_get_force_rev1_fadt(Object *obj, Error **errp)
ddf19c
+{
ddf19c
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
ddf19c
+    return s->pm.force_rev1_fadt;
ddf19c
+}
ddf19c
+
ddf19c
+static void ich9_pm_set_force_rev1_fadt(Object *obj, bool value, Error **errp)
ddf19c
+{
ddf19c
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
ddf19c
+    s->pm.force_rev1_fadt = value;
ddf19c
+}
ddf19c
+
ddf19c
 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
ddf19c
 {
ddf19c
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
ddf19c
@@ -468,6 +480,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
ddf19c
                              ich9_pm_get_cpu_hotplug_legacy,
ddf19c
                              ich9_pm_set_cpu_hotplug_legacy,
ddf19c
                              NULL);
ddf19c
+    object_property_add_bool(obj, "__com.redhat_force-rev1-fadt",
ddf19c
+                             ich9_pm_get_force_rev1_fadt,
ddf19c
+                             ich9_pm_set_force_rev1_fadt,
ddf19c
+                             NULL);
ddf19c
     object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8",
ddf19c
                         ich9_pm_get_disable_s3,
ddf19c
                         ich9_pm_set_disable_s3,
ddf19c
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
ddf19c
index 93aec2dd2c..3a26193cbe 100644
ddf19c
--- a/hw/acpi/piix4.c
ddf19c
+++ b/hw/acpi/piix4.c
ddf19c
@@ -274,6 +274,7 @@ static const VMStateDescription vmstate_acpi = {
ddf19c
     .name = "piix4_pm",
ddf19c
     .version_id = 3,
ddf19c
     .minimum_version_id = 3,
ddf19c
+    .minimum_version_id = 2,
ddf19c
     .post_load = vmstate_acpi_post_load,
ddf19c
     .fields = (VMStateField[]) {
ddf19c
         VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
ddf19c
@@ -627,8 +628,8 @@ static void piix4_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
ddf19c
 
ddf19c
 static Property piix4_pm_properties[] = {
ddf19c
     DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
ddf19c
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
ddf19c
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0),
ddf19c
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 1),
ddf19c
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 1),
ddf19c
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
ddf19c
     DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState,
ddf19c
                      use_acpi_pci_hotplug, true),
ddf19c
diff --git a/hw/char/serial.c b/hw/char/serial.c
ddf19c
index b4aa250950..0012f0e44d 100644
ddf19c
--- a/hw/char/serial.c
ddf19c
+++ b/hw/char/serial.c
ddf19c
@@ -34,6 +34,7 @@
ddf19c
 #include "sysemu/runstate.h"
ddf19c
 #include "qemu/error-report.h"
ddf19c
 #include "trace.h"
ddf19c
+#include "migration/migration.h"
ddf19c
 
ddf19c
 //#define DEBUG_SERIAL
ddf19c
 
ddf19c
@@ -703,6 +704,9 @@ static int serial_post_load(void *opaque, int version_id)
ddf19c
 static bool serial_thr_ipending_needed(void *opaque)
ddf19c
 {
ddf19c
     SerialState *s = opaque;
ddf19c
+    if (migrate_pre_2_2) {
ddf19c
+        return false;
ddf19c
+    }
ddf19c
 
ddf19c
     if (s->ier & UART_IER_THRI) {
ddf19c
         bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
ddf19c
@@ -784,6 +788,10 @@ static const VMStateDescription vmstate_serial_xmit_fifo = {
ddf19c
 static bool serial_fifo_timeout_timer_needed(void *opaque)
ddf19c
 {
ddf19c
     SerialState *s = (SerialState *)opaque;
ddf19c
+    if (migrate_pre_2_2) {
ddf19c
+        return false;
ddf19c
+    }
ddf19c
+
ddf19c
     return timer_pending(s->fifo_timeout_timer);
ddf19c
 }
ddf19c
 
ddf19c
@@ -801,6 +809,10 @@ static const VMStateDescription vmstate_serial_fifo_timeout_timer = {
ddf19c
 static bool serial_timeout_ipending_needed(void *opaque)
ddf19c
 {
ddf19c
     SerialState *s = (SerialState *)opaque;
ddf19c
+    if (migrate_pre_2_2) {
ddf19c
+        return false;
ddf19c
+    }
ddf19c
+
ddf19c
     return s->timeout_ipending != 0;
ddf19c
 }
ddf19c
 
ddf19c
@@ -818,6 +830,10 @@ static const VMStateDescription vmstate_serial_timeout_ipending = {
ddf19c
 static bool serial_poll_needed(void *opaque)
ddf19c
 {
ddf19c
     SerialState *s = (SerialState *)opaque;
ddf19c
+    if (migrate_pre_2_2) {
ddf19c
+        return false;
ddf19c
+    }
ddf19c
+
ddf19c
     return s->poll_msl >= 0;
ddf19c
 }
ddf19c
 
ddf19c
diff --git a/hw/core/machine.c b/hw/core/machine.c
ddf19c
index 1689ad3bf8..e0e0eec8bf 100644
ddf19c
--- a/hw/core/machine.c
ddf19c
+++ b/hw/core/machine.c
ddf19c
@@ -27,6 +27,176 @@
ddf19c
 #include "hw/pci/pci.h"
ddf19c
 #include "hw/mem/nvdimm.h"
ddf19c
 
ddf19c
+/*
ddf19c
+ * The same as hw_compat_4_1
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_8_1[] = {
ddf19c
+    /* hw_compat_rhel_8_1 from hw_compat_4_1 */
ddf19c
+    { "virtio-pci", "x-pcie-flr-init", "off" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_8_1_len = G_N_ELEMENTS(hw_compat_rhel_8_1);
ddf19c
+
ddf19c
+/* The same as hw_compat_3_1
ddf19c
+ * format of array has been changed by:
ddf19c
+ *     6c36bddf5340 ("machine: Use shorter format for GlobalProperty arrays")
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_8_0[] = {
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "pcie-root-port", "x-speed", "2_5" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "pcie-root-port", "x-width", "1" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "tpm-crb", "ppi", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "tpm-tis", "ppi", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "usb-kbd", "serial", "42" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "usb-mouse", "serial", "42" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "usb-tablet", "serial", "42" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "virtio-blk-device", "discard", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
ddf19c
+    { "virtio-blk-device", "write-zeroes", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "VGA",            "edid", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "secondary-vga",  "edid", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "bochs-display",  "edid", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "virtio-vga",     "edid", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "virtio-gpu-pci", "edid", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
ddf19c
+    { "virtio-device", "use-started", "false" },
ddf19c
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */
ddf19c
+    { "pcie-root-port-base", "disable-acs", "true" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_8_0_len = G_N_ELEMENTS(hw_compat_rhel_8_0);
ddf19c
+
ddf19c
+/* The same as hw_compat_3_0 + hw_compat_2_12
ddf19c
+ * except that
ddf19c
+ *   there's nothing in 3_0
ddf19c
+ *   migration.decompress-error-check=off was in 7.5 from bz 1584139
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_7_6[] = {
ddf19c
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
ddf19c
+    { "hda-audio", "use-timer", "false" },
ddf19c
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
ddf19c
+    { "cirrus-vga", "global-vmstate", "true" },
ddf19c
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
ddf19c
+    { "VGA", "global-vmstate", "true" },
ddf19c
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
ddf19c
+    { "vmware-svga", "global-vmstate", "true" },
ddf19c
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
ddf19c
+    { "qxl-vga", "global-vmstate",  "true" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_7_6_len = G_N_ELEMENTS(hw_compat_rhel_7_6);
ddf19c
+
ddf19c
+/* The same as hw_compat_2_11 + hw_compat_2_10 */
ddf19c
+GlobalProperty hw_compat_rhel_7_5[] = {
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_11 */
ddf19c
+    { "hpet", "hpet-offset-saved", "false" },
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_11 */
ddf19c
+    { "virtio-blk-pci", "vectors", "2" },
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_11 */
ddf19c
+    { "vhost-user-blk-pci", "vectors", "2" },
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_11
ddf19c
+       bz 1608778 modified for our naming */
ddf19c
+    { "e1000-82540em", "migrate_tso_props", "off" },
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_10 */
ddf19c
+    { "virtio-mouse-device", "wheel-axis", "false" },
ddf19c
+    /* hw_compat_rhel_7_5 from hw_compat_2_10 */
ddf19c
+    { "virtio-tablet-device", "wheel-axis", "false" },
ddf19c
+    { "cirrus-vga", "vgamem_mb", "16" },
ddf19c
+    { "migration", "decompress-error-check", "off" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_7_5_len = G_N_ELEMENTS(hw_compat_rhel_7_5);
ddf19c
+
ddf19c
+/* Mostly like hw_compat_2_9 except
ddf19c
+ * x-mtu-bypass-backend, x-migrate-msix has already been
ddf19c
+ * backported to RHEL7.4. shpc was already on in 7.4.
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_7_4[] = {
ddf19c
+    { "intel-iommu", "pt", "off" },
ddf19c
+};
ddf19c
+
ddf19c
+const size_t hw_compat_rhel_7_4_len = G_N_ELEMENTS(hw_compat_rhel_7_4);
ddf19c
+/* Mostly like HW_COMPAT_2_6 + HW_COMPAT_2_7 + HW_COMPAT_2_8 except
ddf19c
+ * disable-modern, disable-legacy, page-per-vq have already been
ddf19c
+ * backported to RHEL7.3
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_7_3[] = {
ddf19c
+    { "virtio-mmio", "format_transport_address", "off" },
ddf19c
+    { "virtio-serial-device", "emergency-write", "off" },
ddf19c
+    { "ioapic", "version", "0x11" },
ddf19c
+    { "intel-iommu", "x-buggy-eim", "true" },
ddf19c
+    { "virtio-pci", "x-ignore-backend-features", "on" },
ddf19c
+    { "fw_cfg_mem", "x-file-slots", stringify(0x10) },
ddf19c
+    { "fw_cfg_io", "x-file-slots", stringify(0x10) },
ddf19c
+    { "pflash_cfi01", "old-multiple-chip-handling", "on" },
ddf19c
+    { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" },
ddf19c
+    { "virtio-pci", "x-pcie-deverr-init", "off" },
ddf19c
+    { "virtio-pci", "x-pcie-lnkctl-init", "off" },
ddf19c
+    { "virtio-pci", "x-pcie-pm-init", "off" },
ddf19c
+    { "virtio-net-device", "x-mtu-bypass-backend", "off" },
ddf19c
+    { "e1000e", "__redhat_e1000e_7_3_intr_state", "on" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_7_3_len = G_N_ELEMENTS(hw_compat_rhel_7_3);
ddf19c
+
ddf19c
+/* Mostly like hw_compat_2_4 + 2_3 but:
ddf19c
+ *  we don't need "any_layout" as it has been backported to 7.2
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_7_2[] = {
ddf19c
+        { "virtio-blk-device", "scsi", "true" },
ddf19c
+        { "e1000-82540em", "extra_mac_registers", "off" },
ddf19c
+        { "virtio-pci", "x-disable-pcie", "on" },
ddf19c
+        { "virtio-pci", "migrate-extra", "off" },
ddf19c
+        { "fw_cfg_mem", "dma_enabled", "off" },
ddf19c
+        { "fw_cfg_io", "dma_enabled", "off" },
ddf19c
+        { "isa-fdc", "fallback", "144" },
ddf19c
+        /* Optional because not all virtio-pci devices support legacy mode */
ddf19c
+        { "virtio-pci", "disable-modern", "on", .optional = true },
ddf19c
+        { "virtio-pci", "disable-legacy", "off", .optional = true },
ddf19c
+        { TYPE_PCI_DEVICE, "x-pcie-lnksta-dllla", "off" },
ddf19c
+        { "virtio-pci", "page-per-vq", "on" },
ddf19c
+        /* hw_compat_rhel_7_2 - introduced with 2.10.0 */
ddf19c
+        { "migration", "send-section-footer", "off" },
ddf19c
+        /* hw_compat_rhel_7_2 - introduced with 2.10.0 */
ddf19c
+        { "migration", "store-global-state", "off",
ddf19c
+        },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_7_2_len = G_N_ELEMENTS(hw_compat_rhel_7_2);
ddf19c
+
ddf19c
+/* Mostly like hw_compat_2_1 but:
ddf19c
+ *    we don't need virtio-scsi-pci since 7.0 already had that on
ddf19c
+ *
ddf19c
+ * RH: Note, qemu-extended-regs should have been enabled in the 7.1
ddf19c
+ * machine type, but was accidentally turned off in 7.2 onwards.
ddf19c
+ */
ddf19c
+GlobalProperty hw_compat_rhel_7_1[] = {
ddf19c
+    { "intel-hda-generic", "old_msi_addr", "on" },
ddf19c
+    { "VGA", "qemu-extended-regs", "off" },
ddf19c
+    { "secondary-vga", "qemu-extended-regs", "off" },
ddf19c
+    { "usb-mouse", "usb_version", stringify(1) },
ddf19c
+    { "usb-kbd", "usb_version", stringify(1) },
ddf19c
+    { "virtio-pci",  "virtio-pci-bus-master-bug-migration", "on" },
ddf19c
+    { "virtio-blk-pci", "any_layout", "off" },
ddf19c
+    { "virtio-balloon-pci", "any_layout", "off" },
ddf19c
+    { "virtio-serial-pci", "any_layout", "off" },
ddf19c
+    { "virtio-9p-pci", "any_layout", "off" },
ddf19c
+    { "virtio-rng-pci", "any_layout", "off" },
ddf19c
+    /* HW_COMPAT_RHEL7_1 - introduced with 2.10.0 */
ddf19c
+    { "migration", "send-configuration", "off" },
ddf19c
+};
ddf19c
+const size_t hw_compat_rhel_7_1_len = G_N_ELEMENTS(hw_compat_rhel_7_1);
ddf19c
+
ddf19c
 GlobalProperty hw_compat_4_1[] = {
ddf19c
     { "virtio-pci", "x-pcie-flr-init", "off" },
ddf19c
 };
ddf19c
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
ddf19c
index 873e5e9706..d1a2efe47e 100644
ddf19c
--- a/hw/display/vga-isa.c
ddf19c
+++ b/hw/display/vga-isa.c
ddf19c
@@ -82,7 +82,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
ddf19c
 }
ddf19c
 
ddf19c
 static Property vga_isa_properties[] = {
ddf19c
-    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
ddf19c
+    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 16),
ddf19c
     DEFINE_PROP_END_OF_LIST(),
ddf19c
 };
ddf19c
 
ddf19c
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
ddf19c
index b69fd7d8ad..d8be50a1ce 100644
ddf19c
--- a/hw/net/e1000e.c
ddf19c
+++ b/hw/net/e1000e.c
ddf19c
@@ -79,6 +79,11 @@ typedef struct E1000EState {
ddf19c
 
ddf19c
     E1000ECore core;
ddf19c
 
ddf19c
+    /* 7.3 had the intr_state field that was in the original e1000e code
ddf19c
+     * but that was removed prior to 2.7's release
ddf19c
+     */
ddf19c
+    bool redhat_7_3_intr_state_enable;
ddf19c
+    uint32_t redhat_7_3_intr_state;
ddf19c
 } E1000EState;
ddf19c
 
ddf19c
 #define E1000E_MMIO_IDX     0
ddf19c
@@ -94,6 +99,10 @@ typedef struct E1000EState {
ddf19c
 #define E1000E_MSIX_TABLE   (0x0000)
ddf19c
 #define E1000E_MSIX_PBA     (0x2000)
ddf19c
 
ddf19c
+/* Values as in RHEL 7.3 build and original upstream */
ddf19c
+#define RH_E1000E_USE_MSI     BIT(0)
ddf19c
+#define RH_E1000E_USE_MSIX    BIT(1)
ddf19c
+
ddf19c
 static uint64_t
ddf19c
 e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size)
ddf19c
 {
ddf19c
@@ -305,6 +314,8 @@ e1000e_init_msix(E1000EState *s)
ddf19c
     } else {
ddf19c
         if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) {
ddf19c
             msix_uninit(d, &s->msix, &s->msix);
ddf19c
+        } else {
ddf19c
+            s->redhat_7_3_intr_state |= RH_E1000E_USE_MSIX;
ddf19c
         }
ddf19c
     }
ddf19c
 }
ddf19c
@@ -476,6 +487,8 @@ static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp)
ddf19c
     ret = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL);
ddf19c
     if (ret) {
ddf19c
         trace_e1000e_msi_init_fail(ret);
ddf19c
+    } else {
ddf19c
+        s->redhat_7_3_intr_state |= RH_E1000E_USE_MSI;
ddf19c
     }
ddf19c
 
ddf19c
     if (e1000e_add_pm_capability(pci_dev, e1000e_pmrb_offset,
ddf19c
@@ -599,6 +612,11 @@ static const VMStateDescription e1000e_vmstate_intr_timer = {
ddf19c
     VMSTATE_STRUCT_ARRAY(_f, _s, _num, 0,                           \
ddf19c
                          e1000e_vmstate_intr_timer, E1000IntrDelayTimer)
ddf19c
 
ddf19c
+static bool rhel_7_3_check(void *opaque, int version_id)
ddf19c
+{
ddf19c
+    return ((E1000EState *)opaque)->redhat_7_3_intr_state_enable;
ddf19c
+}
ddf19c
+
ddf19c
 static const VMStateDescription e1000e_vmstate = {
ddf19c
     .name = "e1000e",
ddf19c
     .version_id = 1,
ddf19c
@@ -610,6 +628,7 @@ static const VMStateDescription e1000e_vmstate = {
ddf19c
         VMSTATE_MSIX(parent_obj, E1000EState),
ddf19c
 
ddf19c
         VMSTATE_UINT32(ioaddr, E1000EState),
ddf19c
+        VMSTATE_UINT32_TEST(redhat_7_3_intr_state, E1000EState, rhel_7_3_check),
ddf19c
         VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState),
ddf19c
         VMSTATE_UINT8(core.rx_desc_len, E1000EState),
ddf19c
         VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState,
ddf19c
@@ -658,6 +677,8 @@ static PropertyInfo e1000e_prop_disable_vnet,
ddf19c
 
ddf19c
 static Property e1000e_properties[] = {
ddf19c
     DEFINE_NIC_PROPERTIES(E1000EState, conf),
ddf19c
+    DEFINE_PROP_BOOL("__redhat_e1000e_7_3_intr_state", E1000EState,
ddf19c
+                        redhat_7_3_intr_state_enable, false),
ddf19c
     DEFINE_PROP_SIGNED("disable_vnet_hdr", E1000EState, disable_vnet, false,
ddf19c
                         e1000e_prop_disable_vnet, bool),
ddf19c
     DEFINE_PROP_SIGNED("subsys_ven", E1000EState, subsys_ven,
ddf19c
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
ddf19c
index 88a97d756d..21d80e96cf 100644
ddf19c
--- a/hw/net/rtl8139.c
ddf19c
+++ b/hw/net/rtl8139.c
ddf19c
@@ -3177,7 +3177,7 @@ static int rtl8139_pre_save(void *opaque)
ddf19c
 
ddf19c
 static const VMStateDescription vmstate_rtl8139 = {
ddf19c
     .name = "rtl8139",
ddf19c
-    .version_id = 5,
ddf19c
+    .version_id = 4,
ddf19c
     .minimum_version_id = 3,
ddf19c
     .post_load = rtl8139_post_load,
ddf19c
     .pre_save  = rtl8139_pre_save,
ddf19c
@@ -3258,7 +3258,9 @@ static const VMStateDescription vmstate_rtl8139 = {
ddf19c
         VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State),
ddf19c
         VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State),
ddf19c
         VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State),
ddf19c
+#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */
ddf19c
         VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5),
ddf19c
+#endif
ddf19c
         VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State),
ddf19c
         VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State),
ddf19c
 
ddf19c
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
ddf19c
index 74ae74bc5c..73820517df 100644
ddf19c
--- a/hw/rtc/mc146818rtc.c
ddf19c
+++ b/hw/rtc/mc146818rtc.c
ddf19c
@@ -42,6 +42,7 @@
ddf19c
 #include "qapi/visitor.h"
ddf19c
 #include "exec/address-spaces.h"
ddf19c
 #include "hw/rtc/mc146818rtc_regs.h"
ddf19c
+#include "migration/migration.h"
ddf19c
 
ddf19c
 #ifdef TARGET_I386
ddf19c
 #include "qapi/qapi-commands-misc-target.h"
ddf19c
@@ -820,6 +821,11 @@ static int rtc_post_load(void *opaque, int version_id)
ddf19c
 static bool rtc_irq_reinject_on_ack_count_needed(void *opaque)
ddf19c
 {
ddf19c
     RTCState *s = (RTCState *)opaque;
ddf19c
+
ddf19c
+    if (migrate_pre_2_2) {
ddf19c
+        return false;
ddf19c
+    }
ddf19c
+
ddf19c
     return s->irq_reinject_on_ack_count != 0;
ddf19c
 }
ddf19c
 
ddf19c
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
ddf19c
index 11d476c4a2..e6e9355384 100644
ddf19c
--- a/hw/smbios/smbios.c
ddf19c
+++ b/hw/smbios/smbios.c
ddf19c
@@ -777,6 +777,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
ddf19c
     SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
ddf19c
     SMBIOS_SET_DEFAULT(type1.product, product);
ddf19c
     SMBIOS_SET_DEFAULT(type1.version, version);
ddf19c
+    SMBIOS_SET_DEFAULT(type1.family, "Red Hat Enterprise Linux");
ddf19c
     SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer);
ddf19c
     SMBIOS_SET_DEFAULT(type2.product, product);
ddf19c
     SMBIOS_SET_DEFAULT(type2.version, version);
ddf19c
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
ddf19c
index 050875b497..32935da46c 100644
ddf19c
--- a/hw/timer/i8254_common.c
ddf19c
+++ b/hw/timer/i8254_common.c
ddf19c
@@ -231,7 +231,7 @@ static const VMStateDescription vmstate_pit_common = {
ddf19c
     .pre_save = pit_dispatch_pre_save,
ddf19c
     .post_load = pit_dispatch_post_load,
ddf19c
     .fields = (VMStateField[]) {
ddf19c
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
ddf19c
+        VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */
ddf19c
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
ddf19c
                              vmstate_pit_channel, PITChannelState),
ddf19c
         VMSTATE_INT64(channels[0].next_transition_time,
ddf19c
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
ddf19c
index 23507ad3b5..9fd87a7ad9 100644
ddf19c
--- a/hw/usb/hcd-uhci.c
ddf19c
+++ b/hw/usb/hcd-uhci.c
ddf19c
@@ -1219,12 +1219,14 @@ static void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
ddf19c
     UHCIState *s = UHCI(dev);
ddf19c
     uint8_t *pci_conf = s->dev.config;
ddf19c
     int i;
ddf19c
+    int irq_pin;
ddf19c
 
ddf19c
     pci_conf[PCI_CLASS_PROG] = 0x00;
ddf19c
     /* TODO: reset value should be 0. */
ddf19c
     pci_conf[USB_SBRN] = USB_RELEASE_1; // release number
ddf19c
 
ddf19c
-    pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1);
ddf19c
+    irq_pin = u->info.irq_pin;
ddf19c
+    pci_config_set_interrupt_pin(pci_conf, irq_pin + 1);
ddf19c
 
ddf19c
     if (s->masterbus) {
ddf19c
         USBPort *ports[NB_PORTS];
ddf19c
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
ddf19c
index 80988bb305..8fed2eedd6 100644
ddf19c
--- a/hw/usb/hcd-xhci.c
ddf19c
+++ b/hw/usb/hcd-xhci.c
ddf19c
@@ -3590,9 +3590,27 @@ static const VMStateDescription vmstate_xhci_slot = {
ddf19c
     }
ddf19c
 };
ddf19c
 
ddf19c
+static int xhci_event_pre_save(void *opaque)
ddf19c
+{
ddf19c
+    XHCIEvent *s = opaque;
ddf19c
+
ddf19c
+    s->cve_2014_5263_a = ((uint8_t *)&s->type)[0];
ddf19c
+    s->cve_2014_5263_b = ((uint8_t *)&s->type)[1];
ddf19c
+
ddf19c
+    return 0;
ddf19c
+}
ddf19c
+
ddf19c
+bool migrate_cve_2014_5263_xhci_fields;
ddf19c
+
ddf19c
+static bool xhci_event_cve_2014_5263(void *opaque, int version_id)
ddf19c
+{
ddf19c
+    return migrate_cve_2014_5263_xhci_fields;
ddf19c
+}
ddf19c
+
ddf19c
 static const VMStateDescription vmstate_xhci_event = {
ddf19c
     .name = "xhci-event",
ddf19c
     .version_id = 1,
ddf19c
+    .pre_save = xhci_event_pre_save,
ddf19c
     .fields = (VMStateField[]) {
ddf19c
         VMSTATE_UINT32(type,   XHCIEvent),
ddf19c
         VMSTATE_UINT32(ccode,  XHCIEvent),
ddf19c
@@ -3601,6 +3619,8 @@ static const VMStateDescription vmstate_xhci_event = {
ddf19c
         VMSTATE_UINT32(flags,  XHCIEvent),
ddf19c
         VMSTATE_UINT8(slotid,  XHCIEvent),
ddf19c
         VMSTATE_UINT8(epid,    XHCIEvent),
ddf19c
+        VMSTATE_UINT8_TEST(cve_2014_5263_a, XHCIEvent, xhci_event_cve_2014_5263),
ddf19c
+        VMSTATE_UINT8_TEST(cve_2014_5263_b, XHCIEvent, xhci_event_cve_2014_5263),
ddf19c
         VMSTATE_END_OF_LIST()
ddf19c
     }
ddf19c
 };
ddf19c
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
ddf19c
index 2fad4df2a7..f554b671e3 100644
ddf19c
--- a/hw/usb/hcd-xhci.h
ddf19c
+++ b/hw/usb/hcd-xhci.h
ddf19c
@@ -157,6 +157,8 @@ typedef struct XHCIEvent {
ddf19c
     uint32_t flags;
ddf19c
     uint8_t slotid;
ddf19c
     uint8_t epid;
ddf19c
+    uint8_t cve_2014_5263_a;
ddf19c
+    uint8_t cve_2014_5263_b;
ddf19c
 } XHCIEvent;
ddf19c
 
ddf19c
 typedef struct XHCIInterrupter {
ddf19c
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
ddf19c
index 41568d1837..1a23ccc412 100644
ddf19c
--- a/include/hw/acpi/ich9.h
ddf19c
+++ b/include/hw/acpi/ich9.h
ddf19c
@@ -61,6 +61,9 @@ typedef struct ICH9LPCPMRegs {
ddf19c
     uint8_t smm_enabled;
ddf19c
     bool enable_tco;
ddf19c
     TCOIORegs tco_regs;
ddf19c
+
ddf19c
+    /* RH addition, see bz 1489800 */
ddf19c
+    bool force_rev1_fadt;
ddf19c
 } ICH9LPCPMRegs;
ddf19c
 
ddf19c
 #define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
ddf19c
diff --git a/include/hw/boards.h b/include/hw/boards.h
ddf19c
index de45087f34..6f85a0e032 100644
ddf19c
--- a/include/hw/boards.h
ddf19c
+++ b/include/hw/boards.h
ddf19c
@@ -377,4 +377,28 @@ extern const size_t hw_compat_2_2_len;
ddf19c
 extern GlobalProperty hw_compat_2_1[];
ddf19c
 extern const size_t hw_compat_2_1_len;
ddf19c
 
ddf19c
+extern GlobalProperty hw_compat_rhel_8_1[];
ddf19c
+extern const size_t hw_compat_rhel_8_1_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_8_0[];
ddf19c
+extern const size_t hw_compat_rhel_8_0_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_6[];
ddf19c
+extern const size_t hw_compat_rhel_7_6_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_5[];
ddf19c
+extern const size_t hw_compat_rhel_7_5_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_4[];
ddf19c
+extern const size_t hw_compat_rhel_7_4_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_3[];
ddf19c
+extern const size_t hw_compat_rhel_7_3_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_2[];
ddf19c
+extern const size_t hw_compat_rhel_7_2_len;
ddf19c
+
ddf19c
+extern GlobalProperty hw_compat_rhel_7_1[];
ddf19c
+extern const size_t hw_compat_rhel_7_1_len;
ddf19c
+
ddf19c
 #endif
ddf19c
diff --git a/include/hw/usb.h b/include/hw/usb.h
ddf19c
index c24d968a19..b353438ea0 100644
ddf19c
--- a/include/hw/usb.h
ddf19c
+++ b/include/hw/usb.h
ddf19c
@@ -605,4 +605,8 @@ int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
ddf19c
                    uint8_t interface_class, uint8_t interface_subclass,
ddf19c
                    uint8_t interface_protocol);
ddf19c
 
ddf19c
+
ddf19c
+/* hcd-xhci.c -- rhel7.0.0 machine type compatibility */
ddf19c
+extern bool migrate_cve_2014_5263_xhci_fields;
ddf19c
+
ddf19c
 #endif
ddf19c
diff --git a/migration/migration.c b/migration/migration.c
ddf19c
index 354ad072fa..30c53c623b 100644
ddf19c
--- a/migration/migration.c
ddf19c
+++ b/migration/migration.c
ddf19c
@@ -121,6 +121,8 @@ enum mig_rp_message_type {
ddf19c
     MIG_RP_MSG_MAX
ddf19c
 };
ddf19c
 
ddf19c
+bool migrate_pre_2_2;
ddf19c
+
ddf19c
 /* When we add fault tolerance, we could have several
ddf19c
    migrations at once.  For now we don't need to add
ddf19c
    dynamic creation of migration */
ddf19c
diff --git a/migration/migration.h b/migration/migration.h
ddf19c
index 79b3dda146..0b1b0d4df5 100644
ddf19c
--- a/migration/migration.h
ddf19c
+++ b/migration/migration.h
ddf19c
@@ -335,6 +335,11 @@ void init_dirty_bitmap_incoming_migration(void);
ddf19c
 void migrate_add_address(SocketAddress *address);
ddf19c
 
ddf19c
 int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque);
ddf19c
+/*
ddf19c
+ * Disables a load of subsections that were added in 2.2/rh7.2 for backwards
ddf19c
+ * migration compatibility.
ddf19c
+ */
ddf19c
+extern bool migrate_pre_2_2;
ddf19c
 
ddf19c
 #define qemu_ram_foreach_block \
ddf19c
   #warning "Use foreach_not_ignored_block in migration code"
ddf19c
-- 
ddf19c
2.21.0
ddf19c