kernel_optimize_test/drivers/vfio
Alex Williamson 9c22e660ce vfio-pci: Release devices with BusMaster disabled
Our current open/release path looks like this:

vfio_pci_open
  vfio_pci_enable
    pci_enable_device
    pci_save_state
    pci_store_saved_state

vfio_pci_release
  vfio_pci_disable
    pci_disable_device
    pci_restore_state

pci_enable_device() doesn't modify PCI_COMMAND_MASTER, so if a device
comes to us with it enabled, it persists through the open and gets
stored as part of the device saved state.  We then restore that saved
state when released, which can allow the device to attempt to continue
to do DMA.  When the group is disconnected from the domain, this will
get caught by the IOMMU, but if there are other devices in the group,
the device may continue running and interfere with the user.  Even in
the former case, IOMMUs don't necessarily behave well and a stream of
blocked DMA can result in unpleasant behavior on the host.

Explicitly disable Bus Master as we're enabling the device and
slightly re-work release to make sure that pci_disable_device() is
the last thing that touches the device.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-08-07 11:12:02 -06:00
..
pci vfio-pci: Release devices with BusMaster disabled 2014-08-07 11:12:02 -06:00
Kconfig vfio: always select ANON_INODES 2014-03-27 11:58:58 -06:00
Makefile drivers/vfio: EEH support for VFIO PCI device 2014-08-05 15:28:48 +10:00
vfio_iommu_spapr_tce.c drivers/vfio: EEH support for VFIO PCI device 2014-08-05 15:28:48 +10:00
vfio_iommu_type1.c vfio/iommu_type1: Avoid overflow 2014-05-30 11:35:54 -06:00
vfio_spapr_eeh.c drivers/vfio: EEH support for VFIO PCI device 2014-08-05 15:28:48 +10:00
vfio.c driver core: dev_set_drvdata can no longer fail 2014-05-27 13:40:51 -07:00