586cba
From a525db3951dc68c469d1f51bdc69ab6e75e72c37 Mon Sep 17 00:00:00 2001
495e37
From: Miroslav Rezanina <mrezanin@redhat.com>
495e37
Date: Fri, 11 Jan 2019 09:54:45 +0100
495e37
Subject: Machine type related general changes
495e37
495e37
This patch is first part of original "Add RHEL machine types" patch we
495e37
split to allow easier review. It contains changes not related to any
495e37
architecture.
495e37
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
--
586cba
Rebase notes (6.2.0):
495e37
- Do not duplicate minimal_version_id for piix4_pm
495e37
- Remove empty line chunks in serial.c
495e37
- Remove migration.h include in serial.c
495e37
- Update hw_compat_rhel_8_5 (from MR 66)
495e37
586cba
Rebase notes (7.0.0):
586cba
- Remove downstream changes leftovers in hw/rtc/mc146818rtc.c
586cba
- Remove unnecessary change in hw/usb/hcd-uhci.c
586cba
495e37
Merged patches (6.1.0):
495e37
- f2fb42a3c6 redhat: add missing entries in hw_compat_rhel_8_4
495e37
- 1949ec258e hw/arm/virt: Disable PL011 clock migration through hw_compat_rhel_8_3
495e37
- a3995e2eff Remove RHEL 7.0.0 machine type (only generic changes)
495e37
- ad3190a79b Remove RHEL 7.1.0 machine type (only generic changes)
495e37
- 84bbe15d4e Remove RHEL 7.2.0 machine type (only generic changes)
495e37
- 0215eb3356 Remove RHEL 7.3.0 machine types (only generic changes)
495e37
- af69d1ca6e Remove RHEL 7.4.0 machine types (only generic changes)
495e37
- 8f7a74ab78 Remove RHEL 7.5.0 machine types (only generic changes)
495e37
586cba
Merged patches (6.2.0):
495e37
- d687ac13d2 redhat: Define hw_compat_rhel_8_5
586cba
586cba
Merged patches (7.0.0):
586cba
- ef5afcc86d Fix virtio-net-pci* "vectors" compat
586cba
- 168f0d56e3 compat: Update hw_compat_rhel_8_5 with 6.2.0 RC2 changes
495e37
---
495e37
 hw/acpi/piix4.c              |   6 +-
495e37
 hw/arm/virt.c                |   2 +-
586cba
 hw/core/machine.c            | 186 +++++++++++++++++++++++++++++++++++
495e37
 hw/display/vga-isa.c         |   2 +-
495e37
 hw/i386/pc_piix.c            |   2 +
495e37
 hw/i386/pc_q35.c             |   2 +
495e37
 hw/net/rtl8139.c             |   4 +-
495e37
 hw/smbios/smbios.c           |  46 ++++++++-
495e37
 hw/timer/i8254_common.c      |   2 +-
586cba
 hw/usb/hcd-xhci-pci.c        |  59 ++++++++---
495e37
 hw/usb/hcd-xhci-pci.h        |   1 +
495e37
 include/hw/boards.h          |  21 ++++
495e37
 include/hw/firmware/smbios.h |   5 +-
495e37
 include/hw/i386/pc.h         |   3 +
586cba
 14 files changed, 316 insertions(+), 25 deletions(-)
495e37
495e37
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
586cba
index fe5625d07a..28544e78c3 100644
495e37
--- a/hw/acpi/piix4.c
495e37
+++ b/hw/acpi/piix4.c
586cba
@@ -287,7 +287,7 @@ static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id)
495e37
 static const VMStateDescription vmstate_acpi = {
495e37
     .name = "piix4_pm",
495e37
     .version_id = 3,
495e37
-    .minimum_version_id = 3,
495e37
+    .minimum_version_id = 2,
495e37
     .post_load = vmstate_acpi_post_load,
495e37
     .fields = (VMStateField[]) {
495e37
         VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
586cba
@@ -653,8 +653,8 @@ static void piix4_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
495e37
 
495e37
 static Property piix4_pm_properties[] = {
495e37
     DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
495e37
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
495e37
-    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0),
495e37
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 1),
495e37
+    DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 1),
495e37
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
495e37
     DEFINE_PROP_BOOL(ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, PIIX4PMState,
495e37
                      use_acpi_hotplug_bridge, true),
