linux/drivers/vfio/pci
Alex Williamson 4e1a635552 vfio/pci: Use kernel VPD access functions
The PCI VPD capability operates on a set of window registers in PCI
config space.  Writing to the address register triggers either a read
or write, depending on the setting of the PCI_VPD_ADDR_F bit within
the address register.  The data register provides either the source
for writes or the target for reads.

This model is susceptible to being broken by concurrent access, for
which the kernel has adopted a set of access functions to serialize
these registers.  Additionally, commits like 932c435cab ("PCI: Add
dev_flags bit to access VPD through function 0") and 7aa6ca4d39
("PCI: Add VPD function 0 quirk for Intel Ethernet devices") indicate
that VPD registers can be shared between functions on multifunction
devices creating dependencies between otherwise independent devices.

Fortunately it's quite easy to emulate the VPD registers, simply
storing copies of the address and data registers in memory and
triggering a VPD read or write on writes to the address register.
This allows vfio users to avoid seeing spurious register changes from
accesses on other devices and enables the use of shared quirks in the
host kernel.  We can theoretically still race with access through
sysfs, but the window of opportunity is much smaller.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Mark Rustad <mark.d.rustad@intel.com>
2015-10-27 14:53:05 -06:00
..
Kconfig vfio: Split virqfd into a separate module for vfio bus drivers 2015-03-17 08:33:38 -06:00
Makefile vfio: initialize the virqfd workqueue in VFIO generic code 2015-03-16 14:08:54 -06:00
vfio_pci_config.c vfio/pci: Use kernel VPD access functions 2015-10-27 14:53:05 -06:00
vfio_pci_intrs.c vfio: move eventfd support code for VFIO_PCI to a separate file 2015-03-16 14:08:54 -06:00
vfio_pci_private.h vfio: move eventfd support code for VFIO_PCI to a separate file 2015-03-16 14:08:54 -06:00
vfio_pci_rdwr.c vfio-pci: Add support for VGA region access 2013-02-18 10:11:13 -07:00
vfio_pci.c vfio/pci: Fix racy vfio_device_get_from_dev() call 2015-06-09 10:08:57 -06:00