Skip to content

vfio-pci: Reset improvements

Alex Williamson kvm linux-pci lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vfio-pci: Release devices with BusMaster disableddrivers/vfio/pci/vfio_pci.c+8 -20 replies
2/3vfio-pci: Use mutex around open, release, and removedrivers/vfio/pci/vfio_pci.c drivers/vfio/pci/vfio_pci_private.h+26 -110 replies
3/3vfio-pci: Attempt bus/slot reset on releasedrivers/vfio/pci/vfio_pci.c drivers/vfio/pci/vfio_pci_private.h+113 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] vfio-pci: Reset improvements

This series is intended to improve the state of devices returned back to the host from vfio-pci or re-used by another user. First we make sure that busmaster is disabled in the saved state, so the device cannot continue to do DMA, then we add some serialization, move our reference counting under it to fix an unlikely bug should we fail to initialize a device, and add the ability to do bus/slot reset on device release. To do this, we require all devices affected by the bus/slot reset to be bound to vfio-pci, therefore users sequestering devices with pci-stub will need to bind them to vfio-pci to see this change.

The effect of these changes are perhaps most noticeable with GPU assignment to a VM, where killing QEMU results in a static image on the framebuffer since no reset of the device was done. Returning the GPU to a host device at this point was suspect. Other devices, like USB controllers, also don't necessarily appreciate being abruptly disconnected from their IOMMU domain and would generate IOMMU faults in the event the user process is killed. Both of these cases should be resolved here, assuming all the devices on the bus are bound to vfio-pci and at least one of the devices in use does not support a function-local reset.

Please test and comment. Thanks,

Alex

---

Alex Williamson (3):
vfio-pci: Attempt bus/slot reset on release
vfio-pci: Use mutex around open, release, and remove
vfio-pci: Release devices with BusMaster disabled

 drivers/vfio/pci/vfio_pci.c         |  157 ++++++++++++++++++++++++++++++++---
 drivers/vfio/pci/vfio_pci_private.h |    3 -
 2 files changed, 147 insertions(+), 13 deletions(-)