ff9ada
From adca046d9db670637b9bf2b24f7a4349a9fe2628 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
ff9ada
Rebase changes (weekly-210303):
ff9ada
- Added rhel 8.4.0 compat based on 5.2 compat
ff9ada
ff9ada
Rebase changes (weekly-211103):
ff9ada
- Do not duplicate minimal_version_id for piix4_pm
ff9ada
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
ff9ada
Merged patches (5.1.0):
ff9ada
- e6c3fbf hw/smbios: set new default SMBIOS fields for Windows driver support (partialy)
ff9ada
- 8f9f4d8 compat: disable 'edid' for virtio-gpu-ccw
ff9ada
ff9ada
Merged patches (5.2.0 rc0):
ff9ada
- 8348642 redhat: define hw_compat_8_2
ff9ada
- 45b8402 redhat: define hw_compat_8_2
ff9ada
- 4effa71 redhat: Update hw_compat_8_2
ff9ada
- 0e84dff virtio: skip legacy support check on machine types less than 5.1 (partialy)
ff9ada
ff9ada
Merged patches (6.0.0):
ff9ada
- fa0063ba67 redhat: Define hw_compat_8_3
ff9ada
- d98e328c8d usb/hcd-xhci-pci: Fixup capabilities ordering (again)
ff9ada
- b8a2578117 virtio: move 'use-disabled-flag' property to hw_compat_4_2
ff9ada
- f7940b04c8 virtio-pci: compat page aligned ATS
ff9ada
ff9ada
Merged patches (weekly-210602):
ff9ada
- 26f25108c1 redhat: add missing entries in hw_compat_rhel_8_4
ff9ada
ff9ada
Merged patches (weekly-211006):
ff9ada
- 43c4b9bea6 redhat: Define hw_compat_rhel_8_5
ddf19c
---
ff9ada
 hw/acpi/ich9.c               |  15 ++
ff9ada
 hw/acpi/piix4.c              |   6 +-
ff9ada
 hw/arm/virt.c                |   2 +-
ff9ada
 hw/char/serial.c             |  16 +++
ff9ada
 hw/core/machine.c            | 272 +++++++++++++++++++++++++++++++++++
ff9ada
 hw/display/vga-isa.c         |   2 +-
ff9ada
 hw/i386/pc_piix.c            |   2 +
ff9ada
 hw/i386/pc_q35.c             |   2 +
ff9ada
 hw/net/e1000e.c              |  22 +++
ff9ada
 hw/net/rtl8139.c             |   4 +-
ff9ada
 hw/rtc/mc146818rtc.c         |   6 +
ff9ada
 hw/smbios/smbios.c           |  46 +++++-
ff9ada
 hw/timer/i8254_common.c      |   2 +-
ff9ada
 hw/usb/hcd-uhci.c            |   4 +-
ff9ada
 hw/usb/hcd-xhci-pci.c        |  59 ++++++--
ff9ada
 hw/usb/hcd-xhci-pci.h        |   1 +
ff9ada
 hw/usb/hcd-xhci.c            |  20 +++
ff9ada
 hw/usb/hcd-xhci.h            |   2 +
ff9ada
 include/hw/acpi/ich9.h       |   3 +
ff9ada
 include/hw/boards.h          |  36 +++++
ff9ada
 include/hw/firmware/smbios.h |   5 +-
ff9ada
 include/hw/i386/pc.h         |   3 +
ff9ada
 include/hw/usb.h             |   3 +
ff9ada
 migration/migration.c        |   2 +
ff9ada
 migration/migration.h        |   5 +
ff9ada
 25 files changed, 514 insertions(+), 26 deletions(-)
ddf19c
ddf19c
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
ff9ada
index 381ef2ddcf..82bd805b55 100644
ddf19c
--- a/hw/acpi/ich9.c
ddf19c
+++ b/hw/acpi/ich9.c
ff9ada
@@ -433,6 +433,18 @@ static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp)
ff9ada
     s->pm.keep_pci_slot_hpc = 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