495e37
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
586cba
index d2e5ecd234..6a84031fd7 100644
495e37
--- a/hw/arm/virt.c
495e37
+++ b/hw/arm/virt.c
586cba
@@ -1596,7 +1596,7 @@ static void virt_build_smbios(VirtMachineState *vms)
495e37
 
495e37
     smbios_set_defaults("QEMU", product,
495e37
                         vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
586cba
-                        true, SMBIOS_ENTRY_POINT_TYPE_64);
586cba
+                        true, NULL, NULL, SMBIOS_ENTRY_POINT_TYPE_64);
495e37
 
495e37
     smbios_get_tables(MACHINE(vms), NULL, 0,
495e37
                       &smbios_tables, &smbios_tables_len,
495e37
diff --git a/hw/core/machine.c b/hw/core/machine.c
586cba
index 1e23fdc14b..ea430d844e 100644
495e37
--- a/hw/core/machine.c
495e37
+++ b/hw/core/machine.c
586cba
@@ -37,6 +37,192 @@
495e37
 #include "hw/virtio/virtio.h"
495e37
 #include "hw/virtio/virtio-pci.h"
495e37
 
495e37
+/*
495e37
+ * Mostly the same as hw_compat_6_0 and hw_compat_6_1
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_5[] = {
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "gpex-pcihost", "allow-unmapped-accesses", "false" },
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "i8042", "extended-state", "false"},
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "nvme-ns", "eui64-default", "off"},
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "e1000", "init-vet", "off" },
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "e1000e", "init-vet", "off" },
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_0 */
495e37
+    { "vhost-vsock-device", "seqpacket", "off" },
495e37
+    /* hw_compat_rhel_8_5 from hw_compat_6_1 */
495e37
+    { "vhost-user-vsock-device", "seqpacket", "off" },
586cba
+    /* hw_compat_rhel_8_5 from hw_compat_6_1 */
586cba
+    { "nvme-ns", "shared", "off" },
495e37
+};
495e37
+const size_t hw_compat_rhel_8_5_len = G_N_ELEMENTS(hw_compat_rhel_8_5);
495e37
+
495e37
+/*
495e37
+ * Mostly the same as hw_compat_5_2
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_4[] = {
495e37
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
495e37
+    { "ICH9-LPC", "smm-compat", "on"},
495e37
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
495e37
+    { "PIIX4_PM", "smm-compat", "on"},
495e37
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
495e37
+    { "virtio-blk-device", "report-discard-granularity", "off" },
495e37
+    /* hw_compat_rhel_8_4 from hw_compat_5_2 */
586cba
+    /*
586cba
+     * Upstream incorrectly had "virtio-net-pci" instead of "virtio-net-pci-base",
586cba
+     * (https://bugzilla.redhat.com/show_bug.cgi?id=1999141)
586cba
+     */
586cba
+    { "virtio-net-pci-base", "vectors", "3"},
495e37
+};
495e37
+const size_t hw_compat_rhel_8_4_len = G_N_ELEMENTS(hw_compat_rhel_8_4);
495e37
+
495e37
+/*
495e37
+ * Mostly the same as hw_compat_5_1
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_3[] = {
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "vhost-scsi", "num_queues", "1"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "vhost-user-blk", "num-queues", "1"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "vhost-user-scsi", "num_queues", "1"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "virtio-blk-device", "num-queues", "1"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "virtio-scsi-device", "num_queues", "1"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "nvme", "use-intel-id", "on"},
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "pvpanic", "events", "1"}, /* PVPANIC_PANICKED */
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "pl011", "migrate-clk", "off" },
495e37
+    /* hw_compat_rhel_8_3 bz 1912846 */
495e37
+    { "pci-xhci", "x-rh-late-msi-cap", "off" },
495e37
+    /* hw_compat_rhel_8_3 from hw_compat_5_1 */
495e37
+    { "virtio-pci", "x-ats-page-aligned", "off"},
495e37
+};
495e37
+const size_t hw_compat_rhel_8_3_len = G_N_ELEMENTS(hw_compat_rhel_8_3);
495e37
+
495e37
+/*
495e37
+ * The same as hw_compat_4_2 + hw_compat_5_0
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_2[] = {
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-blk-device", "queue-size", "128"},
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-scsi-device", "virtqueue_size", "128"},
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-blk-device", "x-enable-wce-if-config-wce", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-blk-device", "seg-max-adjust", "off"},
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-scsi-device", "seg_max_adjust", "off"},
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "vhost-blk-device", "seg_max_adjust", "off"},
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "usb-host", "suppress-remote-wake", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "usb-redir", "suppress-remote-wake", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "qxl", "revision", "4" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "qxl-vga", "revision", "4" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "fw_cfg", "acpi-mr-restore", "false" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_4_2 */
495e37
+    { "virtio-device", "use-disabled-flag", "false" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "pci-host-bridge", "x-config-reg-migration-enabled", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "virtio-balloon-device", "page-poison", "false" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "vmport", "x-read-set-eax", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "vmport", "x-signal-unsupported-cmd", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "vmport", "x-report-vmx-type", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "vmport", "x-cmds-v2", "off" },
495e37
+    /* hw_compat_rhel_8_2 from hw_compat_5_0 */
495e37
+    { "virtio-device", "x-disable-legacy-check", "true" },
495e37
+};
495e37
+const size_t hw_compat_rhel_8_2_len = G_N_ELEMENTS(hw_compat_rhel_8_2);
495e37
+
495e37
+/*
495e37
+ * The same as hw_compat_4_1
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_1[] = {
495e37
+    /* hw_compat_rhel_8_1 from hw_compat_4_1 */
495e37
+    { "virtio-pci", "x-pcie-flr-init", "off" },
495e37
+};
495e37
+const size_t hw_compat_rhel_8_1_len = G_N_ELEMENTS(hw_compat_rhel_8_1);
495e37
+
495e37
+/* The same as hw_compat_3_1
495e37
+ * format of array has been changed by:
495e37
+ *     6c36bddf5340 ("machine: Use shorter format for GlobalProperty arrays")
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_8_0[] = {
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "pcie-root-port", "x-speed", "2_5" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "pcie-root-port", "x-width", "1" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "tpm-crb", "ppi", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "tpm-tis", "ppi", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "usb-kbd", "serial", "42" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "usb-mouse", "serial", "42" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "usb-tablet", "serial", "42" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "virtio-blk-device", "discard", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 */
495e37
+    { "virtio-blk-device", "write-zeroes", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "VGA",            "edid", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "secondary-vga",  "edid", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "bochs-display",  "edid", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "virtio-vga",     "edid", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "virtio-gpu-device", "edid", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_4_0 */
495e37
+    { "virtio-device", "use-started", "false" },
495e37
+    /* hw_compat_rhel_8_0 from hw_compat_3_1 - that was added in 4.1 */
495e37
+    { "pcie-root-port-base", "disable-acs", "true" },
495e37
+};
495e37
+const size_t hw_compat_rhel_8_0_len = G_N_ELEMENTS(hw_compat_rhel_8_0);
495e37
+
495e37
+/* The same as hw_compat_3_0 + hw_compat_2_12
495e37
+ * except that
495e37
+ *   there's nothing in 3_0
495e37
+ *   migration.decompress-error-check=off was in 7.5 from bz 1584139
495e37
+ */
495e37
+GlobalProperty hw_compat_rhel_7_6[] = {
495e37
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
495e37
+    { "hda-audio", "use-timer", "false" },
495e37
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
495e37
+    { "cirrus-vga", "global-vmstate", "true" },
495e37
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
495e37
+    { "VGA", "global-vmstate", "true" },
495e37
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
495e37
+    { "vmware-svga", "global-vmstate", "true" },
495e37
+    /* hw_compat_rhel_7_6 from hw_compat_2_12 */
495e37
+    { "qxl-vga", "global-vmstate",  "true" },
495e37
+};
495e37
+const size_t hw_compat_rhel_7_6_len = G_N_ELEMENTS(hw_compat_rhel_7_6);
495e37
+
586cba
 GlobalProperty hw_compat_6_2[] = {
586cba
     { "PIIX4_PM", "x-not-migrate-acpi-index", "on"},
586cba
 };
