An Introduction to PCI Device Assignment with VFIO
Alex Williamson / alex.williamson@redhat.com
Officially:
...but it's not limited to SR-IOV, or even PCI
Some suggest...
Sort of, yeah...
I've also heard...
Fabric?
Let me propose...
(OK, not really, but it's more accurate)
Weren't we talking about device assignment...
Device assignment is simply a multi-layer userspace driver
VFIO takes an abstract view of a device, we want to support anything
These are all regions
Even PCI config space itself is a region
VFIO_DEVICE_GET_INFO
Q: How does a device signal the driver?
A: Interrupts
EVENTFD(2) Linux Programmer's Manual EVENTFD(2)
NAME
eventfd - create a file descriptor for event notification
SYNOPSIS
#include <sys/eventfd.h>
int eventfd(unsigned int initval, int flags);
DESCRIPTION
eventfd() creates an "eventfd object" that can be used as an event
wait/notify mechanism by user-space applications, and by the kernel
to notify user-space applications of events...
Need an MMU for I/O, an IOMMU
Both required for secure user access
Solution: Page pinning
A device decomposed
"Creating fake devices since 2003"
How does VM programmed I/O reach a device?
How do guest PCI Config accesses reach a device?
Transparent VM mapping
• How does the guest program a device? QEMU: MemoryRegions* VFIO: Device file descriptor regions
• How does a device signal the guest? QEMU: EventNotifiers VFIO/KVM: Eventfds/irqfds configured via ioctls
• How does a device transfer data? QEMU: MemoryListeners VFIO: IOMMU mapping & pinning ioctls
*Except PCI configuration space
Workaround for NVIDIA Hyper-V detection "bug"
-cpu ...,hv_vendor_id=KeenlyKVM
<hyperv>
...
<vendor_id state='on' value='KeenlyKVM'/>
...
</hyperv>
QEMU 2.5+, libvirt v1.3.3+
vGPU on KVM - A VFIO Based Frameworkby Neo Jia & Kirti Wankhede from NVIDIAThursday 10am
http://awilliam.github.io/presentations/KVM-Forum-2016
Alex Williamson / alex.williamson@redhat.com