+
ff9ada
 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
ddf19c
 {
ddf19c
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
ff9ada
@@ -457,6 +469,9 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
ff9ada
     object_property_add_bool(obj, "cpu-hotplug-legacy",
ddf19c
                              ich9_pm_get_cpu_hotplug_legacy,
ff9ada
                              ich9_pm_set_cpu_hotplug_legacy);
ddf19c
+    object_property_add_bool(obj, "__com.redhat_force-rev1-fadt",
ddf19c
+                             ich9_pm_get_force_rev1_fadt,
ff9ada
+                             ich9_pm_set_force_rev1_fadt);
ff9ada
     object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED,
ff9ada
                                   &pm->disable_s3, OBJ_PROP_FLAG_READWRITE);
ff9ada
     object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_DISABLED,
ddf19c
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
ff9ada
index f0b5fac44a..8d6011c0a3 100644
ddf19c
--- a/hw/acpi/piix4.c
ddf19c
+++ b/hw/acpi/piix4.c
ff9ada
@@ -278,7 +278,7 @@ static bool piix4_vmstate_need_smbus(void *opaque, int version_id)
ff9ada
 static const VMStateDescription vmstate_acpi = {
ddf19c
     .name = "piix4_pm",
ddf19c
     .version_id = 3,
ff9ada
-    .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),
ff9ada
@@ -644,8 +644,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),
ff9ada
     DEFINE_PROP_BOOL(ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, PIIX4PMState,
ff9ada
                      use_acpi_hotplug_bridge, true),
ff9ada
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
ff9ada
index 30da05dfe0..5de4d9d73b 100644
ff9ada
--- a/hw/arm/virt.c
ff9ada
+++ b/hw/arm/virt.c
ff9ada
@@ -1590,7 +1590,7 @@ static void virt_build_smbios(VirtMachineState *vms)
ff9ada
 
ff9ada
     smbios_set_defaults("QEMU", product,
ff9ada
                         vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
ff9ada
-                        true, SMBIOS_ENTRY_POINT_30);
ff9ada
+                        true, NULL, NULL, SMBIOS_ENTRY_POINT_30);
ff9ada
 
ff9ada
     smbios_get_tables(MACHINE(vms), NULL, 0,
ff9ada
                       &smbios_tables, &smbios_tables_len,
ddf19c
diff --git a/hw/char/serial.c b/hw/char/serial.c
ff9ada
index 7061aacbce..fe8d0afbb0 100644
ddf19c
--- a/hw/char/serial.c
ddf19c
+++ b/hw/char/serial.c
ff9ada
@@ -37,6 +37,7 @@
ddf19c
 #include "trace.h"
ff9ada
 #include "hw/qdev-properties.h"
ff9ada
 #include "hw/qdev-properties-system.h"
ddf19c
+#include "migration/migration.h"
ddf19c
 
ff9ada
 #define UART_LCR_DLAB	0x80	/* Divisor latch access bit */
ddf19c
 
ff9ada
@@ -689,6 +690,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);
ff9ada
@@ -770,6 +774,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
 
ff9ada
@@ -787,6 +795,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
 
ff9ada
@@ -804,6 +816,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
ff9ada
index 53a99abc56..be4f9864cd 100644
ddf19c
--- a/hw/core/machine.c
ddf19c
+++ b/hw/core/machine.c
ff9ada
@@ -37,6 +37,278 @@
ff9ada
 #include "hw/virtio/virtio.h"
ff9ada
 #include "hw/virtio/virtio-pci.h"
ddf19c
 
