> From: Alex Williamson [mailto:alex.william...@redhat.com] > Sent: Thursday, January 21, 2016 2:07 AM > > vfio-pci currently requires a host= parameter, which comes in the > form of a PCI address in [domain:]<bus:slot.function> notation. We > expect to find a matching entry in sysfs for that under > /sys/bus/pci/devices/. vfio-platform takes a similar approach, but > defines the host= parameter to be a string, which can be matched > directly under /sys/bus/platform/devices/. On the PCI side, we have > some interest in using vfio to expose vGPU devices. These are not > actual discrete PCI devices, so they don't have a compatible host PCI > bus address or a device link where QEMU wants to look for it. There's > also really no requirement that vfio can only be used to expose > physical devices, a new vfio bus and iommu driver could expose a > completely emulated device. To fit within the vfio framework, it > would need a kernel struct device and associated IOMMU group, but > those are easy constraints to manage. > > To support such devices, which would include vGPUs, that honor the > VFIO PCI programming API, but are not necessarily backed by a unique > PCI address, add support for specifying any device in sysfs. The > vfio API already has support for probing the device type to ensure > compatibility with either vfio-pci or vfio-platform. > > With this, a vfio-pci device could either be specified as: > > -device vfio-pci,host=02:00.0 > > or > > -device vfio-pci,sysfsdev=/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0 > > or even > > -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:02:00.0 > > When vGPU support comes along, this might look something more like: > > -device vfio-pci,sysfsdev=/sys/devices/virtual/intel-vgpu/vgpu0@0000:00:02.0 > > NB - This is only a made up example path, but it should be noted that > the device namespace is global for vfio, a virtual device cannot > overlap with existing namespaces and should not create a name prone to > conflict, such as a simple instance number. >
Thanks Alex! It's a good improvement to support coming vgpu feature. Just curious. Does the virtual device name has to include a BDF format or it can be random strings (e.g. just "vgpu0")? In the latter case, then overlapping chance would be small. Thanks Kevin