495e37
diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c
586cba
index 46abbc5653..505467059b 100644
495e37
--- a/hw/display/vga-isa.c
495e37
+++ b/hw/display/vga-isa.c
586cba
@@ -88,7 +88,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
495e37
 }
495e37
 
495e37
 static Property vga_isa_properties[] = {
495e37
-    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 8),
495e37
+    DEFINE_PROP_UINT32("vgamem_mb", ISAVGAState, state.vram_size_mb, 16),
495e37
     DEFINE_PROP_END_OF_LIST(),
495e37
 };
495e37
 
495e37
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
586cba
index b72c03d0a6..c797e98312 100644
495e37
--- a/hw/i386/pc_piix.c
495e37
+++ b/hw/i386/pc_piix.c
495e37
@@ -177,6 +177,8 @@ static void pc_init1(MachineState *machine,
495e37
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
495e37
                             mc->name, pcmc->smbios_legacy_mode,
495e37
                             pcmc->smbios_uuid_encoded,
495e37
+                            pcmc->smbios_stream_product,
495e37
+                            pcmc->smbios_stream_version,
586cba
                             pcms->smbios_entry_point_type);
495e37
     }
495e37
 
495e37
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
586cba
index 1780f79bc1..b695f88c45 100644
495e37
--- a/hw/i386/pc_q35.c
495e37
+++ b/hw/i386/pc_q35.c
495e37
@@ -200,6 +200,8 @@ static void pc_q35_init(MachineState *machine)
495e37
         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