ddf19c
+/*
ff9ada
+ * Mostly the same as hw_compat_6_0
ff9ada
+ */
ff9ada
+GlobalProperty hw_compat_rhel_8_5[] = {
ff9ada
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
ff9ada
+    { "gpex-pcihost", "allow-unmapped-accesses", "false" },
ff9ada
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
ff9ada
+    { "i8042", "extended-state", "false"},
ff9ada
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
ff9ada
+    { "nvme-ns", "eui64-default", "off"},
ff9ada
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
ff9ada
+    { "e1000", "init-vet", "off" },
ff9ada
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
ff9ada
+    { "e1000e", "init-vet", "off" },
ff9ada
+};
ff9ada
+const size_t hw_compat_rhel_8_5_len = G_N_ELEMENTS(hw_compat_rhel_8_5);
ff9ada
+
ff9ada
+/*
ff9ada
+ * Mostly the same as hw_compat_5_2
ff9ada
+ */
ff9ada
+GlobalProperty hw_compat_rhel_8_4[] = {
ff9ada
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
ff9ada
+    { "ICH9-LPC", "smm-compat", "on"},
ff9ada
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
ff9ada
+    { "PIIX4_PM", "smm-compat", "on"},
ff9ada
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
ff9ada
+    { "virtio-blk-device", "report-discard-granularity", "off" },
ff9ada
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
ff9ada
+    { "virtio-net-pci", "vectors", "3"},
ff9ada
+};
ff9ada
+const size_t hw_compat_rhel_8_4_len = G_N_ELEMENTS(hw_compat_rhel_8_4);
ff9ada
+
ff9ada
+/*
ff9ada
+ * Mostly the same as hw_compat_5_1
ff9ada
+ */
ff9ada
+GlobalProperty hw_compat_rhel_8_3[] = {
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "vhost-scsi", "num_queues", "1"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "vhost-user-blk", "num-queues", "1"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "vhost-user-scsi", "num_queues", "1"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "virtio-blk-device", "num-queues", "1"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "virtio-scsi-device", "num_queues", "1"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "nvme", "use-intel-id", "on"},
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */
ff9ada
+    /* hw_compat_rhel_8_3 bz 1912846 */
ff9ada
+    { "pci-xhci", "x-rh-late-msi-cap", "off" },
ff9ada
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
ff9ada
+    { "virtio-pci", "x-ats-page-aligned", "off"},
ff9ada
+};
ff9ada
+const size_t hw_compat_rhel_8_3_len = G_N_ELEMENTS(hw_compat_rhel_8_3);
ff9ada
+
ff9ada
+/*
ff9ada
+ * The same as hw_compat_4_2 + hw_compat_5_0
ff9ada
+ */
ff9ada
+GlobalProperty hw_compat_rhel_8_2[] = {
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-blk-device", "queue-size", "128"},
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-scsi-device", "virtqueue_size", "128"},
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-blk-device", "seg-max-adjust", "off"},
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-scsi-device", "seg_max_adjust", "off"},
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "vhost-blk-device", "seg_max_adjust", "off"},
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "usb-host", "suppress-remote-wake", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "usb-redir", "suppress-remote-wake", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "qxl", "revision", "4" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "qxl-vga", "revision", "4" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "fw_cfg", "acpi-mr-restore", "false" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
ff9ada
+    { "virtio-device", "use-disabled-flag", "false" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "pci-host-bridge", "x-config-reg-migration-enabled", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "virtio-balloon-device", "page-poison", "false" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "vmport", "x-read-set-eax", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "vmport", "x-signal-unsupported-cmd", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "vmport", "x-report-vmx-type", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "vmport", "x-cmds-v2", "off" },
ff9ada
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
ff9ada
+    { "virtio-device", "x-disable-legacy-check", "true" },
ff9ada
+};
ff9ada
+const size_t hw_compat_rhel_8_2_len = G_N_ELEMENTS(hw_compat_rhel_8_2);
ff9ada
+
ff9ada
+/*
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 */
ff9ada
+    { "virtio-gpu-device", "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
+
ff9ada
 GlobalProperty hw_compat_6_1[] = {
ff9ada
     { "vhost-user-vsock-device", "seqpacket", "off" },
ff9ada
     { "nvme-ns", "shared", "off" },
ddf19c
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
ff9ada
index 90851e730b..a91c5d7467 100644
ddf19c
--- a/hw/display/vga-isa.c
ddf19c
+++ b/hw/display/vga-isa.c
ff9ada
@@ -85,7 +85,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
 
ff9ada
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
ff9ada
index 223dd3e05d..dda3f64f19 100644
ff9ada
--- a/hw/i386/pc_piix.c
ff9ada
+++ b/hw/i386/pc_piix.c
ff9ada
@@ -177,6 +177,8 @@ static void pc_init1(MachineState *machine,
ff9ada
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
ff9ada
                             mc->name, pcmc->smbios_legacy_mode,
ff9ada
                             pcmc->smbios_uuid_encoded,
ff9ada
+                            pcmc->smbios_stream_product,
ff9ada
+                            pcmc->smbios_stream_version,
ff9ada
                             SMBIOS_ENTRY_POINT_21);
ff9ada
     }
ff9ada
 
ff9ada
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
ff9ada
index e1e100316d..235054a643 100644
ff9ada
--- a/hw/i386/pc_q35.c
ff9ada
+++ b/hw/i386/pc_q35.c
ff9ada
@@ -200,6 +200,8 @@ static void pc_q35_init(MachineState *machine)
ff9ada
         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
ff9ada
                             mc->name, pcmc->smbios_legacy_mode,
ff9ada
                             pcmc->smbios_uuid_encoded,
ff9ada
+                            pcmc->smbios_stream_product,
ff9ada
+                            pcmc->smbios_stream_version,
ff9ada
                             SMBIOS_ENTRY_POINT_21);
