术语/Terminology

4 MMIO

MMIO(Memory-Mapped I/O)与PMIO(Port-Mapped I/O，也称为Isolated I/O)，是CPU与外设交互的两种方式。

MMIO模式下，内存与IO外设寄存器使用相同的地址空间，CPU使用相同的指令存取内存与IO 外设寄存器。

LINUX系统下cat /proc/iomem查看物理地址空间布局。

8 SR-IOV

SR-IOV(Single Root Input/Ouput Virtualization)是PCIe规范的扩展。

8.1 Microsoft Doc View

The single root I/O virtualization (SR-IOV) interface is an extension to the PCI Express (PCIe) specification. SR-IOV allows a device, such as a network adapter, to separate access to its resources among various PCIe hardware functions. These functions consist of the following types:

• A PCIe Physical Function (PF). This function is the primary function of the device and advertises the device's SR-IOV capabilities. The PF is associated with the Hyper-V parent partition in a virtualized environment.
• One or more PCIe Virtual Functions (VFs). Each VF is associated with the device's PF. A VF shares one or more physical resources of the device, such as a memory and a network port, with the PF and other VFs on the device. Each VF is associated with a Hyper-V child partition in a virtualized environment.

Each PF and VF is assigned a unique PCI Express Requester ID (RID) that allows an I/O memory management unit (IOMMU) to differentiate between different traffic streams and apply memory and interrupt translations between the PF and VFs. This allows traffic streams to be delivered directly to the appropriate Hyper-V parent or child partition. As a result, nonprivileged data traffic flows from the PF to VF without affecting other VFs.

SR-IOV enables network traffic to bypass the software switch layer of the Hyper-V virtualization stack. Because the VF is assigned to a child partition, the network traffic flows directly between the VF and child partition. As a result, the I/O overhead in the software emulation layer is diminished and achieves network performance that is nearly the same performance as in nonvirtualized environments.

• Translation

SR-IOV是PCIe规范的扩展，它允许一个设备（比如网络适配器）在多个硬件功能中分离其资源访问。这些功能包括如下两类：

1. 一个PCIe物理功能(PF)。此功能是设备主要功能，通告此设备有SR-IOV能力。在虚拟化环境中，此PF与Hyper-V父分区关联；
2. 一个或多个虚拟功能(VFs)。每个VF与此设备的PF关联。一个VF与PF及其他VF分享此设备的一个或多个物理资源，如内存或网络端口。在虚拟化环境中，每个VF关联到 Hyper-V子分区；

SR-IOV使网络流绕过Hyper-V虚拟化栈的软件层。因为VF分配给一个子分区，网络业务直接在VF和子分区之间流动。因此，消除了仿真软件层的IO负载，达到接近非虚拟化环境网络性能。