495e37
                             mc->name, pcmc->smbios_legacy_mode,
495e37
                             pcmc->smbios_uuid_encoded,
495e37
+                            pcmc->smbios_stream_product,
495e37
+                            pcmc->smbios_stream_version,
586cba
                             pcms->smbios_entry_point_type);
495e37
     }
495e37
 
495e37
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
586cba
index 6b65823b4b..75dacabc43 100644
495e37
--- a/hw/net/rtl8139.c
495e37
+++ b/hw/net/rtl8139.c
495e37
@@ -3179,7 +3179,7 @@ static int rtl8139_pre_save(void *opaque)
495e37
 
495e37
 static const VMStateDescription vmstate_rtl8139 = {
495e37
     .name = "rtl8139",
495e37
-    .version_id = 5,
495e37
+    .version_id = 4,
495e37
     .minimum_version_id = 3,
495e37
     .post_load = rtl8139_post_load,
495e37
     .pre_save  = rtl8139_pre_save,
495e37
@@ -3260,7 +3260,9 @@ static const VMStateDescription vmstate_rtl8139 = {
495e37
         VMSTATE_UINT32(tally_counters.TxMCol, RTL8139State),
495e37
         VMSTATE_UINT64(tally_counters.RxOkPhy, RTL8139State),
495e37
         VMSTATE_UINT64(tally_counters.RxOkBrd, RTL8139State),
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux bz 1420195 */
495e37
         VMSTATE_UINT32_V(tally_counters.RxOkMul, RTL8139State, 5),
495e37
+#endif
495e37
         VMSTATE_UINT16(tally_counters.TxAbt, RTL8139State),
495e37
         VMSTATE_UINT16(tally_counters.TxUndrn, RTL8139State),
495e37
 
495e37
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
586cba
index 60349ee402..0edcc98434 100644
495e37
--- a/hw/smbios/smbios.c
495e37
+++ b/hw/smbios/smbios.c
495e37
@@ -57,6 +57,9 @@ static bool smbios_legacy = true;
495e37
 static bool smbios_uuid_encoded = true;
495e37
 /* end: legacy structures & constants for <= 2.0 machines */
495e37
 
495e37
+/* Set to true for modern Windows 10 HardwareID-6 compat */
495e37
+static bool smbios_type2_required;
495e37
+
495e37
 
495e37
 uint8_t *smbios_tables;
495e37
 size_t smbios_tables_len;
586cba
@@ -639,7 +642,7 @@ static void smbios_build_type_1_table(void)
495e37
 
495e37
 static void smbios_build_type_2_table(void)
495e37
 {
586cba
-    SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, false); /* optional */
586cba
+    SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, smbios_type2_required);
495e37
 
495e37
     SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer);
