interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / DESIGN.md

780 lines · 52773 bytes Raw Blame History Rendered
1# omega-gpu-driver design notes
2
3Status: sections 1-3 are **PROPOSED**. Sections 4 and 8 are **IMPLEMENTED and EXERCISED on the host only**; sections 5-7 retain their individually stated evidence boundaries.
4Nothing here has run on GB10 hardware; hardware qualification is **NOT_RUN**.
5
6The bring-up design (GSP boot chain, RPC surface, the `ogd` launcher and manifest, the D2 window) is in the
7lane's design document and is summarised in `README.md` and `window/README.md`. This file holds the design
8decisions for the driver's isolation model and its userspace interface.
9
10Source: an accel-driver survey of 2026-10-27 (lessons 1-3). It read the two Linux accel NPU drivers at
11torvalds/linux `d135ab453a740`. All `drivers/accel/...` and `include/uapi/...` cites below are file:line in
12that tree. `NV:` cites are NVIDIA open-gpu-kernel-modules 580.173.02, `src/common/sdk/nvidia/inc/class/`.
13
14## 1. Isolation: one private GPU address space per client, no pushbuffer parser
15
16**The two Linux models.** The two drivers protect the device in different ways:
17
18- **ethosu has no MMU**, so the kernel checks every command stream.
19 - It copies the stream into a buffer object marked no-mmap (`ethosu_drv.c:130`, enforced at
20 `ethosu_gem.c:26-27`), so userspace cannot change it after the check.
21 - It replays the stream in an interpreter (`ethosu_gem_cmdstream_copy_and_validate`, `ethosu_gem.c:385-707`).
22 - Submit refuses a region that does not fit its buffer (`ethosu_job.c:398-496`).
23- **rocket has an MMU** and never parses commands.
24 - `rocket_open` gives each open file its own IOMMU paging domain (`rocket_drv.c:72,89`; created at 38-56).
25 - Buffers are mapped into that domain (`rocket_gem.c:96`).
26 - The domain is attached to the core for each job and detached afterwards (`rocket_job.c:348`, 382, 406).
27
28**What OwnDriver adopts.** The GB10 translates GPU virtual addresses through its GMMU, so OwnDriver follows rocket:
29
30- Every client gets its own GPU VA space (FERMI_VASPACE_A). That client's page tables come from local GMMU
31 code (`chan/gmmu.om`) and are installed with SET_PAGE_DIRECTORY.
32- A client's buffers are mapped only into its own VA space.
33- The driver does **not** parse or check pushbuffers or GPFIFO contents. Its job is address-space setup,
34 buffer bounds, fences and teardown.
35
36**Paths the GMMU may not translate.** On these paths ethosu-style copy-then-check still applies. The paths
37come from the docs and none has been checked on the chip (UNVERIFIED):
38
391. **Copy-engine physical mode.** Ampere's copy class has `LAUNCH_DMA_SRC_TYPE_PHYSICAL` and
40 `DST_TYPE_PHYSICAL` (`NV:clc7b5.h:121-126`). The published Blackwell copy headers (`NV:clc9b5.h`,
41 `NV:clcab5.h`) list too few methods to say whether the mode still exists.
422. **Structures the GPU reads by bus address.**
43 - These are the instance block, RAMFC, USERD and the GPFIFO ring, whose IOVAs travel in the channel alloc
44 RPC (lane design §3).
45 - ogd allocates and writes them itself; a client never supplies their contents. That is the copy-then-check
46 rule applied at allocation.
473. **The SMMU.** It translates every device access (`iommu.passthrough=0`; the GPU is alone in IOMMU group 20).
48 But one VFIO container gives the whole device a single IOMMU domain. A physical-mode access is therefore
49 bounded by the union of all clients' DMA mappings, not by one client's mappings [INFERENCE]. Until (1) is
50 settled, either refuse physical-mode copy methods, or run only one client at a time.
51
52**Scope in v1.** In v1 the workload inherits the VFIO device fd (lane design §4), so it has BAR0 read/write
53access. v1 therefore has one trusted workload per `ogd` session and claims no isolation between clients. The
54per-client VA space model starts to protect something only once `ogd` serves more than one client and the
55workload no longer holds the VFIO fd. That is v2: a request pipe, plus a mapping of only the doorbell and
56USERD pages.
57
58## 2. Submit ABI
59
60The rules come from ethosu's job path and rocket's uapi. Each one is required from the first version of the ABI:
61
62- **Per-buffer read/write flags; the write fence goes only on outputs.**
63 - ethosu takes an implicit dependency for every buffer, marked as a write only for output regions
64 (`ethosu_job.c:91-99`).
65 - It attaches the done fence with `DMA_RESV_USAGE_WRITE` only to outputs (`ethosu_job.c:102-114`).
66 - It locks all buffers as one group (`drm_gem_lock_reservations`, `ethosu_job.c:122-142`).
67 - Each submit buffer entry in my ABI carries `READ`, `WRITE` or both. A read-only input never waits on
68 another reader.
69- **A watchdog that checks progress before resetting.**
70 - ethosu runs one job in flight (`credit_limit = 1`, `ethosu_job.c:327`).
71 - Its timeout handler reads the queue read pointer (`NPU_REG_QREAD`, `ethosu_job.c:280`). If the pointer
72 still moves, it lets the job run on (`ethosu_job.c:287-292`) and resets only after that (`ethosu_job.c:305`).
73 - My counterpart is GPGet in USERD and the semaphore sequence. The watchdog reads one of them before it
74 tears a channel down. A timeout with that counter still advancing is not a hang.
75- **Reserved, pad and flags fields must be zero.** Refuse the call otherwise: ethosu `ethosu_drv.c:125`;
76 rocket `rocket_gem.c:143`, `rocket_gem.c:174` and `rocket_job.c:643`. An unknown flag bit is refused, never
77 ignored.
78- **Self-sized structs.**
79 - rocket's submit carries `job_struct_size` and `task_struct_size` (`rocket_accel.h:142-145`, 177-180).
80 - The kernel refuses sizes smaller than the struct it knows (`rocket_job.c:77`, 638-639) and steps through
81 the arrays by the size the caller declared (`rocket_job.c:95`, 656).
82 - My records start with a byte size and a version. The ABI can then grow at the tail without breaking old
83 callers.
84
85## 3. Ordering and cache sync: fences, not cache-maintenance calls
86
87rocket brackets CPU access with explicit calls:
88
89- `PREP_BO` waits for the write fence with a timeout, then calls `dma_sync_sgtable_for_cpu`
90 (`rocket_gem.c:152-161`).
91- `FINI_BO` calls `dma_sync_sgtable_for_device` (`rocket_gem.c:186`).
92
93rocket needs these because the RK3588 NPU's DMA is not cache-coherent. That is the reason given in review; it
94was not checked against RK3588 documentation here. ethosu syncs implicitly when a buffer is waited on or mapped.
95
96The GB10 is a self-hosted part with a coherent C2C link. NVIDIA's RM treats it as such:
97
98- Local EGM is set up only when `gpuIsSelfHosted(pGpu)` and `PDB_PROP_KBIF_IS_C2C_LINK_UP` hold
99 (`NV2:mem_mgr.c:4022-4023`, with the comment "EGM can be enabled only in C2C path").
100- When `kbusIsBar1Disabled` (`NV2:mem_mgr_gm107.c:619`), BAR1 is reported as size 0, with the comment "When
101 coherent C2C path is enabled, BAR1 is disabled" (`NV2:mem_mgr_gm107.c:688-694`).
102
103`NV2:` is `src/nvidia/src/kernel/gpu/mem_mgr/` (with `arch/maxwell/` for the gm107 file) in the same
104580.173.02 tree. Neither function has been run on my chip. The lines say how RM treats a self-hosted C2C
105GPU, not that every GB10 access path is coherent.
106
107What this design takes from that:
108
1091. **The proposed ordering model is fences plus memory ordering, not a coherency proof.**
110 - The CPU reads an output only after that job's write fence (§2) has signalled.
111 - The submit path keeps its barriers: ring write, `dsb sy`, GPPut, `dsb sy`, doorbell.
112 - Completion is a semaphore release that the CPU reads after the fence.
113 - `prep`/`fini` cannot yet be declared GB10 no-ops. NVIDIA 580.173.02
114 `src/common/sdk/nvidia/inc/nvos.h:1117-1125` explicitly warns that GPU-cached system memory is
115 not coherent with direct CPU mappings. A coherent C2C link alone does not settle GPU-cache policy.
1162. **No BAR1 VRAM mapping.** BAR1 is off on this chip: RM reports it as size 0 (above), and sysfs shows BAR0
117 only (lane design §1).
118 - All buffers are sysmem: pinned pages, VFIO MAP_DMA, and GMMU PTEs with the snooped sysmem aperture.
119 - The CPU's view of a buffer is the CPU's own mapping of those pages.
120
121## 4. Owned userspace DMA window
122
123`chan/gmmu.om` no longer presents the simulator's global `mmwin` array as hardware DMA backing.
124`mmwinit` selects that array explicitly. `mmwalloc(iova, size)` instead owns one shared anonymous
125read/write `mapnew` handle. CPU access uses that live handle plus a checked offset through
126`mmrd32/64`, `mmwr8/32/64` and `mmzero`. The compiler's ordered word operations are used for aligned
12732/64-bit accesses; zeroing handles byte tails separately. `mmwb` is an IOVA, `mmwcpu` is an
128informational CPU virtual base, and a buffer's `gmbva` is its independent GPU VA. They are not aliases.
129
130This is a Linux **userspace VFIO** backend, not an Omega Linux kernel module or replacement for
131Linux's DMA/IOMMU implementation. It neither opens nor closes a VFIO fd, adopts a container, resets
132a device, or changes authorization. The caller must already have sole lifecycle ownership of the
133authorized container. No fork, fd close/reuse, concurrent caller, or process restart may invalidate
134the recorded tuple while it is retained. The process-local quarantine latch is not crash-safe
135containment and is not permission to run hardware.
136
137The immutable live tuple is `(mmwgen, mmwh, mmws, mmwb, mmwfd)`: epoch, owned handle, whole length,
138IOVA and container fd. `mmwgen` never wraps. Address-space, buffer and channel operations validate
139their recorded window epoch; an old slot cannot become live merely because a new window exists.
140
141| State | Allowed transition |
142|---|---|
143| NONE | `mmwalloc` -> OWN only after backing allocation succeeds |
144| OWN | `mmwdmap(epoch, fd)` -> DMA only after whole-window MAP_DMA succeeds |
145| DMA | `mmwpublish(epoch)` -> PUB **before** exposing any IOVA through boot args, mailbox, RPC, channel bind or page-directory register |
146| OWN or DMA, never published | `mmwclose(epoch)` -> NONE; DMA requires successful full exact UNMAP_DMA before `mapdrop` |
147| PUB | No reclaim/reset/reuse API; uncertain completion -> QUAR |
148| QUAR | No reclaim/reset/reuse API, including after a modelled idle or successful TLB invalidation |
149
150`chan/dma.om` reconstructs the request for every attempt: compiler `397e6704` replaces the vaddr
151handle with the CPU base even when the ioctl fails. Only EBADF is classified as proven no-target
152and remains OWN; other mapping errors retain uncertain ownership in QUAR without speculative
153UNMAP_DMA. Failed unmap, zero/partial/oversized returned extent, or failed drop retain the handle.
154The entire recorded range must be returned by UNMAP_DMA before drop. An unmap failure is never
155converted into reclamation.
156
157Publication is sticky even if the following operation fails. Page-table root publication latches
158PUB before register writes; timeout latches QUAR. Owned page-table/allocator reset, mutation and
159published-buffer reuse are refused. Simulator channel ops explicitly refuse owned backing rather
160than walking the unrelated `mmwin` array. The boot/RPC caller must invoke `mmwpublish` before
161serializing any DMA reference and `mmwquar` on uncertain post-publication completion. This backend
162does not supply those GSP callsites or invent an idle proof. No documented, exercised GB10 idle
163protocol exists here; published or quarantined memory therefore remains retained.
164
165Sources: Linux `include/uapi/linux/vfio.h:1544-1615` (whole mapping and actual returned unmap size),
166NVIDIA 580.173.02 `nvos.h:1117-1125` (cache policy warning), and
167omega-mv `397e67040fb74853c6814097fe02ae4e1ebd6f66`, `seed/host/MAPPING.md:27-45,84-98`.
168Pinned omc sha256: `bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6`
169(pending omega-mv#890 stacked on #878, not main).
170
171Host evidence: `OMC=/path/to/pinned/omc sh tests/dma_host.sh` exercises anonymous memory, a real
172invalid-fd refusal/retry, 23 explicit replay/boundary cases and 11 compiling negative-control mutants.
173The replay transport is test-only link-time substitution, not a runtime fallback or DMA evidence.
174`tests/chan_diff.sh` preserves the simulator's 391-line byte-identical C-reference trace.
175Observed exit 0 for both gates. Replay binary sha256:
176`06f290ccc82f33cfa2ae14b8a0604ba722988b93e6ff7299259b8779cc7a9575`;
177production invalid-fd check binary sha256:
178`e2dfe13d77b4ae92b91b2ae6751eb1f107420754547b4da5fddf56058697ec60`.
179The gate emits source-file and binary checksums on each run; those are compiler/host evidence only.
180No VFIO device was opened and no MMIO, DMA, reset, driver or service action was performed.
181Hardware and Linux-kernel execution: **NOT_RUN**.
182
183## 5. Unified memory page tables (2026-11-05)
184
185Status: **IMPLEMENTED and HOST_EXERCISED**. Hardware qualification is **NOT_RUN**. This section does
186not change sections 1-4 and does not install a page table on a device.
187
188`uvm/fmt.om`, `uvm/pt.om` and `uvm/fault.om` build Blackwell VER3 page tables, allocate a 2^28-byte
189window at VA 2^32, map and unmap 4 KiB, 64 KiB and 2 MiB pages, and decode one NVC369 32-byte fault
190packet. Field positions are cited from open-gpu-kernel-modules 580.173.02 (`dev_mmu.h`
191`NV_MMU_VER3_*`, `dev_fault.h` `NV_PFAULT_FAULT_TYPE_*`, `clc369.h` `NVC369_BUF_ENTRY_*`). No NVIDIA
192source is copied. `chan/gmmu.om` remains the channel port. These units use the `uv` prefix and must
193not be concatenated with `chan/`.
194
195The page-table pool is 16 pages of 4096 bytes at physical address 2^31. A leaf PTE sets bit 0. A
196page-directory entry leaves bit 0 clear and stores aperture SYS (2) at bits 2:1 and PCF 2 at bits
1975:3. The physical address is bits 51:12, except a 64 KiB PDE, whose address is bits 51:8. The PD0
198entry is 16 bytes: word 0 is the 64 KiB table or a 2 MiB PTE, word 1 is the 4 KiB table. A set valid
199bit in word 0 is a 2 MiB leaf, not a pointer.
200
201Constants, WolframLanguageEvaluator: `2^12 -> 4096`, `2^16 -> 65536`, `2^21 -> 2097152`,
202`2^31 -> 2147483648`, `16*4096 -> 65536`, `2^32 -> 4294967296`, `2^28 -> 268435456`,
203`2^57 -> 144115188075855872`, `2^52 -> 4503599627370496`,
204`BitAnd[2^52-1, BitNot[2^12-1]] -> 4503599627366400`,
205`BitAnd[2^52-1, BitNot[2^8-1]] -> 4503599627370240`.
206
207Fault service is a policy, not a device action. An invalid packet is ignored. A disabled packet, a
208non-replayable packet, or fault type 3 or above is fatal. A replayable fault whose VA has no
209reservation, or whose reservation has no physical page, is cancelled. A write to a read-only
210reservation is fatal. Otherwise the missing page is mapped from the reservation and the action is
211replay. A second fault on a page that replay already mapped does not write the table again.
212
213Host evidence is `tests/uvm_diff.sh` and `tests/mutants-uvm.sh`, both exit 0 on 2026-11-05, compiled
214with omc sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. The checker walks
215the dumped bytes itself. Overlap, misalignment, an out-of-window VA, a pool alias, a read-only
216write, an invalid packet and a non-replayable fault are refused. Five single-line mutants are
217killed, and one flipped dump nibble is refused.
218
219Chip runbook. Do not run a device command from this unit. It has no device words and no
220SET_PAGE_DIRECTORY path. Blocked on an exclusive Drake-authorized window and on a qualified
221instance-MMU install path in this driver. Until both exist, the chip tier stays **NOT_RUN**. The
222host commands that must stay green before that window are:
223
224 taskset -c 10-14 nice -n 10 sh tests/uvm_diff.sh
225 taskset -c 10-14 nice -n 10 sh tests/mutants-uvm.sh
226
227A future window, after that install path exists, compares one 32-byte fault-buffer entry from the
228instance with the decode in `tests/uvm_check.py`. That comparison has no command yet, because
229writing one that opens `/dev/nvidia*` would be a false runbook. Do not take
230`/tmp/aien-gb10.lock`. Host PASS is not chip qualification.
231
232## 6. Bounded UVM service (host model)
233
234This first-party seeded Omega service builds on section 5, not NVIDIA implementation code.
235It is not a kernel module, a Linux ioctl endpoint, or a hardware queue producer. The chip tier remains
236**NOT_RUN**. All implementation is `.om`; Python 3.12.3 and Ubuntu cc 13.3.0 are verification
237oracles only, never linked into the service. The local model queue is first-party Omega from draft
238#11 at `b06b3f9a3dd1e74a3099350760cb3d26a3f33577`, stacked on #9. This service branch is
239stacked on #10 at `4917e4e218e392526351e05b9169bd00679ac724`.
240
241### Entry points and bounded ownership
242
243One isolated service instance owns one VA space and one serialized producer/consumer pair.
244`screate`/`sdestroy` create/destroy that space; destroy refuses a nonempty range tree or pending
245fault/command records. Removal refuses unconsumed command records before touching PTEs. A space
246cannot be reused with stale faults. There is no concurrency, process-exit reclamation or physical
247completion proof in this model.
248
249Callers clear `sen` before each top-level batch/notification to own the bounded event output; the
250trace harness does so for every request. The ring indices, overflow latch and queue indices persist.
251
252`sadd(va,size,pa,policy)`, `ssplit(va)`, `smerge(base)` and `sremove(base,size)` maintain up to
25364 sorted, nonoverlapping ranges. `sfind(va)` traverses their implicit balanced binary-search tree.
254The array representation needs no allocator or pointer ownership. Split preserves policy and
255physical offset. Merge requires adjacent VA and PA intervals and identical policy. Remove requires
256the exact interval; callers split first for subrange removal. Removal unmaps installed 4K PTEs and
257clears residency/counter state. The section-5 16-page page-table pool is bounded and never reclaimed
258piecemeal; a new empty space resets it. This service uses 4K pages; section 5 separately supports
25964K/2M pages.
260
261Policy bits: 0 preferred location (CPU=0, GPU=1), 2:1 accessed-by mask (CPU=1, GPU=2),
2623 read duplication, 4 read-only, 5 cancel-on-fault. Other bits are refused. All addresses and sizes
263must be 4K-aligned and fit section 5's VA/PA windows; overlap returns UVEBUSY=3, misalignment
264UVEALIGN=2, capacity UVENOM=4, missing interval UVENOENT=5, bounds UVERANGE=6. The physical
265page-table pool cannot be aliased. A zero backing PA denotes an unbacked reservation and cancels
266faults rather than inventing physical memory.
267
268### Fault ring, pipeline and queue records
269
270`uvpkt` is the caller's 32-byte packet staging buffer. `fbpush` preserves every byte and advances
271monotonic PUT only if one of 16 entries is free. Full returns UVENOM and latches overflow;
272`fbrecover` clears it only after GET catches PUT. PUT wrap is refused. `fbbatch` stops at an
273invalid head without advancing GET; valid consumption clears the valid bit and advances GET.
274It deduplicates benign replayable faults by (4K VA page, access type), not fatal/nonreplayable
275packets. Queue pressure leaves the head intact for a later explicit retry. It does not silently
276discard queued faults when overflow occurs.
277
278`sservice` decodes using section 5's `fault.om`: disabled, nonreplayable, malformed-access or fatal
279faults yield UVFATAL=11. Missing/unbacked/cancel-policy ranges yield UVCANCEL=10. Read-only
280write/atomic faults are fatal. Successful faults build or update an actual section-5 PTE, update a
281128-entry residency ledger, emit invalidate then replay, and return UVREPLAY=9. A per-batch event
282contains six LE u64s: VA page, access, decision, PA, the actual installed PTE bytes, residency mask.
283Nonmapping decisions zero the final three fields.
284
285The connected #11 `iqcommand(op,seq,va,pa,flags)` format is five LE u64s (40 bytes), capacity 8:
286op=2 local invalidate descriptor, then op=1 local replay descriptor. Flags are the CPU/GPU residency
287mask. Sequence is nonzero and strictly increasing. These are deliberately **not** NVIDIA physical
288RPC IDs. `iqctake` captures an immutable consumer item and `iqcack(exact-sequence)` advances once.
289The service reserves two free slots and sequence/producer headroom before changing any PTE. It
290requires model mode and live state. A failed publication after a PTE change sets sticky `sqbad` and
291fatally refuses later faults; no rollback pretends the device never observed a mapping. There is no
292hardware effect adapter. Consuming/ACKing a record is not a TLB/replay completion receipt.
293
294### GB10 shared physical memory and access counters
295
296GB10 CPU and GPU share physical memory. Here migration changes the mapping permissions, logical
297residency and required coherence descriptors, **never copies data or changes backing PA**. A GPU
298write/atomic makes logical ownership GPU-only; CPU mappings must be invalidated by a future effect
299adapter before real replay. A read keeps CPU access for CPU-preferred/accessed-by-CPU/read-duplicate
300policy; otherwise GPU-only. Read duplication installs a read-only GPU PTE; a later write changes
301permissions on the same PA and drops CPU ownership. Permanent read-only policy never upgrades.
302These are model transitions, not measured cache coherency. No behavior is claimed for a discrete
303GPU needing physical migration/copies.
304
305`scnotify(limit)` consumes one NVC365 notification from `uvpkt`. It requires limit 1..65535,
306valid=1, virtual address type and coherent system aperture. Invalid entries are ignored; physical or
307unsupported-aperture entries are refused, not guessed. Decoded fields are page VA, 16-bit absolute
308count, CPU/GPU type and 20-bit tag. Unmapped/unresident pages return UVENOENT. It records the
309latest count; counts below the inclusive threshold are ignored. At/above threshold it runs the same
310read-fault pipeline; a CPU notification does not move a GPU-preferred page. This is an explicit
311threshold policy, not an assertion about hardware counter reset, sampling or scheduling semantics.
312
313### Server-side ioctl ABI
314
315`sidispatch(cmd,size)` reads `siab` and returns local UV status, `siolen`, and `siob` output bytes.
316It copies the exact-size input into output, modifies defined output fields, and writes `rmStatus`.
317Unknown commands or any wrong byte length return UVEINVAL with zero output length. No ioctl
318system call executes. One instance admits one registered GPU/VA-space pair. Initialization cannot
319repeat; flags 0 and 1 are supported, other flags are refused. UUID, client and nonnegative fd are
320validated as model identity, not as real RM authority.
321
322`siobject(handle,pa,size)` is the server's explicit trusted backing-capability input. External allocation
323mapping requires such a capability, registered GPU and VA space, matching client/fd/UUID, bounded
324offset and default mapping/cache/format attributes. An RM handle is never reinterpreted as a PA.
325No real RM object resolver is implemented or implied. FREE removes an exact range; GPU unregister
326refuses live ranges. Range groups issue monotonic IDs; no group-membership ioctl is in this scope.
327PAGEABLE_MEM_ACCESS reports this model's supported pageable policy, not the installed Linux driver's
328capability. Local errors map to NV_ERR_INVALID_ARGUMENT=31, INVALID_STATE=64 for permission,
329and IN_USE=23 for busy; success is NV_OK=0.
330
331All header references below are read-only NVIDIA open-gpu-kernel-modules **580.173.02**,
332commit `20e4e6e19cc26ba47b5cbe23130a396be100c427`. Only positions/numbers were used:
333
334| Command | Number | Host measured size/status offset | Source path:line |
335|---|---:|---|---|
336| UVM_INITIALIZE | 805306369 | 16 / 8 | `kernel-open/nvidia-uvm/uvm_linux_ioctl.h:28-38` |
337| UVM_REGISTER_GPU | 37 | 40 / 36 | `kernel-open/nvidia-uvm/uvm_ioctl.h:532-543` |
338| UVM_UNREGISTER_GPU | 38 | 20 / 16 | `kernel-open/nvidia-uvm/uvm_ioctl.h:548-554` |
339| UVM_CREATE_RANGE_GROUP | 23 | 16 / 8 | `kernel-open/nvidia-uvm/uvm_ioctl.h:381-387` |
340| UVM_MAP_EXTERNAL_ALLOCATION | 33 | 9264 / 9260 | `kernel-open/nvidia-uvm/uvm_ioctl.h:491-504` |
341| UVM_FREE | 34 | 24 / 16 | `kernel-open/nvidia-uvm/uvm_ioctl.h:509-515` |
342| UVM_REGISTER_GPU_VASPACE | 25 | 32 / 28 | `kernel-open/nvidia-uvm/uvm_ioctl.h:400-409` |
343| UVM_PAGEABLE_MEM_ACCESS | 39 | 8 / 4 | `kernel-open/nvidia-uvm/uvm_ioctl.h:556-562` |
344
345`uvm_ioctl.h:37-40` defines the Linux command encoding. `uvm_types.h:69-71,84-94` defines flags
346and mapping attributes. `src/common/sdk/nvidia/inc/class/clc365.h:36-41,59-79` defines the access
347counter type/address/aperture/address/tag/count/valid positions. Section 5 pins NVC369 fault fields.
348All ABI sizes and offsets are measured **only by host cc sizeof/offsetof** in
349`tests/uvms_offsets.c`; `tests/uvms-abi.txt` is its byte-exact fixture and the gate remeasures it.
350No vendor implementation code is copied.
351
352### Host acceptance and chip runbook
353
354Run `taskset -c 10-14 nice -n 10 python3 -u tests/uvms_check.py --mutants`.
355The Python oracle uses declarative interval lists and dictionary PTE/residency state rather than
356porting Omega's row shifts, page-table walk or binary search. It compares every output byte:
357ranges, fault decisions, installed PTE records, complete command ring, fault ring, monotonic indices,
358residency ledger, decoded access-counter fields and ioctl output. Fixed-seed 20261105 fuzz performs
35910,000 range operations; focused traces cover wrap/overflow/invalid-head/dedup, queue reservation and
360retry, permission changes, cancellation/fatal faults, thresholds and backing-capability refusals.
361Separate capacity traces exercise the range and page-table limits. Each ioctl has a positive case
362and bad-size negative; unknown-command and double-init are negative. Two compiling, terminating
363behavior mutants per new unit must produce byte differences. A flipped-output control must be
364rejected by the checker. The receipt is `tests/uvms-host-receipt.txt`.
365
366Derived sizing constants are recorded with their calculator source:
367WolframLanguageEvaluator `{16*32,16*40,2^30,2^31,2^32-1,2^20-1,FromDigits["30000001",16],
368BitOr[1,BitShiftLeft[2,1]],64*8*8}` -> `{512,640,1073741824,2147483648,4294967295,1048575,
369805306369,5,4096}`; and
370`{BitAnd[2^32-1,BitNot[2^12-1]],2^31+16*4096,2^64-3,2^16-1,64*8,128*3,16*6,256*36+48}`
371-> `{4294963200,2147549184,18446744073709551613,65535,512,384,96,9264}`.
372The independent cc result, not the final arithmetic expression, is authoritative for ioctl sizes.
373
374Chip runbook verdict: **NOT_RUN**. No window is authorized. Before a later run, the operator must
375authorize an exclusive window, a real kernel/instance install path, ownership of an isolated test
376VA space and a physical invalidate/replay adapter with completion and CPU/GPU coherence proof.
377The run would:
378
3791. Capture raw live NVC369 entries and GET/PUT/valid/overflow state without racing producer ownership.
380 Compare every decoded field and consumed index against the same immutable bytes in this decoder.
3812. Induce a missing 4K mapping, install the expected same-PA PTE and issue the real invalidate.
382 Compare pre-invalidate stale translation versus post-completion translation and read/write
383 permissions. A deliberately omitted invalidate is a negative control, not a successful run.
3843. Compare actual replay/cancel outcomes with the model, including a read-duplicate to write upgrade,
385 CPU/GPU visibility after coherence completion, and NVC365 threshold notifications. Verify backing
386 contents/PA are unchanged by modeled migration.
3874. Retain raw packet bytes, old/new PTEs, invalidate/replay completion evidence and negative-control
388 results. A submitted or ACKed model record alone cannot pass this tier.
389
390There is intentionally no command that opens a device or takes the GPU lock in this runbook.
391Linux kernel replacement, interrupt handling, hardware queue/cache effects, process isolation and
392GB10 qualification remain external integration/authorization gates; host parity does not satisfy them.
393
394## 7. Per-open CUSE endpoint (stacked on the UVM service)
395
396`uvm/endpoint.om` is the Linux-process transport, not a kernel module. All production
397transport and dispatch code is seeded Omega: no libfuse, C daemon, Python server,
398or arbitrary ioctl/syscall shim is adopted. Linux CUSE remains an explicit host
399dependency. `tests/uvme_offsets.c` and `tests/uvme_kernel.c` are verification oracles
400and consumers only, never linked into the endpoint.
401
402The stack is #10 (`4917e4e2`) → #12 (`e7aa07f34f5156b0ae129378f4aa46df6be11375`)
403→ `feat/uvm-endpoint`. The service's frozen compiler and receipts remain unchanged.
404The endpoint additionally requires the first-party `eventfd` host word from draft
405omega-mv#1045, source `78122a72a7bb7129271088b30093e8b3b9b52f8d`, compiler SHA256
406`734bf4f3f858d56288902700cf581cdbaa4a24d1b3254a2beea014aaccf0fa38`.
407Its only new effect is host eventfd creation; no `vfioirq`, VFIO registration,
408MMIO, NVIDIA device, GPU lock or physical queue operation is called. The model
409queue remains pinned to #11 as described in section 6.
410
411### Namespace and authority
412
413Each independent OPEN forks a pristine worker. The parent never calls `sidispatch`
414or `siobject`, so initialization, GPU/VA-space identities, range groups, ranges,
415PTEs, residency and command/fault queues are private process state. There are at
416most eight live opens. A monotonic, connection-local `fh` routes requests; released
417handles are revoked before teardown and never reused. Unknown/stale handles
418return `-EBADF`, worker failure returns `-EIO` and revokes only that worker.
419
420The isolation unit is the **open file description**, not the header PID. Threads
421can issue ioctls on the same fd; Linux may send RELEASE without caller credentials.
422`dup`, fork inheritance or intentional fd transfer shares that namespace. A second
423open, even with identical UUID, RM handle and VA, cannot access the first open's
424state. The kernel owns the `fh` mapping; users cannot choose it through ioctl
425payloads. A deliberately forged fake-kernel packet is not an authenticated client.
426This follows the protocol review's decisive constraint: “use live fh as namespace
427capability; do not treat header PID as process ownership.”
428
429Before fork, Omega makes a private Unix stream pair using a random abstract
430listener and verifies the accepted peer's kernel PID equals the creating process.
431The listener is then closed. Children close the CUSE/fake-kernel channel and every
432sibling endpoint. The private channel carries three LE u64 words `(cmd, size,
433request-unique)` followed by argument bytes; its response is `(local-UV-status,
434size, same-unique)` plus output bytes. Stream operations accumulate partial I/O,
435use a bounded in-flight deadline, and never retry an uncertain dispatched request.
436`send` supplies `MSG_NOSIGNAL`: a dead worker must not SIGPIPE-kill other clients.
437Idle opens have no timeout. RELEASE closes the private channel, terminates and
438reaps the exact worker; connection EOF does the same for all remaining workers.
439A session is explicitly bounded to 999,999 CUSE records, then drains and exits.
440There is no automatic reconnect, retry or state restoration.
441
442`--fake` uses inherited SOCK_SEQPACKET fd 0/1 and explicitly installs a test
443backing capability **inside each child after fork**. It is not a client import
444command. `--cuse` opens only `/dev/cuse` and installs no backing capability.
445Consequently production MAP_EXTERNAL_ALLOCATION must refuse until a trusted
446per-client RM object resolver supplies ownership and bounds. Registering a UUID
447or passing a numeric RM handle does not supply physical-memory authority.
448Worker/process isolation here is not physical-memory or hardware teardown proof.
449
450### CUSE wire contract
451
452The ABI is measured by host `cc sizeof/offsetof`, not inferred from struct packing:
453`linux/fuse.h:745-775` (open/release/flush), `879-898` (CUSE init), `914-975`
454(ioctl, iovecs, headers), from `/usr/include/linux/fuse.h`, SHA256
455`e51bdccbf4bc43b60353eb367a3aa4d25b31cafb23b06d3bd7ebb2e5bde8c75d`.
456The Linux v6.19 reference implementation's `fs/fuse/cuse.c:cuse_send_init`,
457`cuse_process_init_reply`, `cuse_open` and `cuse_file_ioctl` were read to check the
458negotiation. This is a reference pin, not a claim about the running kernel.
459
460The endpoint negotiates major 7, minor 16–39, and CUSE_UNRESTRICTED_IOCTL, rejects
461extensions/compat/32-bit/X32/unknown flags, and advertises only the isolated node
462`omega-uvm-test`. A request must have an exact whole-record length and nonzero
463unique. Each of the eight UVM commands uses the exact whitelist size in section 6,
464never `_IOC_SIZE`. An initial IOCTL requests one input and one output iovec for
465the kernel-owned user pointer. The retry reply sets FUSE_IOCTL_RETRY; the next
466request retains only FUSE_IOCTL_UNRESTRICTED and may have a different unique.
467Copied input/output sizes and the full frame length must exactly match the
468whitelist. Null, wrapping and out-of-contract user pointer ranges refuse without
469dereferencing them; actual access checking and copyin/copyout belong to Linux.
470Abandoned copyin retries hold no global pending state. There is no rollback or
471automatic replay after a possible copyout fault.
472
473Semantic UVM refusal is returned in the argument's `rmStatus` with outer ioctl
474result zero, preserving every output byte from `sidispatch`. Transport/protocol
475errors use negative errno in the FUSE header. Kernel copy failures, caller memory
476permissions, node ownership and real Linux ioctl dispatch are not established by
477the fake-kernel gate.
478
479### Typed fault notification
480
481`uvm/notify.om` defines nominal `unirq`, constructor `unirqmk`, `unpost`, `unpump`
482and `unclose`. A worker owns one eventfd. `unpost(cap)` first admits `uvpkt` into
483the existing bounded ring and only then publishes a wake; rejected full-ring
484entries do not generate wakes. `unpump` drains the coalesced eight-byte count and
485calls `fbbatch`, preserving its dedup/overflow/GET policy. Closed tokens refuse
486and cannot be reopened as a new generation. Composition lifts the nominal type
487declaration before the first function, as required by OM-2.
488
489This is an explicitly **MODEL** fault-buffer wake binding. It does not attach a
490VFIO IRQ, capture a live DMA buffer, execute an invalidate/replay command or prove
491MMU completion. `unpump` may be called by a future owned snapshot producer; no
492public ioctl can inject a fault or mint the nominal token. The service emits the
493same #11 typed-model queue records; notification is never their completion ACK.
494
495### Host acceptance and remaining kernel hop
496
497Run, without opening any device:
498
499```
500taskset -c 10-14 nice -n 10 python3 -u tests/uvme_check.py --mutants \
501 --emit-dir /tmp/omega-uvm-endpoint
502```
503
504The independent fake kernel exchanges whole CUSE packets with the real Omega ELF.
505Two client processes concurrently open independent descriptions and issue all
506eight commands. The interval/dictionary service oracle checks every ioctl output
507byte. Tests use identical UUIDs/handles/VAs, peer-VA removal refusals, one client's
508free while the other's mapping remains busy, independent group IDs, double init,
509all bad sizes/flags/commands, stale handles, credential-free RELEASE, abandoned
510copyin, worker death, fd inheritance, capacity, reaping and connection EOF.
511The eventfd fixture exercises real host wake/coalescing, empty readiness, overflow,
512dedup and closed-token refusal without VFIO. Compiling behavior mutants cover
513each new Omega unit; an output-byte corruption uses the same live comparator.
514The real ioctl consumer is compiled, not executed. Receipt:
515`tests/uvme-host-receipt.txt`.
516
517Observed host result: **PASS**, 192 fake-CUSE records and 53,919 reply bytes,
518two concurrent actual client processes, typed eventfd through PTE plus model
519invalidate/replay consumption, output-corruption control rejected, and all seven
520new-unit mutants killed. The C kernel consumer built with warnings as errors;
521its execution remains NOT_RUN. `tests/uvme-regression-receipt.txt` records the
522unchanged service's 10,000-operation fixed-seed range fuzz and ten mutants,
523the 503-line independent PTE walk and five original page-table/fault mutants;
524all commands returned zero. These are host results only.
525
526**Real CUSE kernel hop: NOT_RUN.** `/dev/cuse` is absent on this host; no node was
527created and no module/permission was changed. After the operator explicitly
528authorizes and prepares an isolated CUSE node, the runbook is:
529
5301. Run the host gate above, retaining its binaries. Inspect the pin and hashes.
5312. Under that separate authority, launch the retained `endpoint --cuse` on the
532 allowed CPU cores. It requests only `/dev/omega-uvm-test`, never the NVIDIA node.
533 Confirm node identity and access rights before allowing test consumers.
5343. Run retained `kernel-client /dev/omega-uvm-test` on cores 10–14. It forks two
535 actual ioctl callers, covers all eight transports, independent initialization
536 and group IDs, unknown-command refusal and null-pointer EFAULT. MAP and FREE
537 intentionally refuse in this tier because no trusted real backing was imported.
5384. Compare the real replies with the fake-kernel byte oracle, exercise invalid
539 nonnull user mappings/copyout failures, and capture kernel/daemon exit status,
540 exact argument bytes and reaping. Stopping the explicitly owned daemon removes
541 only this test node. Do not restart/replay uncertain requests.
542
543**Chip: NOT_RUN.** The live NVC369 versus decoder and before/after TLB-effect
544comparisons in section 6 remain required. Physical IRQ snapshot ownership,
545trusted RM backing resolution, mapped page-table installation, real invalidate/
546replay completion, CPU/GPU visibility and hardware-safe client teardown remain
547separate gates. This endpoint does not close the ROADMAP nvidia-uvm.ko replacement
548row or claim deployment.
549
550Sizing record: WolframLanguageEvaluator
551`{40+32+9264,16+16+9264,16+72+StringLength["DEVNAME=omega-uvm-test"]+1,8*5,2^48,
5522^32-22,2^32-9,2^32-5,2^32-38,2^32-71,1073741824+8*268435456}`
553→ `{9336,9296,111,40,281474976710656,4294967274,4294967287,4294967291,
5544294967258,4294967225,3221225472}`. Host-cc measurement remains authoritative
555for struct sizes and offsets.
556
557The fake backing fixture starts above `UVBASE` rather than crossing the page-table
558pool on the fourth open. It is installed after fork and is never a client-supplied
559physical import. WolframLanguageEvaluator
560`{2^19+1,2^19+2,2^32+1000000*2^28+2^28<2^52,5.1*10^9>5000000000}`
561→ `{524289,524290,True,True}` verifies the host open flags, the bounded fixture's
562PA ceiling and the idle test exceeding the in-flight deadline.
563
564The worker-death negative control waits on that exact worker's pidfd before
565sending another request. Its descriptors must already be closed, with SIGPIPE
566default and unblocked in the endpoint. This follows the review finding that an
567“immediate post-kill request” may write before the worker has exited. The
568write-instead-of-send mutant must specifically terminate with SIGPIPE (`rc=-13`);
569an unrelated setup failure is not accepted as this mutant's kill. The baseline
570must survive and continue servicing the other open. The eventfd fixture also
571asserts the mapped PTE and consumes invalidate then replay from the model queue;
572this is still not physical completion.
573
574
575## 8. RM escape endpoint and explicit HOST_MODEL serving (stacked on #14)
576
577**IMPLEMENTED / EXERCISED in the host model. QUALIFIED: NOT_RUN. MERGED: no. DEPLOYED: no.**
578The implementation is `rm/ioctl.om`, `rm/handles.om`, `rm/memory.om`,
579`rm/model.om`, `rm/uvmclient.om`, `rm/import.om`, `rm/dispatch.om` and
580`rm/endpoint.om`. No C, Python, vendor binary or foreign runtime is in the
581endpoint execution path. Python and C below are independent test/fake-kernel
582oracles, compiled or executed only inside a device-hiding `bwrap`.
583
584### Sources and ABI
585
586The client source is CUDApp #293, `origin/feat/c4-streams-submit`
587`16f11c47fa9587349b607d5ed174113b6fc9b504`: `nvrm/nvrm.c` and
588`native/nvrm/transport.om`. The independent layout source is NVIDIA
589open-gpu-kernel-modules 580.173.02 at
590`20e4e6e19cc26ba47b5cbe23130a396be100c427`: `nvos.h`, `nv-ioctl.h`,
591`nv-ioctl-numbers.h`, `nv_escape.h`, and
592`nv-unix-nvos-params-wrappers.h`. `tests/rme_offsets.c` compiles those headers;
593it measures sizeof, pointer/size/status offsets, escape numbers and NV statuses.
594In particular, NVOS32 status is at **20**, not 16; the cc oracle caught that
595initial implementation error before the passing receipt.
596
597| Escape | Number | Exact outer size | NV status offset |
598|---|---:|---:|---:|
599| RM_ALLOC (NVOS21) | 43 | 32 | 28 |
600| RM_CONTROL (NVOS54) | 42 | 32 | 28 |
601| RM_FREE (NVOS00) | 41 | 16 | 12 |
602| RM_MAP_MEMORY (NVOS33 with fd) | 78 | 56 | 40 |
603| RM_UNMAP_MEMORY (NVOS34) | 79 | 32 | 24 |
604| RM_MAP_MEMORY_DMA (NVOS46) | 87 | 64 | 56 |
605| RM_UNMAP_MEMORY_DMA (NVOS47) | 88 | 48 | 40 |
606| RM_VID_HEAP_CONTROL (NVOS32) | 74 | 184 | 20 |
607| CARD_INFO (64 entries) | 200 | 4608 | errno refusal |
608| REGISTER_FD | 201 | 4 | errno refusal |
609| ALLOC_OS_EVENT / FREE_OS_EVENT | 206 / 207 | 16 | 12 |
610| CHECK_VERSION_STR | 210 | 72 | errno refusal |
611
612Both NVIDIA control/device files use the same `_IOC(READ|WRITE,'F',nr,size)`
613encoding. This candidate exposes only the separate `omega-rm-test` CUSE test
614node, not either NVIDIA device name. Any other type, direction, number, outer
615size or oversized parameter payload returns `-EINVAL`. No xfer command
616indirection is admitted. ALLOC/CONTROL accept at most 4096 pointed bytes, gathered
617by a second FUSE_IOCTL_RETRY containing precisely the outer and pointed input/
618output iovecs. Noncanonical/null required pointers return `-EFAULT`; the daemon
619never dereferences a caller address. Zero-sized parameters require a null pointer.
620Unexpected flags, inconsistent frame/input/output lengths and reused closed fh
621tokens are refused before dispatch.
622
623### Namespace and model routing
624
625Every independent OPEN gets a forked worker and fresh namespace. At most eight
626descriptions are live. Each fh is an unpredictable, nonzero positive int token,
627issued from `random`, checked against every token previously issued in the bounded
628session (at most 1000), and never reused. REGISTER_FD consumes a valid live token,
629not an arbitrary host integer fd. It imports only into an unused destination;
630used/reserved destinations, self-import, forged and closed tokens refuse.
631Imported descriptions share the source worker, namespace, allocator and mappings.
632Closing one alias revokes only its token; the last alias closes/kills/reaps that
633exact owned worker. Independent workers own stderr plus their private channel
634only. EOF drains them. In-flight I/O has a deadline; idle workers do not expire.
635The fake kernel translates process-local fds to endpoint-issued tokens exactly
636where the kernel-facing import ABI expects one. This is not a production fd broker.
637
638Each worker has a caller-owned 4096-word state array, no new globals. It consumes
639at most 64 object slots monotonically. Each record holds liveness, handle, client,
640parent and class; tombstones deliberately refuse numerical handle reuse until
641close, even after free. Root-client handles are generated by the server.
642Device objects require a root parent, subdevice/VAS/TSG require device,
643context-share/GPFIFO require TSG, and compute requires GPFIFO. Namespace lookup
644includes the client. Context-share VAS and GPFIFO context-share references also
645require the same owning device/TSG, respectively. Nonzero FIFO memory references
646are refused until real backing import exists. Free checks the exact direct
647parent and removes the full descendant closure; double free and stale use fail.
648Capacity counts consumed slots, not only live objects.
649
650Supported model allocations include ROOT_CLIENT (65), DEVICE_0 (128),
651SUBDEVICE_0 (8320), FERMI_VASPACE_A (37105), CHANNEL_GROUP_A (41068),
652CONTEXT_SHARE_A (36967), BLACKWELL_CHANNEL_GPFIFO_A (51567),
653BLACKWELL_COMPUTE_B (52928), MEMORY_SYSTEM (62), MEMORY_LOCAL_USER (64),
654MEMORY_VIRTUAL (112), and USERMODE_A/B (50017/50785), at exact parameter sizes.
655Supported model controls are GPFIFO_SCHEDULE (`0xa06c0101`, three bytes) and
656GET_WORK_SUBMIT_TOKEN (`0xc36f0108`, four bytes), on their correct object classes.
657The token is explicitly the model's channel-handle token, not a physical doorbell.
658
659ALLOC/CONTROL use the `chan/params.om` parameter image (`pabuf`/`palen`);
660ROOT_CLIENT and scheduling use its existing encoders. Other accepted records
661are copied verbatim after exact-class-size checks, matching the existing GSP
662RM payload contract. `gsp/rpc.om` builds the real framed RM_ALLOC (103),
663RM_CONTROL (76), or RM_FREE (10) request into its explicitly linked **host-memory
664peer**. No physical queue or boot state is imported. The model returns its own
665policy result; publication is **not** a GSP reply or firmware completion.
666Handle changes commit only after successful model routing. The separate
667`tests/rme_trace.om` observes the exact root-client RPC payload and injects a
668model allocation refusal to prove that no handle/slot is published on failure.
669
670Local invalid-argument/stale-handle/wrong-parent/duplicate/capacity/unsupported
671categories map to vendor NV statuses 31/51/54/52/81/86, measured from headers.
672Malformed transports use negative errno; valid but unserved RM requests carry
673NV_ERR_NOT_SUPPORTED at their measured status offset.
674
675### Per-call serving and provenance
676
677The executable requires `--fake --host-model FIXTURE` (or separately authorized
678`--cuse --host-model FIXTURE`). Missing explicit mode, wrong fixture length,
679missing `HOST_MODEL` provenance or an invalid/corrupt GSP frame refuses startup.
680`rm/host-model.fixture` is synthetic, deterministically generated by the **test
681oracle** `tests/rms_fixture.py`. It is not a hardware capture. Its PCI identity,
682GPU ID 1, UUID `HOST_MODEL_UUID1`, SM version and class list are modeled inputs.
683The returned driver identity is `ogd HOST_MODEL/1`, never the NVIDIA version.
684
685Vendor routes below are from OGKM 580.173.02 at the source pin above. Local vendor
686calls must not be assigned invented RPC IDs. Public GR_GET_INFO reads a static
687cache: `kernel_graphics.c:1227-1247` obtains
688`INTERNAL_STATIC_KGR_GET_INFO` (`0x20800a2a`) through **GSP_RM_CONTROL (76)**;
689`kernel_graphics.c:2782-2834` serves public indices from that cache.
690`ctrl2080internal.h:408-426` defines its 8-engine, 58-record response;
691`generated/g_rpc-structures.h:1506-1518` defines the 40-byte control envelope.
692`rpc.c:10870` is the vendor serializer. `rmfxrpc` publishes that actual RPC
693through `gsp/rpc.om`, then validates the fixture's full queue reply: queue/RPC
694sequence, signature, version, aligned checksum, RPC function/result, command and
695body size. Only the decoded modeled SM record reaches the client.
696
697| Call | Verdict | Derivation / limit |
698|---|---|---|
699| CARD_INFO | SERVED_HOST_MODEL | Fixture card; vendor `kernel-open/nvidia/nv.c:2523` reads local inventory, no per-call RPC |
700| ROOT GET_ID_INFO_V2 | SERVED_HOST_MODEL | Fixture; `gpu_mgr/gpu_mgr.c:2527` local manager data, no RPC |
701| DEVICE GET_CLASSLIST | SERVED_HOST_MODEL | Fixture count and third-iovec list; `gpu/device_ctrl.c:56` local class table, no RPC |
702| SUBDEVICE GR_GET_INFO | SERVED_HOST_MODEL | One SM_VERSION record, decoded from the modeled static GSP control response above; unsupported indices refuse |
703| SUBDEVICE GET_GID_INFO | SERVED_HOST_MODEL | Fixture binary UUID; `gpu/gpu.c:5036` uses cached UUID, no per-call RPC |
704| MEMORY_SYSTEM / LOCAL_USER / USERMODE | SERVED_HOST_MODEL | Bounded first-fit 1024-page pool; owner and parent checks; USERMODE reserves 64 KiB, never a real doorbell |
705| MEMORY_VIRTUAL | SERVED_HOST_MODEL | Logical mapping namespace only, no physical pages |
706| CPU MAP / UNMAP | SERVED_HOST_MODEL | Memory bounds, page alignment, overlap checks, exact remove, live map-fd capability |
707| DMA MAP / UNMAP | SERVED_HOST_MODEL | Same bounds plus owning virtual-memory object; no IOMMU or device effects |
708| VID_HEAP_CONTROL | SERVED_HOST_MODEL | INFO only, shared 4 MiB modeled pool accounting; other functions refuse |
709| REGISTER_FD | SERVED_HOST_MODEL | Endpoint-issued live token imports shared namespace; stale/forged/busy/self import refused |
710| CHECK_VERSION_STR | SERVED_HOST_MODEL | Explicit ogd identity, no NVIDIA module compatibility claim |
711| ALLOC_OS_EVENT / FREE_OS_EVENT | REFUSED | NV_ERR_NOT_SUPPORTED; no IRQ/event subscription |
712| Client UVM init/register/range/map/free/unregister | SERVED_HOST_MODEL | Bounded per-namespace range adapter, fixture UUID, imported RM capability, matching modeled DMA map; MM_INITIALIZE refused as tolerated by the unmodified client |
713| Physical backing, mmap through a real device, page pinning, doorbells, real CUSE/RM/GSP, VFIO and chip | NOT_RUN | No authorization, no device access; no hardware truth inferred |
714
715`rm/memory.om` records size, contiguous page ownership and handle-plus-map
716refcounts, with 64 bounded mapping records. Cascading free first removes maps
717whose object/virtual namespace died, decrements refs, then releases every owned
718page. Partial/duplicate unmap, out-of-bounds and overlapping maps refuse.
719`rm/uvmclient.om` reuses `uvm/range.om`'s half-open bounded interval convention;
720it does not publish real UVM PTEs. The fake CUSE kernel uses anonymous CPU memory
721for the unmodified client's CPU reads/writes; it is **test transport**, not a
722first-party implementation of real RM backing.
723
724### Host acceptance and NOT_RUN runbook
725
726Run the device-hiding command in README. `tests/rme_check.py --mutants` exercises
727the cc layout oracle, dictionary/tree differential, deliberate red comparison,
728randomized and capacity/stale/cascade cases, exact command/size/flag/address
729refusals, isolated opens, closed fh tokens, descriptor inheritance, dead-worker
730survival, model RPC publication and rollback. It compiles and **runs**
731`tests/rme_consumer.c`, using vendor C structs and the CUDApp structural
732root/device/subdevice/VAS/TSG/context/GPFIFO/compute/control/free ordering.
733It uses no FIFO/notifier backing and performs no GPU launch. Ten compiling
734behavior mutants cover stale handle, wrong parent, size off-by-one, cascade
735skip, status mapping, cross-client lookup, unknown escape, double free,
736oversized payload and control-object class. Shared params/RPC/channel host
737gates remain separate, with their original compiler and reference pins.
738
739`tests/rms_check.py --mutants --client /tmp/ogd-cudapp-client` adds the independent
740page/mapping Python differential, an intentionally wrong expected result,
741provenance/checksum/missing-mode controls, local/usermode CPU map/unmap and ten
742compiling killed mutants: ownership, overlap, range limit, stale handle,
743double free, cascading page reclamation, token forgery, cross-client lookup,
744partial unmap and UVM collection. An RM backing or VAS free invalidates dependent
745UVM ranges; the gate proves address reuse and rejects creation through a freed
746VAS. Its C test kernel includes `nvrm.c` from a detached, unmodified
747checkout at the CUDApp pin above, with the client's checked Omega policy enabled.
748Only OS transport is interposed (`CUDAPP_NVRM_TEST_TRANSPORT=1`); the client runs
749open, alloc, control, CPU/DMA/UVM map, byte roundtrip, free and close. No compute
750submission or doorbell is exercised. The new receipt is `tests/rms-host-receipt.txt`;
751the older `rme-*-receipt.txt` files remain immutable historical evidence.
752
753**Real CUSE kernel hop, live RM, VFIO and chip: NOT_RUN.** No `/dev/cuse`,
754`/dev/nvidia*` or `/dev/vfio` was opened and no node/module/service was changed.
755Future operator procedure, requiring fresh explicit authority:
756
7571. Reproduce all boxed host gates on the exact candidate and retain source,
758 compiler and binary hashes. Keep the live model, watchdog and GPU lock untouched.
7592. In an isolated authorized host environment, provision CUSE independently.
760 Review `--cuse` node identity (`omega-rm-test` only), CPU affinity and access
761 permissions before registration. Never redirect existing NVIDIA device names.
7623. Exercise actual kernel ioctl copyin/copyout, nested-pointer retry faults,
763 independent/duplicated descriptors, release and exact-worker death using a
764 dedicated authorized kernel consumer. The existing C consumer is explicitly
765 a fake kernel and is not proof of that hop.
7664. Before any chip test, implement and review authenticated inventory/fd/backing
767 import, GSP boot/readiness/correlated replies, UVM association and completion/
768 teardown ownership. Run the boxed gates and their red controls again.
7695. Only in a separately authorized exclusive GPU window, follow `window/README.md`
770 for the exact device and rollback plan, then collect the live RM traces,
771 mapping visibility, channel scheduling, completion and teardown negative
772 controls. Do not infer permission to stop a service or unbind a module from
773 this document. Host success is not chip qualification or deployment.
774
775Sizing record: WolframLanguageEvaluator
776`{64*5,40+32+32+4096,16+16+32+4096,16+72+StringLength["DEVNAME=omega-rm-test"]+1,
777BitOr[BitShiftLeft[3,30],BitShiftLeft[4608,16],BitShiftLeft[70,8],200],2^32-95}`
778→ `{320,4200,4160,110,3523233480,4294967201}`. Vendor cc measurements, not
779these transport calculations, determine the ABI layouts.
780