for old machine types, we should disable aercap feature. Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com> --- hw/vfio/pci.c | 13 ++++++++++--- include/hw/compat.h | 4 ++++ 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 65247ee..0d830e6 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -138,6 +138,8 @@ typedef struct VFIOMSIXInfo { enum { #define VFIO_FEATURE_ENABLE_VGA_BIT 0 VFIO_FEATURE_ENABLE_VGA = (1 << VFIO_FEATURE_ENABLE_VGA_BIT), +#define VFIO_FEATURE_ENABLE_AER_CAP_BIT 1 + VFIO_FEATURE_ENABLE_AER_CAP = (1 << VFIO_FEATURE_ENABLE_AER_CAP_BIT), }; typedef struct VFIOPCIDevice { @@ -2724,10 +2726,12 @@ static int vfio_add_ext_capabilities(VFIOPCIDevice *vdev) while (header) { switch (PCI_EXT_CAP_ID(header)) { case PCI_EXT_CAP_ID_ERR: - exp = &pdev->exp; - exp->aer_cap = next; + if (vdev->features & VFIO_FEATURE_ENABLE_AER_CAP) { + exp = &pdev->exp; + exp->aer_cap = next; - vfio_pci_aer_init(vdev); + vfio_pci_aer_init(vdev); + } break; }; @@ -3498,6 +3502,9 @@ static Property vfio_pci_dev_properties[] = { DEFINE_PROP_BIT("x-vga", VFIOPCIDevice, features, VFIO_FEATURE_ENABLE_VGA_BIT, false), DEFINE_PROP_INT32("bootindex", VFIOPCIDevice, bootindex, -1), + DEFINE_PROP_BIT("aercap", VFIOPCIDevice, features, + VFIO_FEATURE_ENABLE_AER_CAP_BIT, true), + /* * TODO - support passed fds... is this necessary? * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name), diff --git a/include/hw/compat.h b/include/hw/compat.h index 313682a..72a2cdb 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -30,6 +30,10 @@ .driver = "virtio-pci",\ .property = "virtio-pci-bus-master-bug-migration",\ .value = "on",\ + },{\ + .driver = "vfio-pci",\ + .property = "aercap",\ + .value = "off",\ } #endif /* HW_COMPAT_H */ -- 1.9.3