[libvirt] [PATCH 0/2] check IOMMU group devices usage during vfio device passthrough

Shivaprasad G Bhat shivaprasadbhat at gmail.com
Thu Dec 4 07:26:25 UTC 2014


Problem:
====================================================================
If a device in the same iommu group is in use by a different vm, the guest boot
fails with the below error during vfio passthrough.
bash-4.2$ virsh start demo
error: Failed to start domain demo
error: internal error: process exited while connecting to monitor:
2014-12-02T13:43:52.020136Z qemu-system-x86_64: -device vfio-pci,host=00:1c.3,id=hostdev0,bus=pci.0,addr=0x5: vfio: error opening /dev/vfio/7: Device or resource busy

Solution:
=====================================================================
The patch iterates through the iommu group devices and errors out cleanly
mentioning the device and the guest which is using the device.

With Patch
bash-4.2$ virsh start demo
error: Failed to start domain demo
error: Requested operation is not valid: PCI device 0000:0d:00.0 is in use by driver QEMU, domain vm10

---

Shivaprasad G Bhat (2):
      Move struct _virPCIDevice definition from virpci.c to virpci.h
      check IOMMU group devices usage when preparing device for vfio passthrough


 src/util/virhostdev.c |   87 +++++++++++++++++++++++++++++--------------------
 src/util/virpci.c     |   29 ----------------
 src/util/virpci.h     |   30 +++++++++++++++++
 3 files changed, 82 insertions(+), 64 deletions(-)

-- 
Signature




More information about the libvir-list mailing list