diff --git a/.crumb b/.crumb index ef844abf..bd8ac4d4 100644 --- a/.crumb +++ b/.crumb @@ -27,33 +27,33 @@ "purpose": "Directory crates. Purpose not yet described by a human." }, { - "digest": "11efd71d613be5ca1fb6405abb1688d6d3f72fd1ac1e5dc8e091734d0f2688a0", - "last_commit": "bc16c14", + "digest": "b52fed726bbf13ba8bae39bf6a5fd76fea7c2eca620cc5ddb6518820982dd864", + "last_commit": "036cef6", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { "digest": "46b6348c6d3b05c623e9ef9814d8b90ed1cc6449906f361d41547b264b12dd50", - "last_commit": "e4abc01", + "last_commit": "a9b15b9", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { "digest": "72ac07324618c0fce9dc8a227666dec8ee62d66865103810f494e7d7e12b924f", - "last_commit": "ac4e021", + "last_commit": "a9b15b9", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." } ], - "children_root": "sha256:257ee1500de1e80a15ee5e24ed6a186707e0cd797879962a4f2971f4340b6072", - "compiled_at": "2026-10-09T12:47:22Z", + "children_root": "sha256:98ddd37f0f56b5601e6d7dd0434544462baad800f24158803264e603e403721a", + "compiled_at": "2026-10-10T01:37:30Z", "compiler": "crumb-compile/1", - "digest": "sha256:4b75e7310a6b6c1cef9096cbc8a4f2fc26628057e80fa46275c1c75e60598880", + "digest": "sha256:d1a0004d7aa63c4f4ead2b4b45f9352a025f627f663ada6237c64e21ca508554", "evidence_files": 155, "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7", - "files": 3032, - "generated_at_commit": "e4abc01d183d0bf59804b848443802c0151de57a", - "source_tree": "sha256:5fe25eb2ab994c467b6ef0dfc7d3ce7489274f636e781dfcb6385a151804f101" + "files": 3033, + "generated_at_commit": "036cef68db02d23e8cce93bfb6aa7c8581a65d40", + "source_tree": "sha256:b20800d14a3706109848fcf6a44c4b13202ed195098befa4de9a9da3d029eacd" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index 39a39942..eaf3e4a7 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -24,20 +24,20 @@ }, { "digest": "e9e804e088a0b2316d035b957c09289bf9f6176eece959d43c40c6e66005fe5e", - "last_commit": "7e15a57", + "last_commit": "31ed9f8", "name": "crumbs", "purpose": "Directory docs/crumbs. Purpose not yet described by a human." } ], "children_root": "sha256:55bcc89f5282eb2e3f4e86d882abdfb5f4ea39e427ef97ef620b2267e5701eb1", - "compiled_at": "2026-10-08T15:18:36Z", + "compiled_at": "2026-10-10T01:37:30Z", "compiler": "crumb-compile/1", - "digest": "sha256:11efd71d613be5ca1fb6405abb1688d6d3f72fd1ac1e5dc8e091734d0f2688a0", + "digest": "sha256:b52fed726bbf13ba8bae39bf6a5fd76fea7c2eca620cc5ddb6518820982dd864", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 64, - "generated_at_commit": "0f70efd93df7cfb2fa9444cd310518ec17fb24d9", - "source_tree": "sha256:f49c87e18a4fd3bb65aad1d6e550068930af578493cc12322d7d6fecc1b4ea2d" + "files": 65, + "generated_at_commit": "036cef68db02d23e8cce93bfb6aa7c8581a65d40", + "source_tree": "sha256:0514cd046293fe02accf66ed9b2dc859d107920b0d4bf705a37839133d4f5da2" }, "owner_lane": "", "provenance": { diff --git a/docs/GB10_DMA_ROUTE_INVENTORY.md b/docs/GB10_DMA_ROUTE_INVENTORY.md new file mode 100644 index 00000000..93b81638 --- /dev/null +++ b/docs/GB10_DMA_ROUTE_INVENTORY.md @@ -0,0 +1,172 @@ +# 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-dev/physics at `e95e3ed` (the dependency map pins `6d7cf0d`; the nvrm.c +lines cited below match the pinned lines in that map). + +## 1. Short answer + +- Today the native kernel has one DMA confinement mechanism: an SMMUv3 stage-1 + window of one contiguous span, per stream, identity-mapped, Normal + Non-cacheable. It is used by the USB keyboard and the virtual NIC path. + Nothing connects it to the GB10. [SOURCE native/kernel/core/smmu_svc.c:15-19,172-208] +- No GB10 DMA route exists in aienos today. The GB10 is discovered + (vendor/device, BAR) and its BAR0 can be read through a capability-bound + read-only window. It has no SMMU stream, no DMA memory, no completion flag, + no ring. [SOURCE native/kernel/dev/mmio_window.h:1-47; native/kernel/svc/tests/stage_test.c:265,297] + Searching the kernel `core/` and `dev/` directories finds no `2e12` or `gb10`. [SOURCE grep, native/kernel/core, native/kernel/dev] +- The biggest open fact: whether the GB10's memory traffic goes through the SMMU + window this kernel can program at all is not established. [UNKNOWN] + (dependency map section 8 item 6, docs/GB10_NATIVE_DEPENDENCY_MAP.md:248.) + +## 2. What the platform tells us about the GB10 stream + +| Fact | Tag | +|---|---| +| 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] | +| Which SMMU node the GB10's IORT mapping points at (the kernel drives only the IORT's first SMMUv3 node) | [UNKNOWN] | +| Whether the GB10's stream ID is below the 4096 stream IDs the aienos stream table covers (`STE_N`) | [UNKNOWN] | +| Number of SMMUs on the machine, beyond "an Arm SMMUv3" | [UNKNOWN] (platform USB nodes may sit behind a second one; see `CK_SMMU_OTHER`, native/kernel/include/ck.h:99-100) | + +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. + +| # | Route | Exists in aienos today? | What confines it today | Missing | +|---|---|---|---|---| +| R1 | CPU 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. | +| R2 | GB10 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. | +| R3 | CPU 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. | +| R4 | GB10 internal page tables (GPU VA to physical) | No. | Linux RM/UVM builds these; our code only asks. [SOURCE docs/GB10_NATIVE_DEPENDENCY_MAP.md:136] | Whole thing. GPU MMU format [UNKNOWN] (map section 8 item 2). | +| R5 | GPFIFO ring and USERD | No 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 natively | Layout owner, doorbell/work-submit token derivation [UNKNOWN] (map item 3). | +| R6 | Pushbuffer and kernel/QMD buffers | No native. Linux path: ordinary `nvrm_alloc` buffers. [INFERRED] from physics:nvrm/nvrm.c:465-467 | n/a natively | As R3. | +| R7 | Completion 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 natively | Wait service, and the cache rule in section 5. | +| R8 | GB10 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/a | MSI-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. | +| R9 | Peer or P2P DMA (GB10 to another PCI device) | No. | n/a | Not 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: + +- Capability binding for DMA. The MMIO window has a capability (rights, revoke, + unmap). The SMMU window does not: `ck_dma_confine` is a plain function; nothing + ties a confinement to a capability handle, revoke, or page ownership. [SOURCE native/kernel/include/ck.h:98-136 shows no handle argument; native/kernel/dev/mmio_window.h:1-47 for the MMIO side] +- Multiple discontiguous spans per stream (a GPU working set is many buffers). [SOURCE one `ck_pt_map` call, smmu_svc.c:187] +- Window growth, shrink or page-granular revoke while the stream is live. [INFERRED] no such function exists in ck.h +- Freeing DMA pages: the pool is never freed. [SOURCE native/kernel/include/ck.h:41-42] +- Substream IDs, ATS/PRI, stalls: no references found in the aienos SMMU code. [SOURCE grep, native/kernel/core/smmu.c]. Whether the GB10 needs any of them: [UNKNOWN] +- Any link between B3b's page ownership (exclusive MMIO ranges) and DMA RAM pages. The two ownership tables are different mechanisms. [INFERRED] + +## 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] + +Our 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: + +- It has no concept of GPU cacheability, since it has no GPU memory. [SOURCE grep for "cacheab"/"uncach" in native/, crates/, docs/: only CPU-side Normal Non-cacheable DMA pool references] +- Its DMA pool and the SMMU window are both CPU/stream Normal Non-cacheable. That + is the CPU side and the SMMU translation attribute. It does not control the + GPU's own L2: whether GPU L2 caching applies to traffic that passes an SMMU + window is [UNKNOWN]. So the existing "Non-cacheable" setting neither honours nor + ignores the GPU-L2 rule; it is about different caches. [INFERRED] +- Consequence for native: every host-polled word needs a GPU-side uncached + attribute set in the GPU's own page tables (R4), which aienos does not own yet. + Also the proven release sequence is an L2 flush plus a second uncached marker + (docs/GB10_NATIVE_DEPENDENCY_MAP.md:139). Both belong to the GPU MMU/method layer. + +## 6. Linux RM behaviours the native backend must reproduce or refuse + +| Behaviour (Linux) | Source | Native 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 uncached | nvos.h:1113-1126; physics:nvrm/nvrm.c:470-472 | Reproduce 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:499 | Decide. 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-1162 | Linux 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 spaces | nvos.h:3045 | Not 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:136 | Must reproduce (R4). Largest gap. | +| Channel creation, runlist, work-submit token, schedule | physics:nvrm/nvrm.c:631-650 | Reproduce; token derivation [UNKNOWN]. | +| Quarantine on failed map (a VA is not recycled when driver state is unknown) | physics:nvrm/nvrm.c:515,520 | Reproduce: never reuse a DMA window or VA after an unknown failure. [INFERRED] sensible; not required by any source | +| Completion is host polling, no driver interrupt | docs/GB10_NATIVE_DEPENDENCY_MAP.md:139 | Deliberately keep polling first. | +| GSP firmware load, reset, power | docs/GB10_NATIVE_DEPENDENCY_MAP.md:244 | Out 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.