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