I/O Virtualization and DMA
Direct memory access lets devices transfer data to and from memory without per-word processor involvement, and I/O virtualization extends this to safely share physical devices among virtual machines, both central to efficient modern and cloud systems.
Definition
Direct memory access is a mechanism by which a device transfers data directly to or from main memory without the processor copying each datum, and I/O virtualization is the set of techniques that present and share physical I/O devices among multiple virtual machines safely and efficiently.
Scope
This topic covers direct memory access (DMA) and the virtualization of I/O: how DMA controllers move bulk data and signal completion, the role of the IOMMU in address translation and protection for device transfers, and techniques for sharing devices among virtual machines such as device emulation, paravirtualization, and hardware-assisted passthrough. It treats efficient and safe device data movement. It excludes basic device control and interrupts (I/O architecture and buses) and storage media (secondary storage devices).
Core questions
- How does DMA transfer bulk data without occupying the processor?
- How does an IOMMU provide address translation and protection for device transfers?
- How are physical devices shared safely among virtual machines?
- What are the trade-offs among device emulation, paravirtualization, and passthrough?
Key concepts
- direct memory access (DMA)
- DMA controller and descriptors
- completion interrupts
- IOMMU and device address translation
- device emulation
- paravirtualized I/O
- device passthrough and SR-IOV
- isolation and protection
Key theories
- Direct memory access
- A DMA controller transfers blocks of data between a device and memory autonomously, interrupting the processor only on completion, which overlaps I/O with computation and is essential to high-throughput data movement.
Mechanisms
For a DMA transfer the processor programs a controller with the source, destination, and length, then continues other work while the device moves the data and raises a completion interrupt. An IOMMU translates the addresses devices use and confines their access, providing protection and enabling safe passthrough. Virtual machines access devices through emulated devices, paravirtualized drivers, or direct hardware passthrough (including single-root I/O virtualization that lets one device present multiple virtual functions).
Clinical relevance
DMA is fundamental to efficient I/O, freeing the processor during bulk transfers to and from storage and network devices. I/O virtualization is essential to cloud computing and data centers, where many virtual machines share physical hardware; the IOMMU provides the isolation that makes sharing and direct device assignment both safe and fast.
History
Direct memory access has been used since early computers to offload data movement from the processor. As virtualization became central to servers and cloud computing in the 2000s, hardware support such as the IOMMU and single-root I/O virtualization was added to make device sharing and direct assignment efficient and secure.
Debates
- Passthrough performance versus flexibility
- Direct device passthrough gives virtual machines near-native I/O performance but reduces flexibility for migration and oversubscription, whereas emulated or paravirtualized I/O is more flexible but slower; system designers balance these for their workloads.
Key figures
- John L. Hennessy
- David A. Patterson
- Abraham Silberschatz
Related topics
Seminal works
- hennessy2019
- silberschatz2018
Frequently asked questions
- What does an IOMMU do?
- An IOMMU translates the addresses that devices use during DMA into physical memory addresses and restricts which memory a device may access. This provides protection and isolation — preventing a device or driver from corrupting arbitrary memory — and enables safe direct assignment of devices to virtual machines.
- Why is DMA important for performance?
- Without DMA the processor would have to copy every word to or from a device, consuming cycles and stalling on slow transfers. DMA offloads bulk data movement to a dedicated controller, letting the processor do other useful work and only handle a single completion interrupt.