495e37
     SMBIOS_TABLE_SET_STR(2, product_str, type2.product);
586cba
@@ -914,7 +917,10 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
495e37
 
495e37
 void smbios_set_defaults(const char *manufacturer, const char *product,
495e37
                          const char *version, bool legacy_mode,
495e37
-                         bool uuid_encoded, SmbiosEntryPointType ep_type)
495e37
+                         bool uuid_encoded,
495e37
+                         const char *stream_product,
495e37
+                         const char *stream_version,
495e37
+                         SmbiosEntryPointType ep_type)
495e37
 {
495e37
     smbios_have_defaults = true;
495e37
     smbios_legacy = legacy_mode;
586cba
@@ -935,11 +941,45 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
495e37
         g_free(smbios_entries);
495e37
     }
495e37
 
495e37
+    /*
495e37
+     * If @stream_product & @stream_version are non-NULL, then
495e37
+     * we're following rules for new Windows driver support.
495e37
+     * The data we have to report is defined in this doc:
495e37
+     *
495e37
+     * https://docs.microsoft.com/en-us/windows-hardware/drivers/install/specifying-hardware-ids-for-a-computer
495e37
+     *
495e37
+     * The Windows drivers are written to expect use of the
495e37
+     * scheme documented as "HardwareID-6" against Windows 10,
495e37
+     * which uses SMBIOS System (Type 1) and Base Board (Type 2)
495e37
+     * tables and will match on
495e37
+     *
495e37
+     *   System Manufacturer = Red Hat     (@manufacturer)
495e37
+     *   System SKU Number = 8.2.0         (@stream_version)
495e37
+     *   Baseboard Manufacturer = Red Hat  (@manufacturer)
495e37
+     *   Baseboard Product = RHEL-AV       (@stream_product)
495e37
+     *
495e37
+     * NB, SKU must be changed with each RHEL-AV release
495e37
+     *
495e37
+     * Other fields can be freely used by applications using
495e37
+     * QEMU. For example apps can use the "System product"
495e37
+     * and "System version" to identify themselves.
495e37
+     *
495e37
+     * We get 'System Manufacturer' and 'Baseboard Manufacturer'
495e37
+     */
495e37
     SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
495e37
     SMBIOS_SET_DEFAULT(type1.product, product);
495e37
     SMBIOS_SET_DEFAULT(type1.version, version);
495e37
+    SMBIOS_SET_DEFAULT(type1.family, "Red Hat Enterprise Linux");
495e37
+    if (stream_version != NULL) {
495e37
+        SMBIOS_SET_DEFAULT(type1.sku, stream_version);
495e37
+    }
495e37
     SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer);
495e37
-    SMBIOS_SET_DEFAULT(type2.product, product);
495e37
+    if (stream_product != NULL) {
495e37
+        SMBIOS_SET_DEFAULT(type2.product, stream_product);
495e37
+        smbios_type2_required = true;
495e37
+    } else {
495e37
+        SMBIOS_SET_DEFAULT(type2.product, product);
495e37
+    }
495e37
     SMBIOS_SET_DEFAULT(type2.version, version);
495e37
     SMBIOS_SET_DEFAULT(type3.manufacturer, manufacturer);
495e37
     SMBIOS_SET_DEFAULT(type3.version, version);