ff9ada
     }
ff9ada
 
ddf19c
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
ff9ada
index ac96f7665a..d35bc1f0b0 100644
ddf19c
--- a/hw/net/e1000e.c
ddf19c
+++ b/hw/net/e1000e.c
ff9ada
@@ -81,6 +81,12 @@ struct E1000EState {
ddf19c
 
ddf19c
     E1000ECore core;
ff9ada
     bool init_vet;
ff9ada
+
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;
ff9ada
 };
ddf19c
 
ddf19c
 #define E1000E_MMIO_IDX     0
ff9ada
@@ -96,6 +102,10 @@ 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
 {
ff9ada
@@ -307,6 +317,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
 }
ff9ada
@@ -478,6 +490,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,
ff9ada
@@ -605,6 +619,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,
ff9ada
@@ -616,6 +635,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,
ff9ada
@@ -664,6 +684,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
ff9ada
index 90b4fc63ce..3ffb9dd22c 100644
ddf19c
--- a/hw/net/rtl8139.c
ddf19c
+++ b/hw/net/rtl8139.c
ff9ada
@@ -3179,7 +3179,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,
ff9ada
@@ -3260,7 +3260,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
ff9ada
index 4fbafddb22..2f120c6e70 100644
ddf19c
--- a/hw/rtc/mc146818rtc.c
ddf19c
+++ b/hw/rtc/mc146818rtc.c
ff9ada
@@ -43,6 +43,7 @@
ff9ada
 #include "qapi/qapi-events-misc-target.h"
ddf19c
 #include "qapi/visitor.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"
ff9ada
@@ -821,6 +822,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
ff9ada
index 7397e56737..3a4bb894ba 100644
ddf19c
--- a/hw/smbios/smbios.c
ddf19c
+++ b/hw/smbios/smbios.c
ff9ada
@@ -57,6 +57,9 @@ static bool smbios_legacy = true;
ff9ada
 static bool smbios_uuid_encoded = true;
ff9ada
 /* end: legacy structures & constants for <= 2.0 machines */
ff9ada
 
