From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGOEe-0005sS-0P for qemu-devel@nongnu.org; Wed, 28 Jan 2015 03:44:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGOEZ-0002mB-6F for qemu-devel@nongnu.org; Wed, 28 Jan 2015 03:44:27 -0500 Received: from [59.151.112.132] (port=9536 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGOEY-0002jd-Lt for qemu-devel@nongnu.org; Wed, 28 Jan 2015 03:44:23 -0500 From: Chen Fan Date: Wed, 28 Jan 2015 16:37:28 +0800 Message-ID: <8c9d087c2a0bbcddfcb938a87ca35f461dd2613a.1422433767.git.chen.fan.fnst@cn.fujitsu.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC v2 8/8] vfio-pci: add VFIO_FEATURE_ENABLE_AER_CAP feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcel@redhat.com, izumi.taku@jp.fujitsu.com, Alex Williamson for old machine types, we should disable aercap feature. Signed-off-by: Chen Fan --- 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