SR-IOV Networking in Xen: Architecture, Design and Implementation  2008 USENIX

SR-IOV 设备可以把一个物理设备分解成多个虚拟部件(VF),各VM可直接访问VF,无须经过VMM,从而大大提高性能。An SRIOV devicepresents single or multiple Physical Functions (PFs) which are standardPCIe functions. Each PF can have zero or more Virtual Functions (VFs)which is a “light-weight” PCIe function that has enough resource formajor data movement, as well as a unique requester identifier (RID) toindex the IOMMU page table for address translation.

需要的支持:
  • Direct I/O access (also known as device pass through)
  • Guest MMIO(Memory Mapped IO) of pass through device
  • MSI and MSIX mechanism provide software ability to program interrupt vector for individual MSI or MSI-X interrupt source. 中断可以直接到VF,不需要VMM分发。
  • IOMMU


XEN的实现
the Physical Function has a driver running in the driver domain that serves as a “master” and each Virtual Function exposed to a guest VM has itsown virtual driver.

VF的配置过程还是需要trap and emulate,而MDD 负责set the number of VFs, globally enableor disable VFs, as well as network specific configurations such as MACaddress and VLAN setting for each VF.
A Virtual Function Device Driver (VDD) running in the guest.VFconfiguration space access from VDD is trap and emulated by VMM topresent guest a standard PCIe device to reuse existing PCI
subsystem for discovery, initialization and configuration, which simplifies guest OS and
device driver. 因为VF不是真正的PCI设备,无法正常自举,Xen SR-IOV networking architecture
utilizes Linux PCI hot plug API to dynamically add VFs to dom0 Linux.

PF driver, or Master Device Driver (MDD), running in driver domain (dom0in Xen) controls underlying shared resources for all associated VFs. MDD 有更好的安全控制各个VF(比起xen 原来把整个设备用于某个VM相比)

PF/VF通信是利用Intel 提供的硬件机制

好处:
1  direct I/O throughput and reduced CPU utilization
2 increasing the scalability
3  sharing capabilities of the device.(主要是指VF各种网络配置最终映射到PF有复用的可能)

示例设备:SR-IOV network card (Intel 82576)
SR-IOV Networking in Xen: Architecture, Design and Implementation
Intel Ethernet SR-IOV Toolkit
SR-IOV support in Xen
VT-d and SR-IOV Update - Xen
12-23 21:58