ff9ada
+/* Set to true for modern Windows 10 HardwareID-6 compat */
ff9ada
+static bool smbios_type2_required;
ff9ada
+
ff9ada
 
ff9ada
 uint8_t *smbios_tables;
ff9ada
 size_t smbios_tables_len;
ff9ada
@@ -619,7 +622,7 @@ static void smbios_build_type_1_table(void)
ff9ada
 
ff9ada
 static void smbios_build_type_2_table(void)
ff9ada
 {
ff9ada
-    SMBIOS_BUILD_TABLE_PRE(2, 0x200, false); /* optional */
ff9ada
+    SMBIOS_BUILD_TABLE_PRE(2, 0x200, smbios_type2_required);
ff9ada
 
ff9ada
     SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer);
ff9ada
     SMBIOS_TABLE_SET_STR(2, product_str, type2.product);
ff9ada
@@ -888,7 +891,10 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
ff9ada
 
ff9ada
 void smbios_set_defaults(const char *manufacturer, const char *product,
ff9ada
                          const char *version, bool legacy_mode,
ff9ada
-                         bool uuid_encoded, SmbiosEntryPointType ep_type)
ff9ada
+                         bool uuid_encoded,
ff9ada
+                         const char *stream_product,
ff9ada
+                         const char *stream_version,
ff9ada
+                         SmbiosEntryPointType ep_type)
ff9ada
 {
ff9ada
     smbios_have_defaults = true;
ff9ada
     smbios_legacy = legacy_mode;
ff9ada
@@ -909,11 +915,45 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
ff9ada
         g_free(smbios_entries);
ff9ada
     }
ff9ada
 
ff9ada
+    /*
ff9ada
+     * If @stream_product & @stream_version are non-NULL, then
ff9ada
+     * we're following rules for new Windows driver support.
ff9ada
+     * The data we have to report is defined in this doc:
ff9ada
+     *
ff9ada
+     * https://docs.microsoft.com/en-us/windows-hardware/drivers/install/specifying-hardware-ids-for-a-computer
ff9ada
+     *
ff9ada
+     * The Windows drivers are written to expect use of the
ff9ada
+     * scheme documented as "HardwareID-6" against Windows 10,
ff9ada
+     * which uses SMBIOS System (Type 1) and Base Board (Type 2)
ff9ada
+     * tables and will match on
ff9ada
+     *
ff9ada
+     *   System Manufacturer = Red Hat     (@manufacturer)
ff9ada
+     *   System SKU Number = 8.2.0         (@stream_version)
ff9ada
+     *   Baseboard Manufacturer = Red Hat  (@manufacturer)
ff9ada
+     *   Baseboard Product = RHEL-AV       (@stream_product)
ff9ada
+     *
ff9ada
+     * NB, SKU must be changed with each RHEL-AV release
ff9ada
+     *
ff9ada
+     * Other fields can be freely used by applications using
ff9ada
+     * QEMU. For example apps can use the "System product"
ff9ada
+     * and "System version" to identify themselves.
ff9ada
+     *
ff9ada
+     * We get 'System Manufacturer' and 'Baseboard Manufacturer'
ff9ada
+     */
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");
ff9ada
+    if (stream_version != NULL) {
ff9ada
+        SMBIOS_SET_DEFAULT(type1.sku, stream_version);
ff9ada
+    }
ddf19c
     SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer);
ff9ada
-    SMBIOS_SET_DEFAULT(type2.product, product);
ff9ada
+    if (stream_product != NULL) {
ff9ada
+        SMBIOS_SET_DEFAULT(type2.product, stream_product);
ff9ada
+        smbios_type2_required = true;
ff9ada
+    } else {
ff9ada
+        SMBIOS_SET_DEFAULT(type2.product, product);
ff9ada
+    }
ddf19c
     SMBIOS_SET_DEFAULT(type2.version, version);
ff9ada
     SMBIOS_SET_DEFAULT(type3.manufacturer, manufacturer);
