qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v2 8/8] vfio-pci: add VFIO_FEATURE_ENABLE_AER_CAP feat


From: Chen Fan
Subject: [Qemu-devel] [RFC v2 8/8] vfio-pci: add VFIO_FEATURE_ENABLE_AER_CAP feature
Date: Wed, 28 Jan 2015 16:37:28 +0800

for old machine types, we should disable aercap feature.

Signed-off-by: Chen Fan <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]