---
hw/i386/pc_piix.c | 8 ++++++++
hw/i386/pc_q35.c | 8 ++++++++
hw/ppc/spapr.c | 11 ++++++++++-
hw/virtio/virtio-pci.c | 17 +++++++++++++++--
hw/virtio/virtio-pci.h | 3 +++
include/hw/compat.h | 11 +++++++++++
6 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 0796719..8808500 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -552,6 +552,10 @@ static QEMUMachine pc_i440fx_machine_v2_3 = {
PC_I440FX_2_3_MACHINE_OPTIONS,
.name = "pc-i440fx-2.3",
.init = pc_init_pci_2_3,
+ .compat_props = (GlobalProperty[]) {
+ HW_COMPAT_2_3,
+ { /* end of list */ }
+ },
};
#define PC_I440FX_2_2_MACHINE_OPTIONS PC_I440FX_2_3_MACHINE_OPTIONS
@@ -560,6 +564,10 @@ static QEMUMachine pc_i440fx_machine_v2_2 = {
PC_I440FX_2_2_MACHINE_OPTIONS,
.name = "pc-i440fx-2.2",
.init = pc_init_pci_2_2,
+ .compat_props = (GlobalProperty[]) {
+ HW_COMPAT_2_2,
+ { /* end of list */ }
+ },
};
#define PC_I440FX_2_1_MACHINE_OPTIONS \
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index a8a34a4..4a34349 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -448,6 +448,10 @@ static QEMUMachine pc_q35_machine_v2_3 = {
PC_Q35_2_3_MACHINE_OPTIONS,
.name = "pc-q35-2.3",
.init = pc_q35_init_2_3,
+ .compat_props = (GlobalProperty[]) {
+ HW_COMPAT_2_3,
+ { /* end of list */ }
+ },
};
#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS
@@ -456,6 +460,10 @@ static QEMUMachine pc_q35_machine_v2_2 = {
PC_Q35_2_2_MACHINE_OPTIONS,
.name = "pc-q35-2.2",
.init = pc_q35_init_2_2,
+ .compat_props = (GlobalProperty[]) {
+ HW_COMPAT_2_2,
+ { /* end of list */ }
+ },
};
#define PC_Q35_2_1_MACHINE_OPTIONS \
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 5f25dd3..853a5cc 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1794,12 +1794,16 @@ static const TypeInfo spapr_machine_info = {
},
};
+#define SPAPR_COMPAT_2_3 \
+ HW_COMPAT_2_3
+
#define SPAPR_COMPAT_2_2 \
+ SPAPR_COMPAT_2_3, \
{\
.driver = TYPE_SPAPR_PCI_HOST_BRIDGE,\
.property = "mem_win_size",\
.value = "0x20000000",\
- }
+ } \
#define SPAPR_COMPAT_2_1 \
SPAPR_COMPAT_2_2
@@ -1883,10 +1887,15 @@ static const TypeInfo
spapr_machine_2_2_info = {
static void spapr_machine_2_3_class_init(ObjectClass *oc, void
*data)
{
+ static GlobalProperty compat_props[] = {
+ SPAPR_COMPAT_2_3,
+ { /* end of list */ }
+ };
MachineClass *mc = MACHINE_CLASS(oc);
mc->name = "pseries-2.3";
mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3";
+ mc->compat_props = compat_props;
}
static const TypeInfo spapr_machine_2_3_info = {
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 4a5febb..f4cd405 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -925,7 +925,7 @@ static void
virtio_pci_device_plugged(DeviceState *d)
VirtIOPCIProxy *proxy = VIRTIO_PCI(d);
VirtioBusState *bus = &proxy->bus;
uint8_t *config;
- uint32_t size;
+ uint32_t size, bar_size;
config = proxy->pci_dev.config;
if (proxy->class_code) {
@@ -936,8 +936,19 @@ static void
virtio_pci_device_plugged(DeviceState *d)
pci_set_word(config + PCI_SUBSYSTEM_ID,
virtio_bus_get_vdev_id(bus));
config[PCI_INTERRUPT_PIN] = 1;
+ if (proxy->flags & VIRTIO_PCI_FLAG_AUTO_MSIX_SIZE) {
+ bar_size = proxy->nvectors * PCI_MSIX_ENTRY_SIZE * 2;
+ if (bar_size & (bar_size - 1)) {
+ bar_size = 1 << qemu_fls(bar_size);
+ }
+ } else {
+ /* For migration compatibility */
+ bar_size = 4096;
+ }
+
if (proxy->nvectors &&
- msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors,
1, 4096)) {
+ msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors,
1,
+ bar_size)) {
error_report("unable to init msix vectors to %" PRIu32,
proxy->nvectors);
proxy->nvectors = 0;