495e37
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
495e37
index 050875b497..32935da46c 100644
495e37
--- a/hw/timer/i8254_common.c
495e37
+++ b/hw/timer/i8254_common.c
495e37
@@ -231,7 +231,7 @@ static const VMStateDescription vmstate_pit_common = {
495e37
     .pre_save = pit_dispatch_pre_save,
495e37
     .post_load = pit_dispatch_post_load,
495e37
     .fields = (VMStateField[]) {
495e37
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
495e37
+        VMSTATE_UINT32(channels[0].irq_disabled, PITCommonState), /* qemu-kvm's v2 had 'flags' here */
495e37
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
495e37
                              vmstate_pit_channel, PITChannelState),
495e37
         VMSTATE_INT64(channels[0].next_transition_time,
495e37
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c
495e37
index e934b1a5b1..e18b05e528 100644
495e37
--- a/hw/usb/hcd-xhci-pci.c
495e37
+++ b/hw/usb/hcd-xhci-pci.c
495e37
@@ -104,6 +104,33 @@ static int xhci_pci_vmstate_post_load(void *opaque, int version_id)
495e37
    return 0;
495e37
 }
495e37
 
495e37
+/* RH bz 1912846 */
495e37
+static bool usb_xhci_pci_add_msi(struct PCIDevice *dev, Error **errp)
495e37
+{
495e37
+    int ret;
495e37
+    Error *err = NULL;
495e37
+    XHCIPciState *s = XHCI_PCI(dev);
495e37
+
495e37
+    ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err;;
495e37
+    /*
495e37
+     * Any error other than -ENOTSUP(board's MSI support is broken)
495e37
+     * is a programming error
495e37
+     */
495e37
+    assert(!ret || ret == -ENOTSUP);
495e37
+    if (ret && s->msi == ON_OFF_AUTO_ON) {
495e37
+        /* Can't satisfy user's explicit msi=on request, fail */
495e37
+        error_append_hint(&err, "You have to use msi=auto (default) or "
495e37
+                "msi=off with this machine type.\n");
495e37
+        error_propagate(errp, err);
495e37
+        return true;
495e37
+    }
495e37
+    assert(!err || s->msi == ON_OFF_AUTO_AUTO);
495e37
+    /* With msi=auto, we fall back to MSI off silently */
495e37
+    error_free(err);
495e37
+
495e37
+    return false;
495e37
+}
495e37
+
495e37
 static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
495e37
 {
495e37
     int ret;
495e37
@@ -125,23 +152,12 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
495e37
         s->xhci.nec_quirks = true;
495e37
     }
495e37
 
495e37
-    if (s->msi != ON_OFF_AUTO_OFF) {
495e37
-        ret = msi_init(dev, 0x70, s->xhci.numintrs, true, false, &err;;
495e37
-        /*
495e37
-         * Any error other than -ENOTSUP(board's MSI support is broken)
495e37
-         * is a programming error
495e37
-         */
495e37
-        assert(!ret || ret == -ENOTSUP);
495e37
-        if (ret && s->msi == ON_OFF_AUTO_ON) {
495e37
-            /* Can't satisfy user's explicit msi=on request, fail */
495e37
-            error_append_hint(&err, "You have to use msi=auto (default) or "
495e37
-                    "msi=off with this machine type.\n");
495e37
+    if (s->msi != ON_OFF_AUTO_OFF && s->rh_late_msi_cap) {
495e37
+        /* This gives the behaviour from 5.2.0 onwards, lspci shows 90,a0,70 */
495e37
+        if (usb_xhci_pci_add_msi(dev, &err)) {
495e37
             error_propagate(errp, err);
495e37
             return;
495e37
         }
495e37
-        assert(!err || s->msi == ON_OFF_AUTO_AUTO);
495e37
-        /* With msi=auto, we fall back to MSI off silently */
495e37
-        error_free(err);
495e37
     }
495e37
     pci_register_bar(dev, 0,
495e37
                      PCI_BASE_ADDRESS_SPACE_MEMORY |
495e37
@@ -154,6 +170,14 @@ static void usb_xhci_pci_realize(struct PCIDevice *dev, Error **errp)
495e37
         assert(ret > 0);
495e37
     }
495e37
 
495e37
+    /* RH bz 1912846 */
495e37
+    if (s->msi != ON_OFF_AUTO_OFF && !s->rh_late_msi_cap) {
495e37
+        /* This gives the older RH machine behaviour, lspci shows 90,70,a0 */
495e37
+        if (usb_xhci_pci_add_msi(dev, &err)) {
495e37
+            error_propagate(errp, err);
495e37
+            return;
495e37
+        }
495e37
+    }
495e37
     if (s->msix != ON_OFF_AUTO_OFF) {
495e37
         /* TODO check for errors, and should fail when msix=on */
495e37
         msix_init(dev, s->xhci.numintrs,
495e37
@@ -198,11 +222,18 @@ static void xhci_instance_init(Object *obj)
495e37
     qdev_alias_all_properties(DEVICE(&s->xhci), obj);
495e37
 }
495e37
 
495e37
+static Property xhci_pci_properties[] = {
495e37
+    /* RH bz 1912846 */
495e37
+    DEFINE_PROP_BOOL("x-rh-late-msi-cap", XHCIPciState, rh_late_msi_cap, true),
495e37
+    DEFINE_PROP_END_OF_LIST()
495e37
+};
495e37
+
495e37
 static void xhci_class_init(ObjectClass *klass, void *data)
495e37
 {
495e37
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
495e37
     DeviceClass *dc = DEVICE_CLASS(klass);
495e37
 
495e37
+    device_class_set_props(dc, xhci_pci_properties);
495e37
     dc->reset   = xhci_pci_reset;
495e37
     dc->vmsd    = &vmstate_xhci_pci;
495e37
     set_bit(DEVICE_CATEGORY_USB, dc->categories);
495e37
diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
495e37
index c193f79443..086a1feb1e 100644
495e37
--- a/hw/usb/hcd-xhci-pci.h
495e37
+++ b/hw/usb/hcd-xhci-pci.h
495e37
@@ -39,6 +39,7 @@ typedef struct XHCIPciState {
495e37
     XHCIState xhci;
495e37
     OnOffAuto msi;
495e37
     OnOffAuto msix;
495e37
+    bool      rh_late_msi_cap;  /* bz 1912846 */
495e37
 } XHCIPciState;
495e37
 
495e37
 #endif
495e37
diff --git a/include/hw/boards.h b/include/hw/boards.h
586cba
index c92ac8815c..c90a19b4d1 100644
495e37
--- a/include/hw/boards.h
495e37
+++ b/include/hw/boards.h
586cba
@@ -449,4 +449,25 @@ extern const size_t hw_compat_2_2_len;
495e37
 extern GlobalProperty hw_compat_2_1[];
495e37
 extern const size_t hw_compat_2_1_len;
495e37
 
495e37
+extern GlobalProperty hw_compat_rhel_8_5[];
495e37
+extern const size_t hw_compat_rhel_8_5_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_8_4[];
495e37
+extern const size_t hw_compat_rhel_8_4_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_8_3[];
495e37
+extern const size_t hw_compat_rhel_8_3_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_8_2[];
495e37
+extern const size_t hw_compat_rhel_8_2_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_8_1[];
495e37
+extern const size_t hw_compat_rhel_8_1_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_8_0[];
495e37
+extern const size_t hw_compat_rhel_8_0_len;
495e37
+
495e37
+extern GlobalProperty hw_compat_rhel_7_6[];
495e37
+extern const size_t hw_compat_rhel_7_6_len;
495e37
+
495e37
 #endif
495e37
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
586cba
index 4b7ad77a44..9acff96a86 100644
495e37
--- a/include/hw/firmware/smbios.h
495e37
+++ b/include/hw/firmware/smbios.h
586cba
@@ -272,7 +272,10 @@ void smbios_entry_add(QemuOpts *opts, Error **errp);
495e37
 void smbios_set_cpuid(uint32_t version, uint32_t features);
495e37
 void smbios_set_defaults(const char *manufacturer, const char *product,
495e37
                          const char *version, bool legacy_mode,
495e37
-                         bool uuid_encoded, SmbiosEntryPointType ep_type);
495e37
+                         bool uuid_encoded,
495e37
+                         const char *stream_product,
495e37
+                         const char *stream_version,
495e37
+                         SmbiosEntryPointType ep_type);
495e37
 uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length);
495e37
 void smbios_get_tables(MachineState *ms,
495e37
                        const struct smbios_phys_mem_area *mem_array,
495e37
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
586cba
index 1a27de9c8b..91331059d9 100644
495e37
--- a/include/hw/i386/pc.h
495e37
+++ b/include/hw/i386/pc.h
586cba
@@ -113,6 +113,9 @@ struct PCMachineClass {
495e37
     bool smbios_defaults;
495e37
     bool smbios_legacy_mode;
495e37
     bool smbios_uuid_encoded;
495e37
+    /* New fields needed for Windows HardwareID-6 matching */
495e37
+    const char *smbios_stream_product;
495e37
+    const char *smbios_stream_version;
495e37
 
495e37
     /* RAM / address space compat: */
495e37
     bool gigabyte_align;
495e37
-- 
586cba
2.31.1
495e37