ff9ada
     SMBIOS_SET_DEFAULT(type3.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
ff9ada
index d1b5657d72..7930b868fa 100644
ddf19c
--- a/hw/usb/hcd-uhci.c
ddf19c
+++ b/hw/usb/hcd-uhci.c
ff9ada
@@ -1166,11 +1166,13 @@ 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. */
ff9ada
     pci_conf[USB_SBRN] = USB_RELEASE_1; /* release number */
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);
ff9ada
     s->irq = pci_allocate_irq(dev);
ddf19c
 
ddf19c
     if (s->masterbus) {
ff9ada
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
ff9ada
index e934b1a5b1..e18b05e528 100644
ff9ada
--- a/hw/usb/hcd-xhci-pci.c
ff9ada
+++ b/hw/usb/hcd-xhci-pci.c
ff9ada
@@ -104,6 +104,33 @@ static int xhci_pci_vmstate_post_load(void *opaque, int version_id)
ff9ada
    return 0;
ff9ada
 }
ff9ada
 
ff9ada
+/* RH bz 1912846 */
ff9ada
+static bool usb_xhci_pci_add_msi(struct PCIDevice *dev, Error **errp)
ff9ada
+{
ff9ada
+    int ret;
ff9ada
+    Error *err = NULL;
ff9ada
+    XHCIPciState *s = XHCI_PCI(dev);
ff9ada
+
ff9ada
+    ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err;;
ff9ada
+    /*
ff9ada
+     * Any error other than -ENOTSUP(board's MSI support is broken)
ff9ada
+     * is a programming error
ff9ada
+     */
ff9ada
+    assert(!ret || ret == -ENOTSUP);
ff9ada
+    if (ret && s->msi == ON_OFF_AUTO_ON) {
ff9ada
+        /* Can't satisfy user's explicit msi=on request, fail */
ff9ada
+        error_append_hint(&err, "You have to use msi=auto (default) or "
ff9ada
+                "msi=off with this machine type.\n");
ff9ada
+        error_propagate(errp, err);
ff9ada
+        return true;
ff9ada
+    }
ff9ada
+    assert(!err || s->msi == ON_OFF_AUTO_AUTO);
ff9ada
+    /* With msi=auto, we fall back to MSI off silently */
ff9ada
+    error_free(err);
ff9ada
+
ff9ada
+    return false;
ff9ada
+}
ff9ada
+
ff9ada
 static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
ff9ada
 {
ff9ada
     int ret;
ff9ada
@@ -125,23 +152,12 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
ff9ada
         s->xhci.nec_quirks = true;
ff9ada
     }
ff9ada
 
