JOURNEY / PCIe, IOMMU, POWER
One NIC, three stops
The other pages each take one topic apart. This one follows a single
network card, the one at 03:00.0, through all three, so
you can see where each topic hands over to the next. Think of the
card as a courier. PCIe decides whether the courier may leave the
depot at all. The IOMMU decides which door the courier may deliver
to. Power is the courier's night's sleep: after it, nobody should
trust that the courier still remembers either rule until each has
been checked again.
- PCIe: read the card, then turn on BusMaster, the switch that lets it start a write. Reading lspci, Before DMA.
- IOMMU: map one page for requester
03:00.0and watch 16 bytes land in it, while an unmapped address is refused. 16 bytes, IOMMU foundations. - Power: close the gate, sleep, wake and restore, in order. Then repeat the write. Device sleep & wake, System sleep.
What claims does this page make? 3 points
- Linux behaviour:
pci_set_master()sets the BusMaster bit, andpci_restore_state()writes a device's saved configuration back; whether a card lost it in D3hot is decided byPCI_PM_CTRL_NO_SOFT_RESET, which the PCI power-up code checks. AMD's driver disables the IOMMU on suspend and reloads it on resume (amd_iommu_suspend(),amd_iommu_resume()); all read in Linux v6.12. - Public specification: the AMD IOMMU picks a device's page tables by its requester ID and caches translations, as dmakit models it (AMD 48882 rev 3.11).
- Teaching model: the order of the sleep and wake steps is the power lab's declared lifecycle, and which state the card loses in sleep is that fixture's choice, not a measurement. The card and its addresses are invented.
Experiments
One platform, chosen for teaching: a PC whose IOMMU sits in the root complex, as on AMD and Intel systems.
Experiment
This "What if" step ran on its own copy; the panels show that copy.
What each stop handed to the next
- PCIe to IOMMU: the card's address,
03:00.0, became its requester ID. Without BusMaster the IOMMU never saw a request; with it, the requester ID picked the context, and that context's mappings and permissions decided whether this request could reach its target. - IOMMU to power: the mapping lives in page tables in memory and survives the card's sleep, but the IOMMU's cached copies of it do not deserve trust. Skip the reload and a stale entry writes into a page that now belongs to someone else (try the "What if" before the reload).
- Power back to PCIe: a woken card may have lost its configuration, BusMaster included. The write after waking is only allowed because each earlier stop was repeated in order.
This is the validation habit in miniature: after any transition, do not trust the success message, restore what was lost, then send a fresh allowed request and a fresh forbidden one and check both. Investigate a failure practises it on a fault record.
Sources
- Linux v6.12:
drivers/pci/pci.c(pci_set_master(),pci_set_power_state(),pci_restore_state(), the NO_SOFT_RESET check inpci_power_up()),include/uapi/linux/pci_regs.h(PCI_PM_CTRL_NO_SOFT_RESET),drivers/iommu/amd/init.c(amd_iommu_suspend(),amd_iommu_resume()), read on 2 October 2026. - AMD I/O Virtualization Technology (IOMMU) Specification, 48882 rev 3.11, as modelled by dmakit: INVALIDATE_DEVTAB_ENTRY, INVALIDATE_IOMMU_PAGES and COMPLETION_WAIT.
- The power lab's lifecycle model, Power management, reference. The PCI Express Base Specification (PCI-SIG, members only) defines BusMaster and power states; this page does not rely on it.