{"id":"process-dma-address-spaces","name":"Process, physical and device address spaces","shortName":"One buffer, three addresses","role":"Trace the same allocated bytes through separate CPU virtual and device-visible mappings.","description":"A matrix buffer has an identity and contents independent of the address used to reach it. The CPU executes in an address space that translates process virtual addresses into physical storage. A DMA-capable device issues its own addresses, which can pass through a separate translation. Confusing these namespaces can make a descriptor unusable even though its numerical value looks like a valid pointer. In the teaching trace, the CPU and device reach the same buffer by different base addresses while preserving the offset within the buffer. Each namespace has its own bounds. The inspection table records the process identity, virtual base, physical base, device base and current epoch, so a copied address can be checked against its intended interpreter. These are declared sixteen-byte regions rather than a real page-table layout. They illustrate translation without pretending to model page pinning, page faults, TLB walks or virtual-machine isolation.","mechanism":["The process owns A, B and C as stable sixteen-byte objects.","CPU writes use virtual addresses and translate to the corresponding physical region.","The driver supplies a device-visible IOVA in the command descriptor, not a process pointer.","A device translation selects physical storage and adds the byte offset within its declared region.","Each word occupies four bytes; the last word begins twelve bytes after the buffer base.","An address from the wrong namespace has no matching range in this specimen and is rejected."],"prerequisites":["host-cpu","firmware-device-contract"],"related":["iommu-buffer-identity","pcie-interface","pcie-cxl-semantics"],"specs":[{"label":"A bases","value":"VA 0x1000 → PA 0x4000 ← IOVA 0x8000","context":"Chosen teaching addresses, expressed in bytes."},{"label":"B bases","value":"VA 0x2000 → PA 0x5000 ← IOVA 0x9000","context":"A separate object even if equal values happen to be stored."},{"label":"C bases","value":"VA 0x3000 → PA 0x6000 ← IOVA 0xA000","context":"Device write permission; sixteen allocated bytes."}],"interfaces":[{"name":"Declared runtime inputs","direction":"in","signal":"Stable matrix job, buffer identities and the stated device/visibility contract"},{"name":"Inspectable accepted or rejected result","direction":"out","signal":"Event trace, actual buffer values and bounded completion/work ledger"}],"science":[{"title":"Preserve the offset across address spaces","equation":"Physical address equals its buffer base plus the virtual or device byte offset.","explanation":"Under the correct two mappings, a CPU and a device address with the same in-buffer offset reach the same physical byte.","assumptions":"The virtual and device bases refer to the same declared object. The inequality bounds a single byte; a multi-byte access must fit completely."}],"engineeringExample":"For A[1,1], the row-major element index is 3 and its four-byte word starts at offset 12. CPU VA 0x100C and device IOVA 0x800C both resolve to PA 0x400C. Passing 0x100C directly to this device fails: its device table starts A at 0x8000, not 0x1000. Passing 0x800C to the process mapping likewise fails. Equal physical destination follows from two explicit mappings, not from numerical equality of the pointers.","learningObjective":"Resolve a matrix element from both virtual and device address spaces and identify which namespace a descriptor must contain.","misconception":"An address is interpreted within an address space; an application pointer is not automatically a DMA address.","check":{"question":"Which device address reaches A’s fourth word in this declared map?","options":["0x100C","0x400C","0x800C"],"answer":2,"explanation":"The descriptor uses the device base 0x8000 plus twelve bytes."},"checks":[],"whyAI":"Tensor runtimes pass buffers through host and accelerator execution. Keeping object identity separate from pointers prevents mistakes when memory is remapped or devices have distinct addressing constraints.","tradeoff":"Translation enables placement and isolation but adds state that must remain valid for the whole access lifetime. Real page granularity can expose more storage than a small logical buffer, which this byte-range teaching model does not simulate.","evidenceNotes":"Primary sources establish the cited runtime mechanisms. Numerical values, address ranges, ABI strings, event schedule and reset/retry epochs are authored teaching contracts. No real device, firmware image, operating-system driver, page table, cache protocol or security verification is executed.","sourceIds":["runtime-linux-dma-616"],"sources":[{"title":"Linux 6.16 — Dynamic DMA mapping Guide","url":"https://docs.kernel.org/6.16/core-api/dma-api-howto.html"}],"workedTrace":{"modelVersion":"commissioning-execution-1","scenario":"default","word":3,"offsetBytes":12,"virtual":4108,"iova":32780,"physical":16396},"level":"software","branch":"Executable software","subbranch":"Commissioning and runtime boundaries","scale":"One process and device job; logical states and byte addresses, no timing or physical geometry","kind":"system","workstream":"N12","visualFamily":"software-flow","labId":"library","investigationId":"execution","labScope":"The commissioning-execution-1 studio executes this bounded 2×2 matrix, buffer and completion contract. The surrounding atlas scene is conceptual; it is not a firmware emulator or system simulator.","history":[]}