ff9ada
-    if (s->msi != ON_OFF_AUTO_OFF) {
ff9ada
-        ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err;;
ff9ada
-        /*
ff9ada
-         * Any error other than -ENOTSUP(board's MSI support is broken)
ff9ada
-         * is a programming error
ff9ada
-         */
ff9ada
-        assert(!ret || ret == -ENOTSUP);
ff9ada
-        if (ret && s->msi == ON_OFF_AUTO_ON) {
ff9ada
-            /* Can't satisfy user's explicit msi=on request, fail */
ff9ada
-            error_append_hint(&err, "You have to use msi=auto (default) or "
ff9ada
-                    "msi=off with this machine type.\n");
ff9ada
+    if (s->msi != ON_OFF_AUTO_OFF && s->rh_late_msi_cap) {
ff9ada
+        /* This gives the behaviour from 5.2.0 onwards, lspci shows 90,a0,70 */
ff9ada
+        if (usb_xhci_pci_add_msi(dev, &err)) {
ff9ada
             error_propagate(errp, err);
ff9ada
             return;
ff9ada
         }
ff9ada
-        assert(!err || s->msi == ON_OFF_AUTO_AUTO);
ff9ada
-        /* With msi=auto, we fall back to MSI off silently */
ff9ada
-        error_free(err);
ff9ada
     }
ff9ada
     pci_register_bar(dev, 0,
ff9ada
                      PCI_BASE_ADDRESS_SPACE_MEMORY |
ff9ada
@@ -154,6 +170,14 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
ff9ada
         assert(ret > 0);
ff9ada
     }
ff9ada
 
ff9ada
+    /* RH bz 1912846 */
ff9ada
+    if (s->msi != ON_OFF_AUTO_OFF && !s->rh_late_msi_cap) {
ff9ada
+        /* This gives the older RH machine behaviour, lspci shows 90,70,a0 */
ff9ada
+        if (usb_xhci_pci_add_msi(dev, &err)) {
ff9ada
+            error_propagate(errp, err);
ff9ada
+            return;
ff9ada
+        }
ff9ada
+    }
ff9ada
     if (s->msix != ON_OFF_AUTO_OFF) {
ff9ada
         /* TODO check for errors, and should fail when msix=on */
ff9ada
         msix_init(dev, s->xhci.numintrs,
ff9ada
@@ -198,11 +222,18 @@ static void xhci_instance_init(Object *obj)
ff9ada
     qdev_alias_all_properties(DEVICE(&s->xhci), obj);
ff9ada
 }
ff9ada
 
ff9ada
+static Property xhci_pci_properties[] = {
ff9ada
+    /* RH bz 1912846 */
ff9ada
+    DEFINE_PROP_BOOL("x-rh-late-msi-cap", XHCIPciState, rh_late_msi_cap, true),
ff9ada
+    DEFINE_PROP_END_OF_LIST()
ff9ada
+};
ff9ada
+
ff9ada
 static void xhci_class_init(ObjectClass *klass, void *data)
ff9ada
 {
ff9ada
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
ff9ada
     DeviceClass *dc = DEVICE_CLASS(klass);
ff9ada
 
ff9ada
+    device_class_set_props(dc, xhci_pci_properties);
ff9ada
     dc->reset   = xhci_pci_reset;
ff9ada
     dc->vmsd    = &vmstate_xhci_pci;
ff9ada
     set_bit(DEVICE_CATEGORY_USB, dc->categories);
ff9ada
diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
ff9ada
index c193f79443..086a1feb1e 100644
ff9ada
--- a/hw/usb/hcd-xhci-pci.h
ff9ada
+++ b/hw/usb/hcd-xhci-pci.h
ff9ada
@@ -39,6 +39,7 @@ typedef struct XHCIPciState {
ff9ada
     XHCIState xhci;
ff9ada
     OnOffAuto msi;
ff9ada
     OnOffAuto msix;
ff9ada
+    bool      rh_late_msi_cap;  /* bz 1912846 */
ff9ada
 } XHCIPciState;
ff9ada
 
ff9ada
 #endif
ddf19c
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
ff9ada
index e01700039b..d5ea13356c 100644
ddf19c
--- a/hw/usb/hcd-xhci.c
ddf19c
+++ b/hw/usb/hcd-xhci.c
ff9ada
@@ -3494,9 +3494,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),
ff9ada
@@ -3505,6 +3523,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
ff9ada
index 98f598382a..50a7b6f6c4 100644
ddf19c
--- a/hw/usb/hcd-xhci.h
ddf19c
+++ b/hw/usb/hcd-xhci.h
ff9ada
@@ -149,6 +149,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
ff9ada
index 7ca92843c6..21abfd8447 100644
ddf19c
--- a/include/hw/acpi/ich9.h
ddf19c
+++ b/include/hw/acpi/ich9.h
ff9ada
@@ -68,6 +68,9 @@ typedef struct ICH9LPCPMRegs {
ff9ada
     bool smm_compat;
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
ff9ada
index 9c1c190104..8bba96ef2b 100644
ddf19c
--- a/include/hw/boards.h
ddf19c
+++ b/include/hw/boards.h
ff9ada
@@ -441,4 +441,40 @@ 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
 
ff9ada
+extern GlobalProperty hw_compat_rhel_8_5[];
ff9ada
+extern const size_t hw_compat_rhel_8_5_len;
ff9ada
+
ff9ada
+extern GlobalProperty hw_compat_rhel_8_4[];
ff9ada
+extern const size_t hw_compat_rhel_8_4_len;
ff9ada
+
ff9ada
+extern GlobalProperty hw_compat_rhel_8_3[];
ff9ada
+extern const size_t hw_compat_rhel_8_3_len;
ff9ada
+
ff9ada
+extern GlobalProperty hw_compat_rhel_8_2[];
ff9ada
+extern const size_t hw_compat_rhel_8_2_len;
ff9ada
+
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
ff9ada
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
ff9ada
index 5a0dd0c8cf..2cb1ec2bab 100644
ff9ada
--- a/include/hw/firmware/smbios.h
ff9ada
+++ b/include/hw/firmware/smbios.h
ff9ada
@@ -278,7 +278,10 @@ void smbios_entry_add(QemuOpts *opts, Error **errp);
ff9ada
 void smbios_set_cpuid(uint32_t version, uint32_t features);
ff9ada
 void smbios_set_defaults(const char *manufacturer, const char *product,
ff9ada
                          const char *version, bool legacy_mode,
ff9ada
-                         bool uuid_encoded, SmbiosEntryPointType ep_type);
ff9ada
+                         bool uuid_encoded,
ff9ada
+                         const char *stream_product,
ff9ada
+                         const char *stream_version,
ff9ada
+                         SmbiosEntryPointType ep_type);
ff9ada
 uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length);
ff9ada
 void smbios_get_tables(MachineState *ms,
ff9ada
                        const struct smbios_phys_mem_area *mem_array,
ff9ada
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
ff9ada
index 9ab39e428f..7ccc9a1a07 100644
ff9ada
--- a/include/hw/i386/pc.h
ff9ada
+++ b/include/hw/i386/pc.h
ff9ada
@@ -107,6 +107,9 @@ struct PCMachineClass {
ff9ada
     bool smbios_defaults;
ff9ada
     bool smbios_legacy_mode;
ff9ada
     bool smbios_uuid_encoded;
ff9ada
+    /* New fields needed for Windows HardwareID-6 matching */
ff9ada
+    const char *smbios_stream_product;
ff9ada
+    const char *smbios_stream_version;
ff9ada
 
ff9ada
     /* RAM / address space compat: */
ff9ada
     bool gigabyte_align;
ddf19c
diff --git a/include/hw/usb.h b/include/hw/usb.h
ff9ada
index 33668dd0a9..e6b2fe72da 100644
ddf19c
--- a/include/hw/usb.h
ddf19c
+++ b/include/hw/usb.h
ff9ada
@@ -582,4 +582,7 @@ void usb_pcap_init(FILE *fp);
ff9ada
 void usb_pcap_ctrl(USBPacket *p, bool setup);
ff9ada
 void usb_pcap_data(USBPacket *p, bool setup);
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
ff9ada
index abaf6f9e3d..a87ff01b81 100644
ddf19c
--- a/migration/migration.c
ddf19c
+++ b/migration/migration.c
ff9ada
@@ -164,6 +164,8 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot,
ff9ada
     MIGRATION_CAPABILITY_X_COLO,
ff9ada
     MIGRATION_CAPABILITY_VALIDATE_UUID);
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
ff9ada
index 8130b703eb..d016cedd9d 100644
ddf19c
--- a/migration/migration.h
ddf19c
+++ b/migration/migration.h
ff9ada
@@ -381,6 +381,11 @@ bool check_dirty_bitmap_mig_alias_map(const BitmapMigrationNodeAliasList *bbm,
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
-- 
ff9ada
2.27.0
ddf19c