Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
    • Access Attributes
    • Firewalls and Filtering
    • Address Translation for Devices
    • Link Integrity and Encryption
    • Fabric Denial of Service
    • Isolation and Multi-Tenancy
    • Drills: Security and Isolation
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 14: Security and Isolation
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 14: Security and Isolation
  4. Address Translation for Devices

Part 14 · Security and Isolation · Senior (S)

Address Translation for Devices

A device that can DMA to any physical address can read or overwrite anything. An IOMMU gives each device its own address space, translated and checked on every access. How it works, what it costs, and how devices cache translations without losing the protection.

On this page

    Note

    Level: Senior (S) · Answers: Who is allowed to ask?

    Before this: Firewalls and Filtering

    A network card is given a buffer to receive packets into. Its driver writes the buffer's physical address into the card, and the card writes there with DMA. But nothing stops the card writing anywhere else: a bug in its firmware, a malicious device plugged into an external port, or a corrupted descriptor, and it overwrites the kernel. Processes have had protected address spaces for decades. Devices, by default, have none.

    How is a device limited to the memory it is supposed to use?

    The obvious answer, and why it breaks

    The obvious answer is a firewall with regions for each device (lesson 14.2). Region tables are coarse and few: a modern system has many devices, each using many scattered pages that change constantly as buffers are allocated and freed. What is needed is the same mechanism that protects processes: page tables, per device, checked on every access.

    The idea: an MMU for devices

    • Each device (or function, or stream) gets its own page tables, set up by the operating system or hypervisor.

    • The device issues I/O virtual addresses; the IOMMU, in the path between the device and memory, translates each to a physical address using the device's tables.

    • Unmapped or wrongly permitted accesses fault: the access is refused (with an error response) and the fault is reported to software.

    • Identity comes from the fabric: the IOMMU selects the tables from the request's requester or stream ID (lesson 14.1). A device builds its own packets and could put any ID in them, so the fabric must check it: in PCIe, ACS Source Validation at the switch or root port rejects a request whose requester ID does not belong to the port it arrived on.

    • Translations are cached in the IOMMU's TLB; a miss walks the page tables in memory.

    Mapped accesses are translated and passed on; an access outside the device's mappings never reaches memory, and the fault is reported.

    Costs, and caching translations at the device

    Cost

    Mitigation

    Latency of a translation on each access

    IOMMU TLBs; large pages

    Page-table walks on TLB misses

    Bigger TLBs; prefetching; locality in buffer allocation

    Software cost of mapping and unmapping buffers

    Long-lived mappings for buffer pools (with weaker protection between uses)

    Translation latency for high-bandwidth devices

    Device-side translation caches (ATS): the device asks the IOMMU for translations and caches them, and the IOMMU invalidates them when mappings change

    Device-side caching keeps the protection only if invalidation is reliable: when the operating system unmaps a buffer, the IOMMU must invalidate the device's cached translation and wait for it to confirm, before the memory is reused.

    How real protocols chose

    System

    Device translation

    Arm SMMU, Intel VT-d

    Per-device (stream or requester ID) translation and fault reporting for DMA (fact A28)

    PCI Express ATS

    Endpoints request and cache translations from the IOMMU, with invalidation messages when mappings change (fact P35)

    PCI Express PASID

    Tags requests with an address-space ID so one device can work in several processes' address spaces (fact P35)

    What breaks

    A driver (illustrative) unmapped a receive buffer and freed the memory without waiting for the IOMMU's invalidation to complete. For a few microseconds the device still had a valid cached translation, and a late packet landed in memory the kernel had already given to another process. Waiting for the invalidation's completion before freeing the page closed the window.

    Why this matters

    Senior lens. Treat every DMA-capable device as untrusted and put an IOMMU in its path, with tables keyed on an identity the fabric checks (ACS Source Validation in PCIe), not one the device merely claims. Then budget the translation cost (TLB reach, walk latency) for the device's bandwidth, and if translations are cached at the device, make invalidation and its completion part of every unmap.

    Interview

    Asked: "Why put an IOMMU in front of devices?"

    Weak answer: To make DMA faster.

    Strong answer: Because without one a DMA-capable device can read or write any physical address, so a firmware bug, a bad descriptor or a malicious device can overwrite the kernel or read secrets. An IOMMU gives each device its own page tables: the device issues I/O virtual addresses, the IOMMU translates them using tables chosen by the device's requester or stream ID, which the device can't forge, and refuses and reports anything unmapped. It also lets virtual machines own devices directly. The costs are translation latency and TLB misses, mitigated with TLBs, large pages and device-side caching with ATS, which needs reliable invalidation.

    Follow-ups: (1) What must happen before freeing a DMA buffer when ATS is used? (2) How does the IOMMU know which device sent a request?

    Check yourself Why can't a malicious device pretend to be another device to use its mappings?

    The IOMMU selects tables by the requester or stream ID assigned by the fabric, not by anything the device chooses.

    Check yourself What does a device-side translation cache add, and what does it require?

    Lower translation latency; it requires the IOMMU to invalidate cached entries, and wait for confirmation, whenever mappings change.

    Key takeaways

    • Without an IOMMU, a DMA-capable device can access any physical memory.

    • An IOMMU translates and checks every device access with per-device page tables chosen by an unforgeable identity.

    • Cache translations for speed, but make invalidation and its completion part of every unmap.

    Keep going

    Next: Lesson 14.4, Link Integrity and Encryption. Protecting the wires themselves: integrity and encryption on links.

    Related topics

    • Part 14 overview: Security and Isolation

    Previous

    191 / 234

    Next: Link Integrity and Encryption

    Up next

    Up nextLink Integrity and Encryption

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Access Attributes
    • Fabric Denial of Service
    • Isolation and Multi-Tenancy