From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 11/11] vfio/pci: Add option to disable GeForce quirks
Date: Mon, 05 Feb 2018 11:58:18 -0700 [thread overview]
Message-ID: <20180205185818.14391.75315.stgit@gimli.home> (raw)
In-Reply-To: <20180205185416.14391.5739.stgit@gimli.home>
These quirks are necessary for GeForce, but not for Quadro/GRID/Tesla
assignment. Leaving them enabled is fully functional and provides the
most compatibility, but due to the unique NVIDIA MSI ACK behavior[1],
it also introduces latency in re-triggering the MSI interrupt. This
overhead is typically negligible, but has been shown to adversely
affect some (very) high interrupt rate applications. This adds the
vfio-pci device option "x-no-geforce-quirks=" which can be set to
"on" to disable this additional overhead.
A follow-on optimization for GeForce might be to make use of an
ioeventfd to allow KVM to trigger an irqfd in the kernel vfio-pci
driver, avoiding the bounce through userspace to handle this device
write.
[1] Background: the NVIDIA driver has been observed to issue a write
to the MMIO mirror of PCI config space in BAR0 in order to allow the
MSI interrupt for the device to retrigger. Older reports indicated a
write of 0xff to the (read-only) MSI capability ID register, while
more recently a write of 0x0 is observed at config space offset 0x704,
non-architected, extended config space of the device (BAR0 offset
0x88704). Virtualization of this range is only required for GeForce.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/pci-quirks.c | 9 ++++++---
hw/vfio/pci.c | 2 ++
hw/vfio/pci.h | 1 +
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 60ad5fb91a83..e5779a7ad35b 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -542,7 +542,8 @@ static void vfio_vga_probe_nvidia_3d0_quirk(VFIOPCIDevice *vdev)
VFIOQuirk *quirk;
VFIONvidia3d0Quirk *data;
- if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
+ if (vdev->no_geforce_quirks ||
+ !vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
!vdev->bars[1].region.size) {
return;
}
@@ -660,7 +661,8 @@ static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr)
VFIONvidiaBAR5Quirk *bar5;
VFIOConfigWindowQuirk *window;
- if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
+ if (vdev->no_geforce_quirks ||
+ !vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
!vdev->vga || nr != 5 || !vdev->bars[5].ioport) {
return;
}
@@ -754,7 +756,8 @@ static void vfio_probe_nvidia_bar0_quirk(VFIOPCIDevice *vdev, int nr)
VFIOQuirk *quirk;
VFIOConfigMirrorQuirk *mirror;
- if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
+ if (vdev->no_geforce_quirks ||
+ !vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
!vfio_is_vga(vdev) || nr != 0) {
return;
}
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index cab2aecb8094..879510c046cd 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3130,6 +3130,8 @@ static Property vfio_pci_dev_properties[] = {
DEFINE_PROP_BOOL("x-no-kvm-intx", VFIOPCIDevice, no_kvm_intx, false),
DEFINE_PROP_BOOL("x-no-kvm-msi", VFIOPCIDevice, no_kvm_msi, false),
DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false),
+ DEFINE_PROP_BOOL("x-no-geforce-quirks", VFIOPCIDevice,
+ no_geforce_quirks, false),
DEFINE_PROP_UINT32("x-pci-vendor-id", VFIOPCIDevice, vendor_id, PCI_ANY_ID),
DEFINE_PROP_UINT32("x-pci-device-id", VFIOPCIDevice, device_id, PCI_ANY_ID),
DEFINE_PROP_UINT32("x-pci-sub-vendor-id", VFIOPCIDevice,
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 588381f201b4..f4aa13e021fa 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -146,6 +146,7 @@ typedef struct VFIOPCIDevice {
bool no_kvm_intx;
bool no_kvm_msi;
bool no_kvm_msix;
+ bool no_geforce_quirks;
} VFIOPCIDevice;
uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len);
next prev parent reply other threads:[~2018-02-05 18:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 18:56 [Qemu-devel] [PULL 00/11] VFIO updates 2018-02-05 Alex Williamson
2018-02-05 18:56 ` [Qemu-devel] [PULL 01/11] memory/iommu: Add get_attr() Alex Williamson
2018-02-05 18:56 ` [Qemu-devel] [PULL 02/11] vfio/spapr: Use iommu memory region's get_attr() Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 03/11] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 04/11] vfio/pci: Fixup VFIOMSIXInfo comment Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 05/11] vfio/pci: Add base BAR MemoryRegion Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 06/11] vfio/pci: Emulate BARs Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 07/11] qapi: Create DEFINE_PROP_OFF_AUTO_PCIBAR Alex Williamson
2018-02-05 18:57 ` [Qemu-devel] [PULL 08/11] vfio/pci: Allow relocating MSI-X MMIO Alex Williamson
2018-02-05 18:58 ` [Qemu-devel] [PULL 09/11] hw/vfio/platform: Init the interrupt mutex Alex Williamson
2018-02-05 18:58 ` [Qemu-devel] [PULL 10/11] vfio/common: Remove redundant copy of local variable Alex Williamson
2018-02-05 18:58 ` Alex Williamson [this message]
2018-02-06 17:34 ` [Qemu-devel] [PULL 00/11] VFIO updates 2018-02-05 Peter Maydell
2018-02-06 18:04 ` Alex Williamson
-- strict thread matches above, loose matches on Subject: below --
2018-02-06 18:42 [Qemu-devel] [PULL 00/11] VFIO updates 2018-02-06 Alex Williamson
2018-02-06 18:44 ` [Qemu-devel] [PULL 11/11] vfio/pci: Add option to disable GeForce quirks Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180205185818.14391.75315.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).