vfio/pci: Device request support
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | vfio: Add device tracking during unbinddrivers/ | +71 | 0 replies | |
| 2/5 | vfio: Tie IOMMU group reference to vfio groupdrivers/ | +11 | 0 replies | |
| 3/5 | vfio: Add and use device request op for vfio bus driversdrivers/ include/ | +24 | 0 replies | |
| 4/5 | vfio-pci: Generalize setup of simple eventfdsdrivers/ | +29 | 0 replies | |
| 5/5 | vfio-pci: Add device request interfacedrivers/ drivers/ drivers/ +1 more | +38 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/5] vfio/pci: Device request support
Currently when the host kernel attempts to unbind an in-use device from a vfio driver, we simply block until userspace releases the device. With a cooperative userspace client, we can do better (we can potentially do better with a non-cooperative client too, but this series does not attempt to address that). Instead of idly waiting, we can poke the vfio bus driver using a new device request callback. For vfio-pci, this is exposed to the user as a new device management interrupt, like the error reporting interrupt. With a userspace client like QEMU, this can be tied to an unplug request, allowing for automatic removal of a device from a VM when an unbind request is made on the host. This of course presumes that the host operation takes precedence over VM policy or else the VM would not choose to be cooperative to the request.
A couple issues are fixed to make this reliable, the first being to close a race where a driver stalled on an unbind can create a small window where the vfio group is non-viable. This can interfere with attempts to acquire a group reference to match and release an existing reference. The other problem is that our IOMMU group ref is tied to the device, so if the device is removed, the IOMMU group can be removed, putting the vfio group in an awkward state. The reference is moved to the vfio group to prevent this. The rest is a straight forward addition of a callback and eventfd notifier path. Thanks,
Alex
---
Alex Williamson (5):
vfio-pci: Add device request interface
vfio-pci: Generalize setup of simple eventfds
vfio: Add and use device request op for vfio bus drivers
vfio: Tie IOMMU group reference to vfio group
vfio: Add device tracking during unbind
drivers/vfio/pci/vfio_pci.c | 21 ++++++ drivers/vfio/pci/vfio_pci_intrs.c | 60 +++++++++++++----- drivers/vfio/pci/vfio_pci_private.h | 1 drivers/vfio/vfio.c | 119 +++++++++++++++++++++++++++++++---- include/linux/vfio.h | 2 + include/uapi/linux/vfio.h | 1 6 files changed, 173 insertions(+), 31 deletions(-)