add a new "aercap" feature in vfio device, for controlling whether expose aer capability.
Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com> --- hw/vfio/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index bf314a1..c21b40b 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 { @@ -2721,8 +2723,10 @@ static int vfio_add_ext_cap(VFIOPCIDevice *vdev, uint16_t pos) switch (cap_id) { case PCI_EXT_CAP_ID_ERR: - pcie_add_capability(pdev, cap_id, cap_ver, pos, size); - vfio_setup_pcie_aer(vdev, pos); + if (vdev->features & VFIO_FEATURE_ENABLE_AER_CAP) { + pcie_add_capability(pdev, cap_id, cap_ver, pos, size); + vfio_setup_pcie_aer(vdev, pos); + } break; default: pcie_add_capability(pdev, cap_id, cap_ver, pos, size); @@ -3487,6 +3491,8 @@ 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), -- 1.9.3