How the IOMMU Work to Communicate CPU and Peripherals

IOMMU

One of the most important pieces in contemporary CPUs is the IOMMU , which is essential for the CPU’s communication with system peripherals . In this article we explain what it is and the functions of this so unknown by the public as an essential piece of hardware found in all types of computer systems, from the smartphone in your pocket to the most powerful supercomputer

How do peripherals interact with the CPU? Using the RAM of the system as a common point to communicate mutually, but this implies a series of mechanisms, the most important being the one we are going to describe below.

Where is the IOMMU located?

IOMMU Northbridge Southbridge

As can be seen in the diagram above, the peripherals are connected to the Southbridge or South Bridge, this in turn is connected to the Northbridge, which is the hub with which mainly the interface of the RAM and the CPU communicate. each. Well, the IOMMU is located inside the Southbridge which is where all the I / O interfaces such as USB, PCI Express, SATA, etc. are concentrated.

All of these interfaces must come under the control of the IOMMU in order to access the system RAM. In this case, the IOMMU acts as a kind of border control that monitors that the peripherals do not make illegal access to the memory and access the part of the RAM assigned to each of them and nowhere else.

The IOMMU, therefore, acts as MMU, but for I / O peripherals.

What is its usefulness?

IOMMU

I / O peripherals do not share the MMU (memory management unit) with the CPU and therefore do not view memory in the same way as the central system processor. This problem makes peripherals able to access parts of the system memory that are sensitive, such as those reserved for functions of the operating system itself, which is a problem in multitasking environments.

This is where the IOMMU comes in, acting as a slave unit to the MMU to which it is communicated via the system’s North / Northbridge. Thanks to this communication, the peripherals know in which RAM addresses they have access permission and in which they do not.

On the other hand, the IOMMU automatically and dynamically assigns memory addresses for communication with the different peripherals, in this way the CPU always knows which memory addresses it has to point to to communicate with them.

IOMMU Original PC Memory Map

In older systems, an IOMMU was not available and a memory map was provided with them where programmers were informed which RAM addresses were intended to communicate with devices. For this reason, developers in each different architecture had to learn memory addressing in order to use peripherals and other supporting hardware in the system.

Today this is no longer the case, and the existence of the IOMMU makes it easier for developers not to have to learn memory addresses to communicate and extends the configuration and customization capabilities of our PCs allowing completely different configurations.

Using the IOMMU in virtualized systems

IOMMU Device Passthrough

The IOMMU enables secure access to physical devices in virtualized environments through what we call device passthrough. The tandem between the MMU and the IOMMU allows the devices connected to the PC to appear in the virtual memory space that does the function of physical memory for the virtual environment that is currently running.

Without the IOMMU, virtualized environments that have correct access to the hardware installed in the system would not be possible, which is why today it is an indispensable piece in all CPUs that have to handle virtualized environments.