interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / GB10_DMA_ROUTE_INVENTORY.md

172 lines · 15588 bytes Raw Blame History Source

GB10 DMA route and confinement inventory (aienos#286, cut B4)

Report only. Host only. No code was changed, no hardware was touched, no QEMU run was made. Base commit of aienos read: a9b15b9 (main).

Tags: [SOURCE file:line] read in the named file. [INFERRED] reasoned from sources, not directly shown. [UNKNOWN] nothing read answers it. Paths without a repo prefix are in aienos. physics: is the local checkout of aien-spark/physics at e95e3ed (the dependency map pins 6d7cf0d; the nvrm.c lines cited below match the pinned lines in that map).

1. Short answer

2. What the platform tells me about the GB10 stream

FactTag
GB10 is 000f:01:00.0, 10de:2e12, BAR0 64 MiB at 0x24000000, ECAM segment 15 at 0x29000000[SOURCE docs/GB10_PLATFORM_TOPOLOGY.md:35,60-66,121]
IORT table is present (3904 bytes); Linux reports one Arm SMMUv3, 40-bit output, 2-level stream table covering 25 of 32 stream-ID bits, default domain Translated[SOURCE docs/GB10_PLATFORM_TOPOLOGY.md:68-74] (Linux observed)
GB10 is alone in IOMMU group 20[SOURCE docs/GB10_PLATFORM_TOPOLOGY.md:73-74]
The GB10's IORT stream ID and stream table entry are not decoded by this project[SOURCE docs/GB10_PLATFORM_TOPOLOGY.md:76-78,165]
Resolved in cut B5: GB10 = StreamID 0x100 on the IORT's second SMMUv3 node (base 0x13000000). Cut B7a (QEMU/host only): the kernel routes a requester to its own SMMUv3 node and brings that node up on first use, mapping the RMR ranges beside the window; running this on SMMUv3 B is cut B7b (machine window)[SOURCE docs/GB10_IORT_DECODE.md sections 4, 9]
Stream 0x100 fits both the linear table (STE_N 4096) and the two-level table[SOURCE native/kernel/core/smmu_svc.c]
Three SMMUv3 nodes in the IORT (A 0x13800000 PCI segments 0..14 + USB, B 0x13000000 segment 15 + HDA0, C platform peripherals)[SOURCE docs/GB10_IORT_DECODE.md section 3]

Note: the kernel's lookup is ck_iort_stream_id(segment, rid). For the GB10 the inputs would be segment 15 and rid 0x0100 (bus 1, device 0, function 0). [INFERRED] from rid = bus<<8|dev<<3|fn (native/kernel/include/ck.h:~120-125) and the topology address. Whether the IORT has a mapping for segment 15 is [UNKNOWN].

3. Route table (device, system memory, and back)

"Confinement" is what restrains the route in aienos today.

#RouteExists in aienos today?What confines it todayMissing
R1CPU to GB10 registers (BAR0 reads)Yes, read only. [SOURCE native/kernel/dev/mmio_window.c:63-95]A capability with READ, DERIVE, REVOKE only; WRITE, MAP, GRANT refused at creation. Pages are owned by the window, mapped exclusively, unmapped on revoke. Mapping is Device RW even though the accessor is read only. [SOURCE native/kernel/dev/mmio_window.h:17-47]Any write accessor. Any doorbell mapping (USERMODE 64 KiB region). Read-only mapping type.
R2GB10 to system memory (device reads/writes host RAM: ring contents, pushbuffer, data, completion flag writes)No.Mechanism exists in general: ck_dma_confine(segment, rid, phys, len) gives that requester one stage-1 table mapping only [phys, phys+len); everything else faults and aborts. [SOURCE native/kernel/include/ck.h:98-126; native/kernel/core/smmu_svc.c:134-145,172-208]Stream id for the GB10 [UNKNOWN]; a caller; a capability tie (below); a decision whether this route should be the SMMU at all.
R3CPU to GB10-visible memory (CPU fills GPFIFO, pushbuffer, QMD; polls completion flag)Only as the generic DMA pool ck_dma_alloc: contiguous, zeroed, Normal Non-cacheable, never freed, 8 MiB. [SOURCE native/kernel/include/ck.h:38-42; native/kernel/mm/mmu.c:198-211,319-336]The pool is fixed; confinement window must be a sub-range of it by convention of the existing callers (xhci_fence.c:261-268, net_bind.c:27-30). Nothing enforces that a window lies inside the pool. [INFERRED] ck_dma_confine accepts any 4 KiB aligned phys/len (smmu_svc.c:134-139)A pool large enough for GPU use [UNKNOWN: required size], freeing, per-capability ownership of pages.
R4GB10 internal page tables (GPU VA to physical)No.Linux RM/UVM builds these; today's code only asks. [SOURCE docs/GB10_NATIVE_DEPENDENCY_MAP.md:136]Whole thing. GPU MMU format [UNKNOWN] (map section 8 item 2).
R5GPFIFO ring and USERDNo native. In the Linux path: one allocation, ring 1024 entries x 8 bytes, USERD at offset 8192 in the same allocation, handed to RM as system memory. [SOURCE physics:nvrm/nvrm.c:631-640]n/a nativelyLayout owner, doorbell/work-submit token derivation [UNKNOWN] (map item 3).
R6Pushbuffer and kernel/QMD buffersNo native. Linux path: ordinary nvrm_alloc buffers. [INFERRED] from physics:nvrm/nvrm.c:465-467n/a nativelyAs R3.
R7Completion flags (host-polled markers)No native. Linux path: GPU writes a marker via release methods; host polls with usleep; a second marker follows an L2 flush; no interrupt. [SOURCE docs/GB10_NATIVE_DEPENDENCY_MAP.md:139]n/a nativelyWait service, and the cache rule in section 5.
R8GB10 interrupts (MSI-X into GIC ITS)No. This is a device-to-memory-or-interrupt-controller write, so it is also an outbound DMA write path. [INFERRED]n/aMSI-X table and PBA live in BAR0 (offsets 0x00b90000 / 0x00ba0000) [SOURCE docs/GB10_PLATFORM_TOPOLOGY.md:80-83]; ITS doorbell address would need to be inside the window or in a SMMU bypass for MSIs [UNKNOWN]. Polling is the current assumption.
R9Peer or P2P DMA (GB10 to another PCI device)No.n/aNot examined. [UNKNOWN]

4. What confines a route, and what does not

Present in aienos:

  1. SMMU comes up with global abort set, every stream aborts, until a stream is explicitly given a window. Any bring-up failure leaves it aborting. [SOURCE native/kernel/core/smmu.c:340-350; native/kernel/core/smmu_svc.c:94-128; native/kernel/include/ck.h:98-112]
  2. Window shape: single span, identity IOVA, Normal Non-cacheable, read/write, never executable, unprivileged device accesses allowed. [SOURCE native/kernel/core/smmu_svc.c:15-19,187]
  3. Limits: at most 8 confined streams (CK_DMA_MAX_STREAMS), one window per stream, stage 1 only (S2 bypass in the STE config). [SOURCE native/kernel/include/ck.h:117; native/kernel/core/smmu.c:113]
  4. Faults are readable per stream through the event queue (ck_dma_faults). [SOURCE native/kernel/core/smmu_svc.c:223-247]
  5. Unconfine returns the stream to abort. It does not free the pool pages and does not itself require bus mastering to be off: the header says the caller turns bus mastering off first. [SOURCE native/kernel/include/ck.h:160-163]
  6. Streams behind a different SMMU are refused, never granted unconfined (named components path). [SOURCE native/kernel/core/smmu_svc.c:147-170] For PCI requesters via ck_dma_confine the lookup only uses maps parsed for the first SMMU. [INFERRED] from g.iort use at smmu_svc.c:134-145 and ck_iort_stream_id core/acpi.c:417-434

Not present, relevant to the GB10:

5. Cache rule on GB10 and what aienos does with it

Rule (vendor header, local): NVOS32_ATTR2_GPU_CACHEABLE: "DEFAULT - Highest performance cache policy that is coherent with the highest performance CPU mapping. Typically this is gpu cached for video memory and gpu uncached for system memory. YES - Enable gpu caching if supported on this surface type. For system memory this will not be coherent with direct CPU mappings." [SOURCE nvidia-open-580.173.02/src/common/sdk/nvidia/inc/nvos.h:1113-1126]

My layer: nvrm_alloc forces GPU_CACHEABLE_YES; nvrm_alloc_gpu_uncached forces NO and says it is "for memory both sides poll, not for bulk data". [SOURCE physics:nvrm/nvrm.c:465-474,500] On physics main 9f96f25 the GPFIFO ring plus USERD are allocated with nvrm_alloc_gpu_uncached (comment: a GPU-cached allocation can retain their previous contents on GB10; CPU store barriers alone do not invalidate that cached copy), so the Linux path already honours the project rule for them (CHIPWAIT root cause, omega HD-16, physics#28). The error notifier is still allocated with nvrm_alloc, GPU-cacheable YES. [SOURCE physics:nvrm/nvrm.c:628-632 at 9f96f25, read from GitHub by the reviewer; an older local checkout e95e3ed predates the fix and showed both cached] Whether the cached notifier matters depends on who reads it and when; not examined here. [UNKNOWN] The native backend must make the same choice explicitly for every host-polled word. [INFERRED]

What aienos does today:

6. Linux RM behaviours the native backend must reproduce or refuse

Behaviour (Linux)SourceNative stance
All GB10 allocations are system memory (no local video memory)physics:nvrm/nvrm.c:498 (comment "GB10 has no local video memory")Reproduce: one memory class.
Cache policy chosen per allocation (attr2 GPU_CACHEABLE), with CPU mapping uncachednvos.h:1113-1126; physics:nvrm/nvrm.c:470-472Reproduce as an explicit per-buffer flag; refuse default-YES for anything the host polls.
Non-contiguous physical allocations allowed (PHYSICALITY_ALLOW_NONCONTIGUOUS)physics:nvrm/nvrm.c:499Decide. Today's SMMU window is one contiguous span, so non-contiguous needs either contiguous backing or multi-span windows.
RM may or may not put an SMMU mapping on GPU physical allocations ("SMMU mapping for GPU physical allocation decided internally by RM"; override attribute NVOS32_ATTR2_SMMU_ON_GPU DEFAULT/DISABLE/ENABLE, documented for Tegra)nvos.h:1154-1162Linux GB10 decides this internally; the policy for GB10 specifically is [UNKNOWN] (the header names Tegra, and the local vendor tree has no RM implementation, see section 8). Native must not assume bypass: topology doc says it must not bypass the SMMU (docs/GB10_PLATFORM_TOPOLOGY.md:111-113).
IOMMU virtual address space index is chosen by RM for Tegra VA spacesnvos.h:3045Not obviously relevant to GB10 PCI. [UNKNOWN]
Page-table build and teardown done by UVM/RM (UVM_CREATE_EXTERNAL_RANGE, NV_ESC_RM_MAP_MEMORY_DMA, UVM_MAP_EXTERNAL_ALLOCATION, UVM_FREE, NV_ESC_RM_UNMAP_MEMORY_DMA)docs/GB10_NATIVE_DEPENDENCY_MAP.md:136Must reproduce (R4). Largest gap.
Channel creation, runlist, work-submit token, schedulephysics:nvrm/nvrm.c:631-650Reproduce; token derivation [UNKNOWN].
Quarantine on failed map (a VA is not recycled when driver state is unknown)physics:nvrm/nvrm.c:515,520Reproduce: never reuse a DMA window or VA after an unknown failure. [INFERRED] sensible; not required by any source
Completion is host polling, no driver interruptdocs/GB10_NATIVE_DEPENDENCY_MAP.md:139Deliberately keep polling first.
GSP firmware load, reset, powerdocs/GB10_NATIVE_DEPENDENCY_MAP.md:244Out of scope for this inventory.

7. Proposed shape for the next cuts (INFERRED, for review, not a decision)

  1. Decode the GB10's IORT mapping read-only (segment 15, rid 0x0100): which SMMU node, which stream ID, within STE_N. Host parser test on the recorded IORT, then one read-only log line on the Spark. This answers the top unknown.
  2. Only after (1): extend the SMMU window to a capability-bound object that mirrors the MMIO window (rights, exclusive pages, unmap and abort on revoke), and add a multi-span or per-buffer variant.
  3. Pool size and freeing for GPU use.
  4. GPU page-table and cache attributes belong to the cut that owns the GPU MMU.

Cut D-style actions that program the SMMU for the real GB10 would be operator steps on the physical machine and are not part of this report.

8. What was read and limits

Vendor sources (local nvidia-open-580.173.02, recorded with docs-read): nvos.h:1113-1119 (cache policy), nvos.h:1154-1162 (SMMU_ON_GPU), nvos.h:196-207 (NVOS02 coherency and cacheable flags), nvos.h:3045 (Tegra IOMMU VA space index).

DOCS SILENT: the local vendor tree holds headers only (kernel-open/common, kernel-open/nvidia-uvm, src/common/sdk, src/nvidia/arch); a search for SMMU and IOMMU finds hits only in nvos.h. The RM and kernel code that decides how GB10 system memory is DMA-mapped is not present locally, so the real Linux behaviour for SMMU mapping on GB10 is not shown by any source I read. The Context7 vendor docs were not queried in this cut; the DGX Spark user guide is not known to cover this (spark-hardware-manual section 2).

Not done: omega's evidence for the uncached rule was not re-read; physics was read at its local commit e95e3ed, not the pinned 6d7cf0d; no hardware or QEMU run; the actual IORT of the Spark was not decoded.