- Updated tools/post_reboot.sh to check kernel oops taint bit and stuck driver tasks instead of <86400s uptime - Level 7 hardware regression passed on 0000:b3:00.0 (module 37e6fa430835eee2b426019db3ad70eeb7a9e9070c09c84bd9b973cf56cbe529, 107 inventory words, 0 static mismatches, CUDA baseline verified before and after) - Updated .gitignore to exclude build archives (*.a, *.rlib), __pycache__, and raw trace dumps
124 KiB
RM API implementation notes (Rust driver, slice 1: client level)
Companion to rmapi-userspace.md. Evidence labels as in BRIEF.md, plus:
- [E] executed original instructions:
tools/check_rmapi_binary.pyruns_nv000800rm(RmIoctl) and everything beneath it from the relocatednv-kernel.o_binaryunder Unicorn and records requests and replies (target/rmapi/original-rmapi.txt). The Rust module replays that record with no mask (rmapi::oracle_tests). - [O] captured traffic of the original on this machine (eight V100s).
- [U] static reading of the userspace library
libcuda.so.580.178.04(SHA-256dcdf334aeb177c95b3385b797c9b871d03a287895713c6d107f79096b0985aa9) withobjdump -d; addresses are file virtual addresses.
1. Design: presenting the original's device nodes while the original stays loaded
The original owns /dev/nvidiactl (195:255), /dev/nvidia0..7 (195:0..7) and
/dev/nvidia-uvm (510:0 on this boot). The Rust driver must not register major 195 or those
names. Nothing in this section was executed against libcuda; no CUDA program was run.
1.1 Can a private mount namespace redirect the nodes? (a)
What libcuda does before it opens a node [U]:
| Address | Behaviour |
|---|---|
0x4961a4..0x4961d5 |
For minor m (255 gives /dev/nvidiactl, otherwise /dev/nvidia%d): calls the node helper 0x4457a0(major = 0xc3, minor, path, "/proc/driver/nvidia/params") (mov $0xc3,%edi). If it does not return 1, calls 0x488850(minor); a non-zero result there ends the open with an error. |
0x4457a0 |
Reads ModifyDeviceFiles, DeviceFileUID, DeviceFileGID, DeviceFileMode from the params file (0x4455e0). With ModifyDeviceFiles == 1: stat(path); the node is accepted only if it is a character device and st_rdev == makedev(major, minor) (cmp -0x98(%rbp),%rbx at 0x445940) and mode and owner match; otherwise remove(path), `mknod(path, S_IFCHR |
0x4394b0 |
stat(path), must be a character device under /dev/; then remove("/dev/char/<major>:<minor>") and symlink("../<name>", "/dev/char/<major>:<minor>"). If the symlink cannot be made, the node is accepted only when the existing /dev/char/<major>:<minor> has the same st_rdev as the node. No comparison with major 195 on this path. |
0x488850 |
Runs /usr/bin/nvidia-modprobe (0x445410, posix_spawn), then stat(path): character device and st_rdev == makedev(195, minor) (or $0xc3,%bh / cmp -0x88(%rbp),%rbx at 0x4889db), else an error. |
0x31cdcf..0x31cf2c |
/dev/nvidia-uvm: open first (0x3197a0); the helper runs only when the open failed, with the major looked up in /proc/devices (0x4459d0("nvidia-uvm")). A node that opens is not checked. |
Facts of this host: /proc/driver/nvidia/params has ModifyDeviceFiles: 1,
DeviceFileMode: 438; no /dev/char/195:* entries exist. The straces
cuda-*-probe.strace were recorded with a filter (openat, ioctl, mmap, munmap, close), so
they neither show nor exclude stat/mknod; they do show /proc/driver/nvidia/params
opened before node opens (104 times in the compute probe) [O].
Consequences:
- Bind-mounting a Rust node (other major and minor) onto
/dev/nvidiactlalone fails with this host's settings: thest_rdevcheck fails,remove()of a mount point fails, themknodeither fails (unprivileged) or, for root in a writable/dev, would create a node of the original driver; then0x488850insists on 195:minor [U]. - It passes the library's checks when the same namespace also shows libcuda a params file
with
ModifyDeviceFiles: 0and/dev/char/195:<minor>symlinks that resolve to the bound nodes (or a writable/dev/char): the0x4394b0path accepts any character device [U]. This is a reading of the library, not a run.
1.2 Enumeration (b)
NV_ESC_CARD_INFO is answered by the open layer from its own device list [S]
nv.c:nvidia_read_card_info; 0x214 from the GPU manager's probed table [E]. libcuda
opens /dev/nvidia<minor_number> for the entries it gets [O] (minors 0..7 in the capture
match the nodes opened). The Rust control node keeps its own table of the PCI functions its
PCI driver has bound (rmapi::system::GpuTable), in probe order, and reports only those:
one GPU bound means one card entry, one probed id and minor_number equal to the number of
the Rust per-GPU node to bind at /dev/nvidia<minor>. The GPU id is
domain << 16 | bus << 8 | slot as in the original (0x1a00 for 0000:1a:00.0) [O].
0x215 ATTACH_IDS only validates ids on Linux [E]; a GPU becomes attached (0x201,
0x202, 0x205) when its device node is opened and the adapter initializes [S]+[O].
1.3 UVM (c)
Evidence: the workload issues 16 UVM ioctls and no RM_MAP_MEMORY_DMA; every GPU mapping
is UVM_MAP_EXTERNAL_ALLOCATION; the channel VA space is externally owned (dossier 3.6)
[O]. The stock UVM calls 76 distinct nvUvmInterface* functions, all exported by
nvidia.ko (kernel-open/nvidia/nv_uvm_interface.c), each a wrapper around one of the 73
rm_gpu_ops_* entry points of the closed object [S]+[A dossier]. Which of them this
workload reaches was not traced (dossier open question).
Option 1: stock nvidia-uvm as a second instance on a Rust nvUvmInterface layer |
Option 2: minimal compatible UVM in the Rust driver | |
|---|---|---|
| Kernel-side work | Implement the rm_gpu_ops set UVM uses at GPU registration and per channel (dossier 3.6: session, device, address space with external page directory, PMA alloc/pin/eviction callbacks, sys/FB memory with CPU maps, TSG and channel on a copy engine, fault buffer and access counter setup, NVLink/P2P caps, retain channel, bind resources, external PTEs, dup memory) with the exact structures of nv_uvm_types.h; plus the UVM callback registration and ISR hook |
The 16 ioctls only: registration of GPU and VA space, external ranges and MAP_EXTERNAL_ALLOCATION (PTEs written by the Rust MMU code directly instead of through a UVM channel), REGISTER_CHANNEL (map context buffers into the external VA space), semaphore pool, range groups, the three no-op initializers, one mmap |
| Build and coexistence | A renamed build is required: module name nvidia_uvm, /proc/driver/nvidia-uvm (UVM_PROC_DIR_NAME) and the kmem cache names collide; the imports must be renamed because a second module cannot export nvUvmInterface* while nvidia.ko exports them. The char device has a dynamic major, so only its name repeats in /proc/devices. Source is installed under /usr/src/nvidia-srv-580.178.04 |
No collision: one more node of the Rust driver |
| Engine state needed | PMA with eviction, a kernel channel on a copy engine with working faults and interrupts, fault buffer ownership, before the first user channel exists | External page directory handling and RM-side PTE writes; nothing UVM-private |
| Fidelity | Exact, including managed memory and fault handling | Only what was observed; each reply has to be established from the public UVM source and the capture; other workloads need more ioctls |
1.4 Recommendation and kernel-side requirements
- Nodes: a launcher creates a private mount namespace and binds the Rust control node
onto
/dev/nvidiactl, the Rust per-GPU node onto/dev/nvidia<minor>, a small directory of regular files onto/proc/driver/nvidia(aparamsfile withModifyDeviceFiles: 0), a tmpfs with the195:<minor>symlinks onto/dev/char, and the Rust UVM node onto/dev/nvidia-uvm. The first run must be traced withstat,mknod,symlink,unlinkandexecveto confirm 1.1 before anything depends on it; the fallback, if libcuda reaches a path not read here, is anLD_PRELOADshim forstat, which leaves the libraries unmodified but is not the same claim. - Kernel side for the nodes: character devices (misc devices are sufficient) with
permissions for the test user (today the node is 0600); a per-GPU node whose open
initializes the adapter and which supports
mmapandpoll;REGISTER_FDmust recognize a control file by its file operations (the original compares the major with 195 [S]nv.c:4101); which other files under/proc/driver/nvidialibcuda reads has to come from the traced first run. - Enumeration: as implemented in this slice (1.2).
- UVM: option 2 for the first workload, because its engine prerequisites are a subset
of what the RM path needs anyway, and it avoids a renamed out-of-tree build. Option 1
stays the route to managed memory. This is a judgement [I]; the
rm_gpu_opscall order of the stock module should be traced on the original (kprobes on the 73 symbols) before slice 3 fixes the VA-space interface, since both options need the same external page directory semantics.
2. What slice 1 implements
Code: core src/nvidia/src/rmapi/ (#![forbid(unsafe_code)], no_std), kernel FFI
src/nvidia/kernel/rmapi_node.rs, C adapter kernel-open/nvidia/rmapi_node.c
(/dev/nvidia-rs-rmapi-ctl, misc device, mode 0600). Hooks: three lines in
kernel-open/nvidia/diagnostic.c (init/exit), two in pci_driver.c (GPU added to and
removed from the node's table at probe and remove).
2.1 Escape dispatcher (rmapi::escape) [E]
The table of _nv000800rm for all 25 escapes (rmapi-userspace.md 3.1) was re-established
by executing the function for every escape number 0..255, 24 sizes, both node kinds and 15
class values of NV_ESC_RM_ALLOC (12,344 cases) with its callees replaced by recorders. A
wrong size or node returns 0x1f, an unknown escape 0xffff; the open layer turns any non-zero
result into -EINVAL and copies the block back unchanged [S] nv.c:2744. NV_ESC_RM_ALLOC
accepts 0x20 and 0x30 bytes; classes 0, 1 and 0x41 are rewritten to 0x41 and need the
control node; 0x05, 0x78, 0x79 and 0x7e are accepted on any node.
2.2 Handle database (rmapi::server) [E unless noted]
| Rule | Result | Original function |
|---|---|---|
| Client handle generation | `0xc1d00000 | index`; the index advances once per attempt and is never reused; an occupied handle moves on by 0x400 inside its bucket; leaving the prefix retries with the next index |
Caller-chosen client handle (hRoot != 0) |
any free value is accepted; in use gives 0x19 and leaves hObjectNew as sent |
same |
Client hObjectNew input |
ignored; the reply holds the client handle, also when the allocation then fails | serverAllocClient |
Client with hObjectParent != 0 |
0x57, the generated handle is consumed | same |
| Client parameter block | optional 4 bytes, receives the handle; the size field of NVOS64 is not consulted | _nv054236rm |
| Parameter rule of every class | table size when required or when a pointer is given, else 0; required with a null pointer is 0x1f; unknown class 0x22; both precede the client lookup | _nv056291rm, _nv054262rm |
flags bit 0 (serialized) |
0x6a, nothing allocated | _nv056315rm |
| Unknown client / client of another file | 0x33 / 0x23 (alloc and free); controls give 0x23 for both | _nv016041rm, _nv054373rm with the system properties +0x70/+0x71 set |
| Class privilege flags | 0x400 always 0x1b for user callers; 0x200 gives 0x1b unless the caller is an administrator; before the parent lookup | _nv056299rm |
hObjectNew == hRoot for a class with a parent list |
0x36, before the parent lookup | same |
| Parent not found (including 0) | 0x57 | same |
| Internal-only class (flag 0x80) | 0x22, after the parent lookup | same |
| Single-instance class already under the parent | 0x63, before the parent-class check | same |
| Parent of a class not in the parent list | 0x36 | same |
| Generated resource handle | 0xcaf00000 + counter % 0x80000, counter per client, used values skipped, all used gives 0x1a |
_nv019538rm |
| Caller-chosen resource handle | 0xc9f00000..=0xc9f7ffff gives 0x33; in use gives 0x19; anything else accepted, including values inside the generated range |
RsClient vtable +0x78 |
| Constructor failure | its status; the handle stays assigned in the reply and the counter stays advanced | _nv019502rm |
| Free of an unknown handle | 0 | _nv056325rm (compatibility mode) |
hObjectParent of NVOS00 |
ignored | _nv000641rm |
| Free of a client | frees every object, then the client; a later use gives 0x33 (alloc, free) or 0x23 (control); the dispatcher purges the client's OS events only when status is 0 and hObjectOld == hRoot |
_nv056325rm, _nv054153rm |
| Destruction order | pending-free list: reverse pre-order of the freed subtree with children in (NVOC class id, handle) order | _nv019571rm, observed at _nv019537rm for a client with six children |
| Free priority | each class-record freePriority == 1 object, in list order up to the freed object, is moved to the front with its subtree |
_nv054370rm [D, REA], _nv019571rm [A, REA]; the 16 priority-1 classes [A dossier]. Not covered by [E]: the fixture cannot build a channel. The Rust code is tested against a direct transcription of the public algorithm |
| File close | every client allocated through the file is freed | [S] rm_cleanup_file_private; order between clients not established |
Control entry order (_nv015942rm, _nv056303rm): NULL command (cmd & 0x3fff == 0) is
0; flags & 3 is 0x1f; client 0x23; when the command's class (cmd >> 16) exports the
command, a different size is 0x1f; a size without a pointer or a pointer without a size is
0x1f [S for commands without a table entry]; then the parameter copy; object 0x57; command
not exported by the object's class or its ancestors 0x56; flags & 4 0x6a; handler.
2.3 Client controls (rmapi::client) [E]
| Command | Size | Original handler | Behaviour here |
|---|---|---|---|
0x101 (deprecated) |
40 | converter selected by _nv000745rm, runs 0x13e |
size query when any of the three buffers is null (53); 0x3a when sizeOfStrings < 53; otherwise three strings and the changelist numbers. The object handle, the declared size and the calling file are not checked; flags & 4 is 0x56 |
0x13e |
1032 | _nv019691rm |
driver version, version, branch, title, changelist |
0x1f0 |
4 | _nv019699rm |
bit 0 always; bit 3 with IMEX channels; bit 4 with test-only code |
0x201 |
128 | _nv019623rm -> _nv031389rm |
attached ids in GPU-instance order |
0x202 / 0x205 |
40 / 32 | _nv019626rm / _nv019625rm -> _nv031410rm |
id info of an attached GPU; 0x1f and an untouched block otherwise. Flag word from ten GPU conditions (client::IdFlags). The MIG NUMA path is not modelled |
0x214 |
384 | _nv019633rm -> _nv031430rm |
probed ids, excluded ids, and a third array at 0x100 that the public structure lacks |
0x215 |
132 | _nv019618rm |
validation against the probed list only |
0x288 |
3076 | _nv019622rm -> _nv031370rm |
one record per probed GPU with both instance ids invalid (no MIG table) |
0xa04 |
2244 | _nv019686rm -> _nv031322rm |
zero groups |
0xd04 |
12 | _nv019597rm -> _nv019599rm |
type >= 8 is 0x1f; a CLIENT policy that is not a revocation needs its target client (0x33). The list itself follows the public clientShareResource_IMPL [S]; nothing reads it yet |
Open-layer escapes [S] nv.c: NV_ESC_CARD_INFO (existing inventory::card_info),
NV_ESC_SYS_PARAMS (system::sys_params), NV_ESC_CHECK_VERSION_STR (existing
protocol::version_check).
2.4 Per-system data
Filled from the driver's real state: card entries and probed ids from the PCI functions the
driver bound (bus, slot, vendor, device, IRQ, BAR0, BAR1, a minor number per GPU). No GPU is
ever attached, because no adapter of this driver completes its first open: 0x201 lists
nothing and 0x202/0x205 answer 0x1f for the bound GPU, which is what the original
answers for a probed GPU whose node nobody opened [E]. IMEX channels: none, so 0x1f0
returns 1 where the capture shows 9.
2.5 Returns "unavailable", and why
| Request | Result | Reason |
|---|---|---|
| Any class other than the client (all 19 other workload classes, including 0xcb33) | NV status 0x56 after all server checks, with the handle assigned | no constructor exists; 0xcb33 needs the confidential-computing capability inputs (os_cc_* probes, GPU manager caps) |
The 118 other RmClientResource commands (workload: 0x27b, 0xd01, 0x136, 0x13a, 0x216) |
NV status 0x56 after the entry checks | bodies not written; all are issued after the first device allocation |
| Controls on any other object | 0x57 (no such object can exist) | - |
| Escapes the dispatcher accepts but that have no body: 0x27, 0x28, 0x32..0x39, 0x41, 0x4a, 0x4d, 0x4e, 0x4f, 0x54, 0x57, 0x58, 0x59, 0x5e, 0x5f, 0xc9, 0xd1 | ioctl error EOPNOTSUPP |
mapping, events, device node and registry paths belong to later slices |
ATTACH_GPUS_TO_FD, NUMA_INFO, SET_NUMA_STATUS, QUERY_DEVICE_INTR, EXPORT_TO_DMABUF_FD, WAIT_OPEN_COMPLETE, 0xce, 0xcf, 0x52 |
EINVAL (unknown to this node) |
device-node and event escapes |
Known deviations of the adapter from the original, none of which the workload exercises:
the ioctl type must be 'F' with read and write direction (the original looks only at the
number and size); fixed tables (64 clients, 1,024 objects) fail with 0x1a where the original
allocates; a parameter block over 64 KiB for a command without a table entry is 0x1f; a
faulting parameter copy gives 0x1e in the status field (live probes of the original for
controls, reports/control-copy-original.json; assumed for allocations and for the 0x101
string copies); kernel-privileged
callers and the event-class fixup of _nv054231rm are not modelled; one mutex stands in
for the API lock, the client lock and the GPUs lock.
3. Oracle, reference and their limits
tools/check_rmapi_binary.py(shared loadertools/rmapi_binary_emulator.py): 12,344 dispatcher cases and seven sequences with 1,261 operations through the unmodified escape path. Replaced by fixtures: the OS boundary, the three lock families, diagnostics, the registry lookup, the administrator query, the event purge, and the system object with a fabricated GPU manager (probed table, attached table, eleven GPU objects carrying only the fields the id-info handler reads) and the six GPU property services of_nv031410rm. Limits: no class constructor is replaced, so only the client, MpsApi, GpuManagementApi and ConfidentialComputeApi construct; trees are one level deep; the device constructor fails for lack of a GPU; concurrency, lock order and kernel callers are not exercised.- Captured payloads (
analysis-580.178.04/reports/cuda-compute-*-ioctl-payloads.jsonl, three runs) [O]: 426 client-level requests replayed against a description of the capture machine. Translated: client handles. Masked:gpuFlagsbit 0 (IN_USE) of0x202/0x205. Inputs taken from the capture rather than derived: PCI facts,sliStatus,boardId, instances and flag bit 4 of each GPU. The captures do not contain the 0x101 strings.
4. Plan for the next slices
| Slice | Content | Needs from engine state |
|---|---|---|
| 2 | Device node (/dev/nvidia<minor> equivalent): open that initializes the adapter, REGISTER_FD, NUMA_INFO, WAIT_OPEN_COMPLETE; attached table; 0xcb33 with 0xcb330101; remaining client commands 0x27b, 0xd01, 0x136, 0x13a, 0x216 |
first open complete (the attach); CPU confidential-computing probes; nothing else |
| 3 | 0x80, 0x2080, 0x2081 and the 36 per-GPU commands of dossier 3.4 B; events fixup; GPU-group and device-only lock classes | static GPU info, PCI and bus info, FB and heap sizes, FIFO engine table, GR static info, CE caps, ECC state |
| 4 | 0xc361 and 0x90e6 with RM_MAP_MEMORY, RM_UNMAP_MEMORY and mmap of BAR0 ranges; 0x90e60101; 0xd01 |
BAR0 mapping contexts, interrupt tree constants |
| 5 | VA spaces 0x90f1 (externally owned and RM-managed), 0x50a0, 0x503c with its three commands | GMMU, VA space bookkeeping, page directory ownership rules |
| 6 | Memory: 0x40, 0x3e, 0x71 (RM_ALLOC_MEMORY), BAR1 CPU mappings, RM_UPDATE_DEVICE_MAPPING_INFO |
video heap or PMA, BAR1 mapping, system memory with DMA, user page pinning |
| 7 | UVM node (1.3): the 16 ioctls | external page directory, PTE writes for RM memory, context buffer mapping |
| 8 | Channels: 0xa06c, 0x9067, 0xc36f, 0xc3c0, 0xc3b5 and their commands; free-priority teardown becomes observable | FIFO channel and TSG state, instance blocks, runlists for GR0 and COPY2..7, GR and CE contexts, usermode doorbell |
| 9 | Events: 0x79 with ALLOC_OS_EVENT/FREE_OS_EVENT, poll, event purge on client free |
non-stall interrupt path |
| 10 | 0x83de and the policy commands (0x83de0309, 0x20801210, 0xa06c0103, 0x801909, 0x2080200a, 0x2080012f); teardown commands |
GR context (CILP), runlist timeslice, perf, TSG preempt |
5. Validation of slice 1 (2026-11-19)
Details and hashes: reports/rmapi-slice1-validation.json.
- Emulation oracle: 12,344 dispatcher cases, 626 allocations, 19 frees, 616 controls and 180 string buffers reproduced without a mask.
- Capture replay: 426 requests compared over three captures; client handles translated, 216 IN_USE bit differences masked.
- QEMU guest (
tests/vm/rmapi_user_test.c, 129 assertions per module load, with and without the emulated IOMMU): the node driven from userspace with the EDU function as the one bound GPU; passes. tools/validate_all.sh: all 30 steps pass on the second run; the first run lost three steps while other agents were building in the same tree, and each passed when rerun.- Not done: nothing was run against libcuda or any node of the original driver; the namespace design of section 1 is untested; the host live step loads the module but does not open the new node.
Addendum 2026-11-19 (main session): device-node checks observed on the original driver
Evidence class [O]: strace -f of target/hardware-hello/native-hello on 0000:b3:00.0 under the
original driver, tracing stat/mknod/symlink/unlink/readlink/access/openat/chmod/chown. Capture:
target/observe/native-hello-devnodes.strace. The run verified 64 words.
access("/sys/module/nvidia/initstate", R_OK)and lateraccess("/sys/module/nvidia_uvm/initstate", R_OK): the libraries test that modules namednvidiaandnvidia_uvmare loaded.openat("/proc/driver/nvidia/params")before any device node.stat("/dev/nvidiactl")returningst_rdev = makedev(195, 255), thenunlink("/dev/char/195:255")(ENOENT),symlink("../nvidiactl", "/dev/char/195:255")(EACCES for an unprivileged user),stat("/dev/char/195:255")(ENOENT),stat("/usr/bin/nvidia-modprobe")(ENOENT), and thenopenat("/dev/nvidiactl", O_RDWR)succeeds. So on this host the missing/dev/charsymlink does not prevent the open, and nomknodis attempted when the node already has the expectedst_rdev.stat("/proc/driver/nvidia/gpus/<bdf>/numa_status")for each of the eight GPUs (ENOENT each).- [I] A private namespace for the Rust driver must therefore also present
/sys/module/nvidia/initstate,/sys/module/nvidia_uvm/initstateand/proc/driver/nvidia/paramsin the expected form, in addition to the device nodes. Thest_rdevcomparison that the static reading found is confirmed as executed; what happens when it does not match was not observed.
6. Slices 2 and 3a (2026-11-19): device, subdevice and the information controls
Nothing in this section was run against libcuda, a CUDA program or any node of the original
driver. Evidence labels as above; [E] now also covers the second record
target/rmapi/original-rmapi-gpu.txt (see 6.1), and [A] readings made for this slice are
listed in 6.9.
6.1 Oracle: a GPU object built by the original itself
tools/check_rmapi_binary.py no longer fabricates anything for the GPU-backed cases. In the
emulator it runs, in this order: _nv021662rm (coreInitializeRm: the real system object, GPU
manager, resource server and RM API; the RM's internal client takes handle 0xc1d00000),
_nv000794rm (RmInitPrivateState on an nv_state_t laid out from the public nv.h: probe-time
reads of PMC_BOOT_0/1/42 and gpumgrRegisterGpuId), _nv031506rm, _nv031359rm, _nv054107rm,
_nv031377rm (GPU instance, GPU lock, device instance) and _nv031364rm (gpumgrAttachGpu) with
the attach argument the public osInitNvMapping builds. The attach completes with status 0:
objCreate(OBJGPU) with its four binders, the property initializer, and gpuPostConstruct
_nv031028rm with every engine child of a GV100 constructed.
What the attach touches on the hardware side [E]:
| Access | Registers | Reader |
|---|---|---|
| read | 0x0, 0xa00, 0x4 | _nv031364rm (HAL selection) |
| read | 0x4 | _nv031028rm (virtual-mode check) |
| read | 0x1070 | _nv030643rm (via _nv030487rm): emulation/simulation properties |
| read | 0x88000, 0x8802c, 0x88008 | _nv031092rm under _nv030601rm: PCI ids through the config mirror |
| read | 0x88084 | _nv031092rm under _nv039144rm (bus object) |
| read | 0x8 | _nv031239rm |
| read | 0x1373a0, 0x21c04, 0x21434 | fuse queries _nv029045rm (first in _nv028946rm, then four times through _nv030951rm) |
| read | 0x1078 | _nv020551rm |
| read | 0x10ac08 | _nv052308rm (PMU, from the ACR constructor path) |
| read | 0x15f8 | _nv030690rm |
| read | 0x140 | _nv037574rm (interrupt enable, end of the attach) |
| write | 0xd96c + 0x50*i = 0xc80, i = 0..6 | _nv049615rm during child construction (writer not attributed further) |
Values come from the physical transcript of 0000:b3:00.0 (first read of each register).
0x1070, 0x8 and 0x1078 are not in the transcript (lost events at its head) and are case inputs
with value 0; with all-ones the property byte GPU+0x90e and a few other bytes change, so the
value 0 is an assumption that the capture's 0x20800119 reply (0) is consistent with.
Limits of this fixture, which bound every [E] claim of this section:
- The GPU is constructed, not initialized. The state stages that follow the attach in
_nv000790rm(RmInitNvDevice: PreInit, Init, Load) are not executed.gpumgrGetGpu_nv031398rmonly returns a GPU with byte +0x90d set (PDB_PROP_GPU_STATE_INITIALIZED [S]) or to a thread with expanded visibility; the cases set that byte by hand ("initialized 1"). - The RM API lock is still a fixture; the GPUs lock is the original code.
- The original's control cache is put into its comparing mode (mode word 2 instead of 1) so
that every request reaches its handler. In its normal mode a cacheable command is answered
from the first reply before the object, its class, the calling file and the serialization
flag are looked at (case
gpu-control-cache): a device handle then answers a subdevice command, and so does a client of another file. The Rust module has no such cache; with constant inputs the replies are the same, the shortcuts are not reproduced. - One GPU, one client file per case, no concurrency.
6.2 What "attached" means, and what opening a device node does
- [S]
nvidia_open->nv_open_device(nv.c:1611) ->nv_start_device->rm_init_adapter(nv.c:1480) on the first open of a device node (run on the kernel threadnv_open_q, nv.c:5538, withNV_ESC_WAIT_OPEN_COMPLETEfor callers that poll); the last close runsrm_shutdown_adapter(nv.c:2008).RmInitAdapterattaches the GPU and runs the stages;RmShutdownAdapterdeletes the devices of all clients on the GPU (rmapiDelPendingDevices, osinit.c:2350/2493) and detaches it (gpumgrDetachGpu, osinit.c:2390). - [E] Until the GPU is returned by
gpumgrGetGpu,0x201lists nothing,0x202/0x205answer 0x1f, and a device allocation answers 0x40 (INVALID_STATE) from the allocation prologue_nv054074rm. With byte +0x90d set the GPU is listed,0x202answers, and the device constructs. So "attached" for the client controls is: in the GPU manager's attach mask and initialized. - [E]+[S] A device can only be allocated by a process that holds that GPU's device node
open: the device constructor
_nv022139rmcalls_nv049724rm->nv_is_gpu_accessible, which walks the descriptors of the calling process for a file of that GPU (nv.c:5796), and returns 0x1b (INSUFFICIENT_PERMISSIONS) otherwise, also for an administrator (the check is skipped only for kernel-privileged callers). - [E] On the constructed GPU
0x202reports flags 0, sliStatus 0, boardId equal to the GPU id and NUMA id -1, also with a device allocated. The capture's values (flags 0x10 before and 0x11 with a device, sliStatus 0x20000000) therefore come from the state stages: bit 0 from_nv030934rm, bit 4 from_nv030277rm, sliStatus from GPU+0x1e50. Their producers are not identified.
What the Rust device node does (decision). /dev/nvidia-rs-rmapi-gpu<minor> can be opened
although no engine exists. The first open attaches the GPU in the sense of the client
controls: lowest free GPU instance and device instance, board id = GPU id, flag word 0. The
GPU is then listed by 0x201, answered by 0x202/0x205, accepted by 0x216, and devices,
subdevices and BinaryApi objects can be made on it by a process that holds the node open.
The last close detaches it and frees every device bound to it, whichever client owns it.
This is a declared deviation: the original never shows a GPU in this state, and its open
fails when the adapter cannot be initialized. The distinction is made per command, not per
node: commands whose inputs are constants, probe-time facts or request-time bookkeeping
answer (6.4); every other exported command answers NV status 0x56 after the entry checks,
and gpu::UNAVAILABLE names what each one is missing. The older diagnostic node
/dev/nvidia-rs-<BDF> (first open of the bring-up path, EOPNOTSUPP) is untouched and
independent.
6.3 Classes [E unless noted]
| Class | Rule | Result | Original |
|---|---|---|---|
| 0x80 Device | no parameter block | 0x1f | prologue _nv054074rm |
deviceId > 31 |
0x1f | prologue | |
| no initialized GPU for the device instance, nor at GPU instance 0 | 0x40 | prologue | |
flag 0x800 with vaLimitInternal < vaStartInternal or = 0 |
0x1f | _nv022139rm |
|
| device instance without GPUs (1..31 here) | 0x22 | _nv031456rm |
|
hClientShare: 0 or the client itself, or a client of the same file; unknown handle 0x33; client of another file 0x23 (also for an administrator) |
_nv056331rm and the client's access check |
||
flag 0x8 with vaSpaceSize = 0 |
0x1f | _nv022272rm [A] |
|
| flag 0x4000 without 0x2000 | 0x1f | _nv022139rm |
|
| caller does not hold the GPU's device node open | 0x1b | _nv049724rm |
|
vaMode any value (0..4, 0xffffffff), hTargetClient, hTargetDevice, other flag bits |
accepted | ||
| several devices of one client on one GPU | accepted | ||
| 0x2080 Subdevice | parent not a device | 0x36 (server) | |
subDeviceId >= 8 |
0x22 | _nv057381rm |
|
| instance already present under the device (no block means 0) | 0x1a | ||
| instances 1..7 on a one-GPU device | accepted, bound to the device's GPU | ||
| freed: the client's compute-mode reservation is released | [E], [S] subdevice.c:390 | ||
| 0x2081 BinaryApi | parent must be a subdevice (0x36); several per subdevice | ||
| 0xcb33 | parent must be the client (0x36); several per client; the parameter block is not used | ||
| free | subtree in the order of 2.2, e.g. device with subdevices 1, 2, 7 and a later one with a BinaryApi child: the three, the child, its subdevice, the device | _nv019537rm calls |
Not established: rules that need more than one GPU or an SLI device; the device paths for a
virtual GPU (GPU+0xe00) and for the conditions behind statuses 0x10 and 0xffff
(_nv022139rm reads GPU+0x917 and asks the KernelRc object); what vaMode 0 and 1 create
later (no VA space exists in this slice); the device constructor's writes into its own
object.
NV_ESC_REGISTER_FD (4 bytes, a descriptor of a control file) [E for the first six rows, A
for the instruction order, D for the last row]: wrong size 0x1f; calling file already has a
control file 0x40; descriptor not a control file 0x1f; the calling file itself 0x1f; a
control file that is itself registered 0x1f; otherwise the association is stored and the
control file's reference is held until release; a calling file that is the target of an
fd-carrying control (type 1) gives 0x17. A control file can register another control file.
The ioctl result is -EINVAL for every non-zero status and the block is returned unchanged.
0xcb33 (question of the task): it is the per-client ConfidentialComputeApi object. Its
constructor needs nothing from a GPU [E]; its one workload command 0xcb330101 reports the
CPU-side confidential-computing state (system properties +0xa4..+0xa8, which the original
takes from the os_cc_* probes when the system object is constructed) in byte 0 and the GPU
manager's aggregated capabilities in bytes 1..5. On a host without confidential computing and
with GV100s (no ConfidentialCompute engine) all six bytes are 0 [E], equal to the capture [O].
The Rust driver reports the properties as clear; it does not probe the CPU.
6.4 Controls implemented in this slice
Handler bodies were read from the exported pseudocode [D] and each was then executed [E] with the inputs varied by writing the named bytes of the original objects (the "poke" lines of the record); the Rust replies equal the original's for every variation.
| Command | Handler | Logic | Inputs and their class |
|---|---|---|---|
0x27b |
_nv019630rm |
system property +0x67 | (a) clear |
0x136 |
_nv019698rm |
1; with +0x6c: 4 if +0x6d, else 3 if +0x6e, else 2 | (a) clear |
0x216 |
_nv019619rm |
only gpuIds[0] is examined: 0xffff and the terminator pass, otherwise it must be attached (0x1f); nothing is detached |
attached table |
0xcb330101 |
_nv021482rm |
see 6.3 | (a) |
0x800280 |
_nv022207rm |
GPUs of the device instance | (a) 1 |
0x800289 |
_nv022213rm |
byte 4 = GRID support; mode 2 if GPU+0xe00, 1 if +0x4de6, else 0 (3 and 4 need a vGPU hypervisor); bytes 5..7 untouched | (a) clear on bare metal |
0x20801701 |
_nv058218rm |
architecture, implementation, revision, subrevision byte | (b) PMC_BOOT_0, decoded by _nv030823rm [A]; GPU+0xd38 is written by no attach routine |
0x20801801 |
_nv057435rm |
device id, subsystem id, revision, device id >> 16 | (b) BAR0 0x88000/0x8802c/0x88008 = PCI configuration; taken from the PCI core |
0x20800119 |
_nv057843rm |
1, 3, 4, 5 or -1 by GPU+0x4de3, +0x4de4, +0x4de5, +0x90e, +0x4de2 in that order, else 0 | (b) BAR0 0x1070 through _nv030643rm; assumed clear (silicon), the register is not read |
0x20800131 |
_nv057864rm |
GPU+0x1e2c | request-time state, default 0 |
0x20800145 / 0x20800146 |
_nv057773rm / _nv057886rm |
reservation word GPU+0x1e34 = client handle; rules 0: always granted; 1 and 3: only when free; 2: never (0x63); release only by the holder | request-time state; the MIG check _nv041837rm is taken as false |
0x20803601 |
_nv057956rm -> _nv057957rm |
zero reply | (a) no GSP |
0x2080182b |
_nv057419rm -> _nv057420rm |
cleared block; the GV100 bus slot _nv017359rm is empty |
(a) |
0x20808159 |
_nv057845rm -> _nv030743rm |
count 1..41, then (index, value) pairs: byte GPU+0x6d66+index; bad count or index 0x1f | (c) bytes are 0 after the constructors and equal the capture for the queried indexes; a writer in the state stages was not searched for |
0x20808162 |
_nv057749rm |
on GV100 (_nv054349rm) the byte GPU+0x541f |
(c) 0 after the constructors, equal to the capture |
0x20810108 |
_nv017850rm -> _nv029325rm |
flag byte, entry count and one trailing byte cleared, nothing else written | (a) no entries on GV100 |
The GPU-bound bodies refuse a chip that PMC_BOOT_0 does not decode as GV100 (0x56). The chip
test uses the PMC_BOOT_0 fields where the original's _nv030933rm uses the PMC_BOOT_42
fields; on a GV100 both give architecture 0x140, implementation 0.
6.5 All 68 workload commands
State after slices 3c, 4 and 5 (sections 8, 9 and 10): 37 implemented, 31 unavailable (24 need engine state on a client, device, subdevice or BinaryApi object, with the chain of each in 8.3; 7 belong to object classes of later slices). "executes" in the reason column means the original handler ran to completion on the constructed GPU of the oracle. Rows marked "(3b)", "(3c)" and "(4)" name the slice that implemented them.
| Command | Name | Calls | Handler | State | Inputs, or what is missing |
|---|---|---|---|---|---|
0x101 |
SYSTEM_GET_BUILD_VERSION | 1 | converter over 0x13e |
implemented | (a) version strings of the build |
0xd04 |
CLIENT_SET_INHERITED_SHARE_POLICY | 2 | _nv019597rm |
implemented | request only |
0x1f0 |
SYSTEM_GET_FEATURES | 1 | _nv019699rm |
implemented | (a) IMEX channel count (module parameter), test-only property |
0x214 |
GPU_GET_PROBED_IDS | 1 | _nv019633rm |
implemented | probed table (PCI probe) |
0xa04 |
SYNC_GPU_BOOST_GROUP_INFO | 1 | _nv019686rm |
implemented | (a) no boost groups |
0x215 |
GPU_ATTACH_IDS | 8 | _nv019618rm |
implemented | probed table |
0xcb330101 |
NV_CONF_COMPUTE_CTRL_CMD_SYSTEM_GET_CAPABILI | 1 | _nv021482rm |
implemented | (a) system CC properties +0xa4..+0xa8 (clear), GPU-manager CC capabilities (none on GV100) |
0x288 |
GPU_GET_ACTIVE_DEVICE_IDS | 1 | _nv019622rm |
implemented | probed table; no MIG |
0x205 |
GPU_GET_ID_INFO_V2 | 16 | _nv019625rm |
implemented | attached table (device node open); flag bits IN_USE and bit 4 and sliStatus need the initialized GPU |
0x201 |
GPU_GET_ATTACHED_IDS | 16 | _nv019623rm |
implemented | attached table |
0x202 |
GPU_GET_ID_INFO | 80 | _nv019626rm |
implemented | as 0x205 |
0x801402 |
HOST_GET_CAPS_V2 | 8 | _nv022229rm |
implemented (3b) | providers::kernel_bus (_nv039407rm, a KernelBus routine, not KernelFifo): chipset I/O-coherent property, first host bridge ids (PCI core), GPU+0x93f |
0x800292 |
GPU_GET_CLASSLIST_V2 | 8 | _nv022202rm |
implemented (3b) | providers::class_db: the GV100 class descriptor list, minus the KernelDisplay records when the display fuse (BAR0 0x21c04 bit 0, read at the first open after 0x1373a0) is set |
0x800280 |
GPU_GET_NUM_SUBDEVICES | 8 | _nv022207rm |
implemented | (a) one GPU per device instance |
0x20801303 |
FB_GET_INFO_V2 | 40 | _nv057667rm |
unavailable | by index (8.3): six indexes equal the capture after the memory PreInit bodies; RAM and heap sizes need MemorySystem/MemoryManager InitLocked, which do not run in the oracle |
0x2080014a |
GPU_GET_GID_INFO | 16 | _nv057810rm |
unavailable | GPU UUID: PMU-provided identity (status 0x31 on the constructed GPU) |
0x800289 |
GPU_GET_VIRTUALIZATION_MODE | 8 | _nv022213rm |
implemented | (a) GRID support, GPU+0xe00, +0x4de6 (clear on bare metal) |
0x20810108 |
(closed-only) | 8 | _nv017850rm |
implemented | (a) no entries on GV100 |
0x20800102 |
GPU_GET_INFO_V2 | 8 | _nv057817rm |
unavailable | equal to the capture for the workload's eleven indexes once the PreInit prologue has run (8.3); the per-index readers of _nv029324rm were not read |
0x20801701 |
MC_GET_ARCH_INFO | 8 | _nv058218rm |
implemented | (b) PMC_BOOT_0 (BAR0 0x0) decoded by _nv030823rm; read by the PCI probe |
0x20801823 |
BUS_GET_INFO_V2 | 16 | _nv057427rm |
unavailable | by index (8.3): link-state indexes 0xb, 0x2d and 6 still differ after OBJBIF and KernelBif InitLocked; they need the Load stage |
0x20801801 |
BUS_GET_PCI_INFO | 8 | _nv057435rm |
implemented | (b) BAR0 0x88000/0x8802c/0x88008 (_nv030601rm) = PCI config ids; from the PCI core |
0x20801803 |
BUS_GET_PCI_BAR_INFO | 8 | _nv057434rm |
unavailable | KernelBus+0x50c/+0x510/+0x550; equal to the capture after KernelBus PreInitLocked _nv039599rm (8.3), whose body was not read |
0x2080182a |
BUS_GET_PCIE_SUPPORTED_GPU_ATOMICS | 36 | _nv057446rm |
implemented (3b) | providers::bif: (c) thirteen OBJBIF records, zero after the constructors and in the capture; a non-zero first word (the 28 peer queries) is 0x56 |
0x2080012f |
GPU_QUERY_ECC_STATUS | 10 | _nv057871rm |
unavailable | ECC units and counters: MemorySystem, Graphics, FIFO, PMU, NVLink objects after init |
0x20800170 |
GPU_GET_ENGINES_V2 | 8 | _nv057800rm |
implemented (3c) | providers::kernel_ce: the PCE-LCE words BAR0 0x104040..0x104060, 0x104034, 0x104038 (read-only, first open of the device node), the class database and the static engine table |
0x20800119 |
GPU_GET_SIMULATION_INFO | 8 | _nv057843rm |
implemented | (b) BAR0 0x1070 via _nv030643rm; this driver assumes silicon (all five properties clear) without reading it |
0x27b |
GPU_GET_MEMOP_ENABLE | 8 | _nv019630rm |
implemented | (a) system property +0x67 (clear) |
0x20801201 |
GR_GET_INFO | 8 | _nv058173rm |
unavailable | KernelGraphics static information |
0x2080122a |
GR_GET_GPC_MASK | 8 | _nv058170rm |
unavailable | KernelGraphics static information (GPC mask) |
0x2080122b |
GR_GET_TPC_MASK | 48 | _nv058182rm |
unavailable | KernelGraphics static information (TPC masks) |
0x20801227 |
GR_GET_CAPS_V2 | 8 | _nv058160rm |
unavailable | KernelGraphics capability table |
0x20802a0a |
CE_GET_ALL_CAPS | 8 | _nv057478rm |
unavailable | the engine mask follows providers::kernel_ce (0xff in the oracle and the capture); the capability bits per engine (OBJCE HAL +0x2a0, +0x278, +0x2f0, KernelCE HAL +0x160) were not read, and six capability bytes still differ from the capture (NVLink-dependent) |
0x20800195 |
GPU_GET_COMPUTE_POLICY_CONFIG | 8 | _nv057789rm |
unavailable | compute policy configuration: PMU object state |
0x2080121b |
GR_GET_GLOBAL_SM_ORDER | 8 | _nv058169rm |
unavailable | KernelGraphics static information (SM order) |
0x20803801 |
GRMGR_GET_GR_FS_INFO | 8 | _nv057954rm |
unavailable | graphics-manager floorsweeping information: KernelGraphicsManager and KernelMIGManager |
0x801307 |
FB_GET_CAPS_V2 | 8 | _nv022176rm |
unavailable | twelve property bytes of MemoryManager, KernelMemorySystem and the static configuration (_nv043913rm); equal to the capture after the two memory PreInit bodies, writers not traced (8.3) |
0xd01 |
CLIENT_GET_ADDR_SPACE_TYPE | 55 | _nv019591rm |
implemented (5) | the memory table (rmapi::memory): 1 system memory, 2 video memory; the register windows 0xc361 and 0x90e6 (type 3 in the capture) have no class yet |
0x90e60101 |
NV90E6_CTRL_CMD_MASTER_GET_ERROR_INTR_OFFSET | 8 | - |
unavailable | its object class has no constructor: GenericEngineApi 0x90e6 (mapping slice) |
0x20803601 |
GSP_GET_FEATURES | 9 | _nv057956rm |
implemented | (a) zero without GSP |
0x20800111 |
GPU_GET_SHORT_NAME_STRING | 8 | _nv057842rm |
unavailable | short name string (INVALID_STATE on the constructed GPU) |
0x20800110 |
GPU_GET_NAME_STRING | 8 | _nv057825rm |
unavailable | name string from the board identification of the state stages (INVALID_STATE on the constructed GPU) |
0x20800131 |
GPU_QUERY_COMPUTE_MODE_RULES | 8 | _nv057864rm |
implemented | request-time state GPU+0x1e2c (default 0; its setter 0x20800130 has no body) |
0x20808159 |
(closed-only) | 8 | _nv057845rm |
implemented | (c) bytes GPU+0x6d66..+0x6d8e: zero after the constructors; a later writer was not searched for |
0x136 |
SYSTEM_GET_FABRIC_STATUS | 1 | _nv019698rm |
implemented | (a) system properties +0x6c..+0x6e (clear: status 1) |
0x2080220c |
RC_RELEASE_WATCHDOG_REQUESTS | 15 | _nv058617rm |
implemented (3b) | providers::kernel_rc (_nv042163rm): request-time bookkeeping; the MIG check _nv041837rm is taken as false |
0x20802210 |
RC_SOFT_DISABLE_WATCHDOG | 8 | _nv058619rm |
implemented (3b) | as 0x2080220c |
0x13a |
SYSTEM_GET_P2P_CAPS_MATRIX | 1 | _nv019705rm |
unavailable | per-pair P2P capabilities: KernelBif and NVLink state of each attached GPU |
0x20808162 |
(closed-only) | 8 | _nv057749rm |
implemented | (c) byte GPU+0x541f on GV100: zero after the constructors |
0x20803002 |
NVLINK_GET_NVLINK_STATUS | 8 | _nv057433rm |
unavailable | NVLink status: KernelNvlink link state |
0x2080182b |
BUS_GET_C2C_INFO | 8 | _nv057419rm |
implemented | (a) empty on GV100 (_nv017359rm) |
0x216 |
GPU_DETACH_IDS | 7 | _nv019619rm |
implemented | attached table; first id only |
0x503c0102 |
NV503C_CTRL_CMD_REGISTER_VA_SPACE | 1 | _nv059454rm |
implemented (4) | request-time bookkeeping of the ThirdPartyP2P object (vaspace::P2p) |
0x20800145 |
GPU_ACQUIRE_COMPUTE_MODE_RESERVATION | 1 | _nv057773rm |
implemented | request-time state GPU+0x1e2c, +0x1e34; the MIG check _nv041837rm is taken as false |
0x80170d |
FIFO_GET_CHANNELLIST | 32 | _nv022183rm |
unavailable | KernelFifo channel list |
0x906f0101 |
NV906F_CTRL_GET_CLASS_ENGINEID | 40 | - |
unavailable | its object class has no constructor: KernelChannel 0xc36f (slice 8) |
0xc36f0108 |
NVC36F_CTRL_CMD_GPFIFO_GET_WORK_SUBMIT_TOKEN | 32 | - |
unavailable | its object class has no constructor: KernelChannel 0xc36f (slice 8) |
0x20801218 |
GR_GET_CTX_BUFFER_SIZE | 8 | _nv058163rm |
unavailable | KernelGraphics context buffer sizes |
0xa06c0101 |
NVA06C_CTRL_CMD_GPFIFO_SCHEDULE | 7 | - |
unavailable | its object class has no constructor: KernelChannelGroupApi 0xa06c (slice 8) |
0x2080200a |
PERF_BOOST | 2 | _nv058209rm |
unavailable | KernelPerf boost state |
0x83de0309 |
NV83DE_CTRL_CMD_DEBUG_SET_EXCEPTION_MASK | 1 | - |
unavailable | its object class has no constructor: KernelSMDebuggerSession 0x83de (slice 10) |
0x20801210 |
GR_SET_CTXSW_PREEMPTION_MODE | 1 | _nv058205rm |
unavailable | graphics context of a channel group |
0xa06c0103 |
NVA06C_CTRL_CMD_SET_TIMESLICE | 1 | - |
unavailable | its object class has no constructor: KernelChannelGroupApi 0xa06c (slice 8) |
0x801909 |
PERF_CUDA_LIMIT_SET_CONTROL | 2 | _nv022243rm |
unavailable | KernelPerf CUDA limit state |
0x503c0104 |
NV503C_CTRL_CMD_REGISTER_VIDMEM | 1 | _nv059456rm |
implemented (5) | a video memory object of the client; only the workload's form is established (10.5) |
0x503c0105 |
NV503C_CTRL_CMD_UNREGISTER_VIDMEM | 1 | _nv059458rm |
implemented (5) | as 0x503c0104 (0x57 for an unregistered handle [E]) |
0xa06c0105 |
NVA06C_CTRL_CMD_PREEMPT | 1 | - |
unavailable | its object class has no constructor: KernelChannelGroupApi 0xa06c (slice 8) |
0x20800146 |
GPU_RELEASE_COMPUTE_MODE_RESERVATION | 1 | _nv057886rm |
implemented | as 0x20800145 |
Commands of the list that looked computable but were left unavailable on purpose: 0x801402
(three zero bytes on GV100, equal to the capture, but produced by the KernelFifo object the
constructors build: reading _nv039407rm is the missing step), 0x2080182a (capability words
OBJBIF+0xbf0.., equal to the capture for the GPU itself; the 28 peer queries of the workload
return 0x56 in the capture and were not executed), 0x2080220c/0x20802210 (KernelRc
counters, no reply bytes), 0x800292 (the class list is a product of the class database
after the stages: 118 records after construction, 99 classes in the capture).
6.6 Kernel exposure
/dev/nvidia-rs-rmapi-gpu<minor>: one misc device per listed GPU, mode 0600, created when the PCI function is bound and removed with it; the number is theminor_numberofNV_ESC_CARD_INFO. No name or major of the original is used.- Open, release: 6.2. A file that outlives its GPU (unbind while open) keeps working as a file; it no longer counts for a later GPU that reuses the number (generation check).
- ioctl: same escape path as the control node with the device-node rules of
_nv000800rm(object escapes are refused with-EINVAL);NV_ESC_REGISTER_FDon either node. - The mask of device nodes the calling process holds open is computed per ioctl with
iterate_fd, asnv_is_gpu_accessibledoes. mmap:-EINVALon both nodes, which is what the original answers for a file without a mapping context [S] nv-mmap.c:527; no context can exist beforeNV_ESC_RM_MAP_MEMORYhas a body.poll: queues the caller and reports no event, asnvidia_polldoes with an empty queue [S] nv.c:2256; no event can be allocated yet.- Not done:
NV_ESC_NUMA_INFO,NV_ESC_WAIT_OPEN_COMPLETE,NV_ESC_ALLOC_OS_EVENT,NV_ESC_STATUS_CODEon the device node (the workload issuesNUMA_INFOonce per GPU).
6.7 Namespace launcher (tools/rmapi_namespace_launcher.py) and the st_rdev question
Written by a subagent from a static reading of libcuda [U] and the strace of the addendum
[O]; only --dry-run, --json, --self-check and argument validation were executed. Real
mode (unshare, mounts, exec) has never run, here or in the guest (the guest image has no
Python). Invocation: python tools/rmapi_namespace_launcher.py --dry-run --ctl-node /dev/nvidia-rs-rmapi-ctl --gpu-node 0=/dev/nvidia-rs-rmapi-gpu0 --bdf 0=0000:b3:00.0 -- CMD;
real mode is the same as root without --dry-run.
Corrections to 1.1 found by re-reading libcuda [U]:
- The fallback in
0x4394b0comparesst_ino(offset 8 of both stat buffers,0x439599), notst_rdev, and it runs after any symlink failure. - The
ModifyDeviceFiles: 1path also ends in0x4394b0(0x4459a8,0x4459c0). On this host the symlink fails for an unprivileged user, the helper returns 0 and0x488850runs on every open; the open succeeds only because the node is 195:255 [O]. 0x3197a0isget_mempolicy, not an open. The UVM path calls the node helper with no params file, so/dev/nvidia-uvmis always handled withModifyDeviceFiles1.
| Option | Finding | Verdict |
|---|---|---|
(a) params with ModifyDeviceFiles: 0 plus /dev/char/195:<minor> links |
0x445808 goes straight to 0x4394b0: character device under /dev/, then the link either can be made or already resolves to the same inode. No rdev comparison, no mknod; a return of 1 skips 0x488850 (0x4961bc). A node with rdev 10:x passes [U, not run] |
recommended, with the hardening below |
| (b) Rust devices under major 195 | register_chrdev_region fails while the original holds 195; needs the original unloaded, i.e. all eight GPUs away from it |
later option, the most faithful |
(c) LD_PRELOAD stat shim |
libcuda imports only __xstat, __xstat64, __fxstat and no raw stat syscall was found (linear sweep) |
fallback; weakens "unmodified" to "unmodified libraries in a modified process" |
(d) user namespace, tmpfs /dev, mknod 195:minor |
mknod of a device needs CAP_MKNOD in the initial user namespace; a tmpfs of another user namespace is nodev; and with real root a 195:255 node opens the original's cdev, because the kernel resolves by device number | cannot work, and is the hazard to exclude |
Hardening the launcher builds in, because with no /dev/nvidia-uvm libcuda calls
mknod(/dev/nvidia-uvm, <major from /proc/devices>:0) (0x44586e), which as root in a
writable /dev would create and open the original's UVM node: the namespace's /dev is a
fresh tmpfs holding only generic nodes and the redirected ones, remounted read-only and nodev,
moved over /dev so that no path to 195:* or 510:* remains; every entry is stat-checked
before exec; a source node with a major of the original is refused; /usr/bin/nvidia-modprobe
is masked when present; /proc/driver/nvidia is covered by a staged directory (params with
the host's key list, an empty gpus/<bdf>/ so that numa_status stays absent as in [O]).
Residual risks: nine more statically linked copies of the helper pattern in libcuda were not
read; a root process inside the namespace can still reach the host's /dev through
/proc/1/root (use --user, which needs the nodes to be openable by that user: they are
0600 root today); without a Rust UVM node CUDA initialization cannot complete.
6.8 Validation of slices 2 and 3a
Details and hashes: reports/rmapi-slice2-validation.json.
- Emulation oracle, GPU record: 101 allocations, 54 frees, 102 controls and 10 descriptor
registrations reproduced without a mask (
rmapi::gpu_tests::original_gpu_object_record); 13 operations of the control-cache case are not modelled. The slice 1 record is unchanged (same SHA-256) and still reproduced. - Capture replay: 687 requests compared (426 before), same single mask (216 IN_USE bits).
New: the device, subdevice, BinaryApi and confidential-compute allocations of two captures
with libcuda's own handles, all 14 commands of 6.4 that are issued on those objects, and
0x27band0x136on the client. The third capture has no allocation parameters, and0x216does not occur in any of them (it is covered by the oracle only). - QEMU guest: 299 assertions per module load, with and without the emulated IOMMU, including
the device node, the fork test of the access rule,
REGISTER_FD,mmap,polland the detach on last close.
6.9 Readings at instruction level made for this slice
REA Ghidra procedure_assembly: _nv022272rm (flag 8 with a zero size is 0x1f), _nv030823rm
(PMC_BOOT_0 and PMC_BOOT_42 field decode). Capstone on the relocated object: the 0xc9 branch of
_nv000800rm (nv_get_file_private(fd, 1, ..), same-file compare, target +0x58 test, and
the 0x17 exit of the neighbouring fd-control path). Everything else in this section is [E]
and [D]; the device constructor _nv022139rm in particular was read as pseudocode and its
order of checks confirmed only by the executed cases.
6.10 Updated plan
| Slice | Content | Needs from the engine side |
|---|---|---|
| 3b | 0x801402, 0x2080182a, 0x2080220c/0x20802210, 0x800292, 0x20800170, 0x20802a0a, NUMA_INFO, the control cache |
Rust producers for objects the original's constructors already build: KernelFifo capability table and engine table (0x20802a0a reads the device-info registers 0x22700.. and 0x2390.. in the oracle), OBJBIF capability words, KernelRc counters, the class database with its removals |
| 3c | 0x20800102, 0x20800110/0x111, 0x2080014a, 0x20801303, 0x801307, 0x20801803, 0x20801823, 0x2080012f, 0x20800195, the GR static-info group, 0x20803801, 0x20803002, 0x13a |
the state stages: static GPU info and board identification, PMU-provided UUID and compute policy, MemoryManager/heap/KernelBus after init, KernelGraphics static info (gpu/gr_init.rs exists but has no kernel provider), NVLink and BIF link state |
| 4 onwards | as in section 4 (0xc361 and 0x90e6 with RM_MAP_MEMORY, VA spaces, memory, UVM, channels, events, policy) |
as in section 4; 0x202's IN_USE, bit 4 and sliStatus come with the first initialized adapter |
The fastest way to grow 3b and 3c is the method of 6.1: the constructed GPU already exists in the oracle, so each state stage that the bring-up work reproduces can be executed there in front of the control handlers, and the handler replies compared with the capture.
7. Slice 3b and the control cache (2026-11-19); classification of slice 3c
Nothing in this section was run against libcuda, a CUDA program or any node of the original
driver. No GPU register was accessed by this work: the kernel paths added here were executed
only in the QEMU guest (fixture reader) and by the host live step, which opens no RM API node.
Evidence labels as above. [A] readings of this slice: REA Ghidra procedure_assembly of
_nv013519rm, _nv030260rm, _nv028946rm, _nv039407rm; REA procedure_callers of
_nv030258rm, _nv030259rm, _nv030260rm. [S] is the matching public source
(rmapi_cache.c, control.c, gpu.c, gpu_resource_desc.c, kern_bus.c,
kernel_rc_watchdog.c). Everything marked [E] is in the GPU record
target/rmapi/original-rmapi-gpu.txt (three cases, 428 operations) and is replayed by
rmapi::gpu_tests without a mask.
7.1 Oracle changes
- The control cache now runs in the mode the original's initializer sets (1). The former
workaround (mode word forced to 2) is gone. Where a case wants the handler itself it says
flush: the original's ownrmapiControlCacheFreeAllCacheForGpu_nv054205rmis called for GPU instance 0 and for the system-wide key 0x20. The 13 operations that were skipped are part of the rewritten casegpu-control-cache(73 controls) and are compared. - New step
sweep: the original's base PreInit pass_nv031220rm(gpuStatePreInit) is executed on the constructed GPU the way the first open runs it (GPU not initialized, expanded visibility, GPUs lock held), with the per-engine PreInit dispatcher_nv026850rmreplaced by "status 0". What executes is the prologue (branding, internal client, device and subdevice, chip information) and the missing-engine sweep with the engines' own presence checks. It returns 0, reads 146 distinct registers (list in the record linesweep-registers; values are the first read of each in the transcript of0000:b3:00.0; only 0x200 changes value later in the transcript) and would write 0x200 = 0x42001120 and 0x1100 = 8 (recorded, not applied). Limit: the PreInit bodies of the engines are not executed, so this is the state after the sweep, not after PreInit. - New record lines
descriptorsandclassdb(the GPU's class descriptor list and class database read out of the original object) and peeks of the chipset object, OBJBIF and KernelRc.
7.2 The class database (question of the task)
| Step | Finding | Evidence |
|---|---|---|
| Descriptor list | GPU+0xd90, 121 entries on a GV100: generic classes and the chip's engine-less classes with descriptor 0x7ef3cb00 (ENG_GPU), then the chip's class-to-engine list | [E] descriptors; [S] gpuConstructEngineTable |
| Database | gpuBuildClassDB _nv030181rm copies it to GPU+0xdc8 (count +0xdd8) without class 0xffffffff and descriptor 0xb33b1500: 118 records (0xf2, 0xb0cc and 0x506f are left out) |
[E] classdb, [D] |
| List | gpuGetClassList _nv030463rm skips a class equal to the one before it (0xc3b7 three times, 0xc3b5 nine times): 108 classes on the constructed GPU |
[E], [D] |
| Removal | The missing-engine sweep at the start of PreInit calls gpuDeleteEngineOnPreInit _nv030262rm for, in order, KernelNvlink (0xce681800), OBJDISP (0xd1755e00), KernelDisplay (0x55952e00), OBJHDA (0xd3bfb400); each ends in _nv030260rm -> _nv013519rm, which deletes the records of that engine descriptor and clears the engine-table valid byte GPU+0x2520 |
[E] sweep-removed; [A] _nv013519rm, _nv030260rm |
| Which records | Only KernelDisplay owns records: 0x73, 0xc370, 0xc371, 0xc372, 0xc373, 0xc37a, 0xc37b, 0xc37d, 0xc37e. 118 - 9 = 109 records, 99 classes, byte for byte the captured list of every V100 | [E], [O] 16 replies |
| Why KernelDisplay | Its presence check _nv030195rm (GPU+0x128) is the OBJFUSE query _nv028946rm: fuse id 0xff00003b = fuse word 0xc04 (register 0x21c04), shift 0, mask 1, present when 0; read through _nv029045rm after the Jtag function (register 0x1373a0). The transcript reads 1 |
[A] _nv028946rm; [D] _nv029006rm, _nv030195rm; [T] |
| OBJDISP, OBJHDA | Not constructed at all on this GPU (child pointers NULL after the attach); the sweep only removes their descriptors from the engine lists | [E] |
Corrections to earlier documents: the display engines are removed in the sweep, not by
KernelDisplay's PreInit returning 0x56 (first-open-spine.md 3.4 inferred the latter); OBJDISP
and OBJHDA are never constructed here rather than "removed at run time"; KernelNvlink is also
removed by the sweep in this emulation (its presence check _nv042034rm with the transcript's
first reads of 0xa00000..), which no dossier lists. The KernelNvlink removal depends on
registers whose first transcript value may not be what the sweep would see; it has no effect on
the class list and is recorded as observed, not as a fact about the board.
Other writers of the class database [A callers, D bodies], none of which changes the list of a
V100: _nv039842rm (GV100 kceUpdateClassDB, KernelCE HAL +0x130) deletes the records of a
stubbed copy engine (descriptor 0x793ceb00 | index) and adds those of the others; _nv019120rm
(OBJCE HAL +0x2a8); _nv033232rm; _nv041874rm, _nv046189rm, _nv055607rm (by class id);
_nv030261rm. The copy-engine update is what turns the 16 engines of the constructed GPU into
the 15 of the capture (7.5).
Rust: rmapi::providers::class_db + generated class_db_gv100.rs
(tools/generate_rmapi_class_db.py, from the descriptors line; --check in the make
target). Inputs on hardware: BAR0 0x1373a0 and 0x21c04, read once at the first open of the
GPU's device node. Assumed: GPU+0x92b clear (with it set _nv028946rm asks GPU+0x868 instead
of the fuse [A]); no SuppressClassList registry key. Not established: a GPU whose fuse is
clear (its attach reads display registers the transcript lacks).
7.3 The other 3b commands
| Command | Chain | Logic | Inputs |
|---|---|---|---|
0x801402 |
_nv022229rm -> _nv013913rm (_kbusGetHostCaps, per-GPU loop) -> _nv039407rm (kbusGetDeviceCaps) |
three cleared bytes; byte 2 bit 6 when chipset+0x6a is clear; byte 2 bit 5 when chipset+0xaa == 0x10de and (GPU+0x93f or chipset+0xa8 in 0x800..=0x807) [A]+[E, ten variations] | chipset object system+0x208: +0x6a is set by its constructor [E] (public name PDB_PROP_CL_IS_CHIPSET_IO_COHERENT [S]); +0xaa/+0xa8 are the first host bridge's ids, here taken from the PCI core's first host bridge (the original's own search order is not reproduced); GPU+0x93f (c) clear. Multi-GPU devices are not built |
0x2080182a |
_nv057446rm -> _nv057447rm |
first word non-zero: 0x56; otherwise byte +8+8i and word +12+8i from OBJBIF+0xbf0+8i, i < 13; bytes between are untouched (the command is not cacheable, the block is copied in) [E] | (c) zero records; needs OBJBIF, KernelBif and bus type 3 (constant on GV100) |
0x2080220c, 0x20802210 |
_nv058617rm / _nv058619rm -> _nv042163rm (krcWatchdogChangeState, operations 0xc and 0xe) |
public algorithm [S] with the closed tables at .rodata +0x4d50722/+0x4d5071d/+0x4d50718; a soft-disable request sets flags bit 1 when no enable or disable request exists; the subdevice destructor releases (operation 0xd) [E, 38 requests with the four KernelRc words peeked after each] | request-time state. The enable (0x2080220a) and disable commands have no body; their branches are covered by varying the counts |
7.4 The control cache (rules; rmapi::cache)
| Question | Rule | Evidence |
|---|---|---|
| Which commands | table flag 0x400 (CACHEABLE) or 0x20000 (CACHEABLE_BY_INPUT), access right 0, not flag 0x80; mode word not 0. Workload: 0x27b, 0x800280, 0x801307, 0x801402, 0x20800111, 0x20800119, 0x20801701, 0x20801801, 0x20801803, 0x20803601, 0x20808162 (0x400); 0x20800102, 0x20800110, 0x20808159 (0x20000) | [S] rmapiControlIsCacheable; table flags [A dossier] |
| Where | in _nv015942rm after NULL command, flags & 3 (0x1f) and client-exists (0x23), when size equals the table size and a pointer is given; a hit returns 0. Not looked at on a hit: the calling file, the object's class, flags & 4, the GPU's initialized byte |
[E] |
| Key | (GPU instance, command). The instance comes from a map keyed (client, object) that Device, Subdevice (and DispCommon) allocations fill and their free, or the client's, empties; a handle without an entry misses and takes the normal path (so (client, client) is 0x56 and an unknown object 0x57 as before). Commands of class 0 use instance 0x20 and ignore the object: a subdevice handle answers 0x27b |
[E]; [S] alloc_free.c:1423 |
| Per GPU or per client | per GPU instance: another client, also of another file, gets the first client's reply | [E] |
| Privilege | flag 4 needs an administrator; no flag of 4, 8, 0x80 is kernel-only (_nv054096rm with the entry's stored flags) |
[D], [S]; not exercised (no such cacheable workload command) |
| Store | after a reply with status 0, when the key has no entry; an existing entry is kept (mode 2 logs assertion 0x240 when it differs) | [E] |
| Input block | a CACHEABLE command's block is zeroed, not copied in; a BY_INPUT block is copied | [S] SKIP_COPYIN_ZERO_BUFFER; consistent with every [E] reply |
| By input | per-command handler. 0x20808159 keeps one value per index (all 41 cacheable); a request hits when every index is stored, else the handler answers all of it and only the missing indexes are added (assertion 0x40d when a stored one differs) | [E] |
| Invalidation | _nv054205rm empties one instance (called at state destroy [S] gpu.c:3939); _nv054208rm spares entries with flag 0x800000 (state unload [S] gpu.c:3574); _nv054207rm one command (copy-engine caps [S]) |
[D]+[S]; _nv054205rm executed |
| Mode | 1 from _nv054213rm (registry RmEnableCacheableControls [D]); 2 verify only: no hits, stores only new entries; 0: neither. Client command 0x13f sets it [S] (no body here) |
[E] for the three modes |
Rust: the node checks the cache before the normal path (ControlNode::execute), files replies
under the instance recorded in the object's entry at allocation, and empties an instance when
the last file of the GPU's device node closes. Deviations: fixed storage (48 entries of at most
256 bytes; a longer reply is never stored and keeps reaching its handler, which only matters
when state changes between calls); the user block of a CACHEABLE command is copied in although
the original would not read it (a faulting block gives 0x1e here where the original answers
from the cache); the handlers of this module write every byte of a CACHEABLE reply instead of
receiving a zeroed block.
7.5 Slice 3c: classification of the 26 remaining commands
Method: each handler was executed on the constructed GPU with the capture's request [E]; the callees named are the first non-infrastructure ones it entered. None of these chains has been read at assembly level, and no stage body was executed in front of them; the class column is therefore a judgement from [E] statuses, [D] bodies and [S] names, to be confirmed when the command is implemented. (i) = producer exists in verified core code, (ii) = small self-contained producer, (iii) = needs firmware or a large missing engine.
| Command | Handler -> first callees | Constructed GPU vs capture | Producer of the missing state | Class |
|---|---|---|---|---|
0x20800170 engines |
_nv057800rm -> _nv031235rm (engine table from the class database), _nv041750rm, _nv057496rm |
16 engines vs 15 (0x11, COPY8, gone); still 16 after the sweep [E] | KernelCE InitLocked _nv039835rm / HAL +0x120 _nv039837rm -> _nv039840rm -> _nv039842rm: deletes the classes of copy engines whose OBJCE+0x488 (stubbed) byte the PCE-LCE mapping set |
(ii) once the mapping is reproduced; registers 0x104028..0x104060 |
0x20802a0a CE caps |
_nv057478rm -> _nv057479rm, _nv057481rm, _nv018962rm |
executes, reads 0x2004, 0x2390.., 0x22700.., 0x104028..0x104060 at call time; 9 bytes differ (mask 0x1ff vs 0xff, caps of instances 2, 3, 8) | same mapping; per-instance capability words of OBJCE | (ii) with the above |
0x20801303 FB info |
_nv057667rm -> _nv041602rm, _nv041853rm |
index 8 gives 0 vs 0x2000000 (RAM size in KiB); index 0x3b 0 vs 0xffffffff; a heap index faults | per index: MemorySystem/MemoryManager Init (RAM size: mmu/vram.rs), heap sizes (mmu/placement.rs), reserved memory |
(i) for the size indexes, heap indexes need the heap object |
0x801307 FB caps |
_nv022176rm -> _nv043913rm |
faults (MemoryManager state missing) | MemoryManager StateInit capability table | (ii)/(iii) not read |
0x20801803 BAR info |
_nv057434rm -> _nv030950rm |
executes; 7 bytes differ | KernelBus aperture sizes after InitLocked (mmu/bar2_setup.rs covers BAR2) |
(i)/(ii) |
0x20801823 bus info |
_nv057427rm -> _nv029319rm, _nv039138rm |
executes; 1 byte differs | by index: OBJBIF/KernelBif link state (PCIe capability registers through the config mirror) | (ii) |
0x20800102 GPU info |
_nv057817rm -> _nv029324rm, _nv060460rm |
0x40 | by index; the gate is the static-information control issued in PreInit's prologue plus per-index engine state | (iii) as a whole |
0x20800110, 0x20800111 names |
_nv057825rm -> _nv030641rm; _nv057842rm -> _nv030699rm |
0x40 | board identification: PCI id tables and VBIOS strings (branding step of PreInit and OBJVBIOS) | (iii) VBIOS |
0x2080014a UUID |
_nv057810rm -> _nv030562rm, _nv030397rm |
0x31 | GPU UUID from the PMU/InfoROM identity during Load | (iii) PMU |
0x20800195 compute policy |
_nv057789rm -> _nv030562rm, _nv030397rm |
0x31 | same gate as the UUID | (iii) |
0x2080012f ECC |
_nv057871rm -> _nv057872rm, _nv000333rm, _nv034037rm |
0x56 | ECC units of MemorySystem, Graphics, FIFO, PMU, NVLink after Load | (iii) |
0x20801201, 0x2080121b, 0x20801227, 0x2080122a, 0x2080122b, 0x20801218 GR |
_nv058173rm; _nv058169rm -> _nv041811rm; _nv058160rm -> _nv041166rm; _nv058170rm -> _nv041173rm; _nv058182rm -> _nv041177rm; _nv058163rm -> _nv041165rm |
fault / 0x40 / 0x40 / 1 byte / 1 byte / 0x57 | KernelGraphics static information, loaded at PostLoad (kgraphicsLoadStaticInfo) from the Graphics engine: GPC/TPC masks and SM order from the fuse and discovery words gpu/gr_init.rs already produces, capability table, context buffer sizes from the FECS size queries |
(i) masks and SM order over gpu/gr_init.rs; (iii) buffer sizes (FECS) |
0x20803801 GR FS info |
_nv057954rm -> _nv033991rm, _nv033986rm, _nv034023rm |
executes with an assertion; 11 bytes differ | KernelGraphicsManager floorsweeping words (same fuse inputs) | (i)/(ii) |
0x20803002 NVLink status |
_nv057433rm -> _nv041840rm |
executes; 260 bytes differ | KernelNvlink link state (and whether the engine is present at all, see 7.2) | (iii) |
0x13a P2P caps |
_nv019705rm -> _nv031403rm |
0x1f | per GPU pair: KernelBif and KernelNvlink state of initialized GPUs | (iii) |
0x801909, 0x2080200a perf |
_nv022243rm; _nv058209rm -> _nv051077rm |
0x2f (INVALID_LOCK_STATE: a lock state the oracle's fixtures do not provide; the capture has status 0 and the same reply byte) / faults | KernelPerf state | (ii) for 0x801909 once its lock rule is read; (iii) |
0xd01, 0x80170d, 0x20801210 |
- | - | objects of slices 4 and 8 | later slices |
7.6 Kernel exposure of slice 3
- The five commands answer on the existing nodes (
/dev/nvidia-rs-rmapi-ctlwith objects made through a held/dev/nvidia-rs-rmapi-gpu<minor>). - Registers read on hardware by the control paths: BAR0 0x1373a0 and 0x21c04, in that
order, once per bound GV100, at the first open of its device node, under the node mutex,
through
nv_rs_pci_read32(the PCI lease's locked read; the PCI probe registers it withnv_rs_rmapi_node_gpu_reader). Both are read-only status words that the original reads at attach. No register is written. No control reads a register at call time. If a read fails the fuse stays unknown and 0x800292 answers 0x56. - The first host bridge's vendor and device id come from the PCI core at node init
(
pci_get_class), not from a GPU. - The last close of a GPU's device node empties that GPU instance's cache entries.
- Never executed on a real GPU: the reader path ran only against the guest's fixture reader.
7.7 Validation of slice 3
reports/rmapi-slice3-validation.json has the numbers and hashes. Summary: GPU record 116
allocations, 60 frees, 242 controls, 10 descriptor registrations, 163 peeked words and 4 class
tables reproduced with no mask (39 replies entered the cache; nothing skipped); seven injected
faults (cache never hitting, cache replacing an entry, watchdog flag condition, host bridge
range, sweep polarity, list de-duplication, atomics first word) each failed the comparison;
capture replay 823 requests (687 before) with the same single mask; guest test 313 assertions.
7.8 What the next slices need from the engine side
| Slice | Objects | Inputs and state needed | Provided by |
|---|---|---|---|
| 3c remainder | the 26 commands of 7.5 | (a) copy-engine PCE-LCE mapping (CE registers 0x104028..0x104060, OBJCE stubbed bytes) for the engine list and CE caps; (b) memory sizes and reserved ranges already computed by mmu/placement.rs and mmu/vram.rs (eight registers: 0x100ce0, 0x100a0c, 0x100e34, 0x100e48, 0x2008, 0x104028, 0x17e3f4, 0x12006c) for the FB size indexes; (c) GR fuse and discovery words of gpu/gr_init.rs for GPC/TPC masks, SM order and floorsweeping; (d) VBIOS strings, PMU identity, FECS size queries, NVLink state for the rest |
(a) nothing yet; (b) bring-up level 4 inputs (register reads only); (c) level 7 inputs (register reads only); (d) VBIOS image (level 7 already reads the PROM window), PMU after the ACR level, FECS start (PostLoad) |
4 0xc361, 0x90e6, RM_MAP_MEMORY of BAR0 ranges |
usermode doorbell region BAR0 0x810000, interrupt tree constants (0x90e60101) |
BAR0 physical range (PCI core); the GV100 interrupt table (gpu/intr_table.rs); mmap contexts on the device node |
no bring-up level; 0xd01 then becomes answerable |
5 VA spaces 0x90f1, 0x50a0, 0x503c |
GMMU VA space objects, externally owned page directory | GMMU format and page-table writer (mmu/ has the BAR2 path); VA space heap bookkeeping (pure CPU state); for a PDE/PTE that the GPU reads: an instance block and BAR2 or PRAMIN access |
level 4 (BAR2 bound) for kernel-side page-table writes; nothing for pure bookkeeping and externally owned directories |
6 memory 0x40, 0x3e, 0x71, BAR1 mappings |
framebuffer heap (or PMA), BAR1 VA space, system memory with DMA | heap ranges after the reserved and hidden regions (mmu/placement.rs model, which is the original's observed heap behaviour for the internal allocations only); BAR1 instance block and page tables (KernelBus InitLocked BAR1 part, not implemented: only BAR2 is); DMA mapping of pinned pages (kernel dma_adapter exists) |
level 4 inputs; a new level for BAR1 (0x1704 bind, trace segment before the FIFO load); the user-visible heap policy has no oracle yet |
| 7 UVM node | external ranges, MAP_EXTERNAL_ALLOCATION, REGISTER_CHANNEL |
everything of 5 and 6, plus PTE writes into the externally owned directory and context-buffer mappings | levels 4 and 6 |
8 channels 0xa06c, 0x9067, 0xc36f, 0xc3c0, 0xc3b5 |
KernelChannelGroup, KernelChannel, GR and CE contexts | FIFO host loaded (level 6: runlist buffers, PBDMA setup, USERD in BAR1 at 0x2254); per-channel RAMFC/RAMIN and instance block writes (fifo/ and mmu/instance.rs have the formats); runlist submit and the doorbell; GR context: FECS and GPCCS running and the golden context image, which the original creates on the first GR object allocation (graphics dossier), i.e. PMU LS start and the unit-0x0a bootstrap after the ACR level; CE context for 0xc3b5 needs the copy-engine mapping of (a) |
level 6 (FIFO), level 7 (graphics load), level 8 (ACR) and the not yet existing FECS/GPCCS start and golden-context steps |
| 9 events, 10 policy | OS events, non-stall interrupts; CILP, timeslice, preempt | non-stall interrupt tree armed (gpu/gv100_nonstall.rs); runlist timeslice and TSG preempt (fifo/timeslice.rs, fifo/preempt.rs) on a running FIFO |
interrupts bound (not part of any level yet); level 6 |
7.9 Updated plan
| Slice | Content | Needs |
|---|---|---|
| 3c-1 | engine list and CE caps (copy-engine mapping), FB size indexes of 0x20801303, GPC/TPC masks, SM order, GR FS info |
producers (a), (b), (c) of 7.8 with the oracle extended as in 7.1: each needs the corresponding original stage bodies run in front of the handler (KernelCE InitLocked, MemorySystem/MemoryManager Init, KernelGraphics static-info load), which was not done in this slice |
| 3c-2 | names, UUID, compute policy, ECC, context buffer sizes, NVLink, P2P | VBIOS, PMU, FECS, NVLink |
| also open from 3b | NV_ESC_NUMA_INFO on the device node; the by-input cache handlers of 0x20800102 and 0x20800110 (they come with those commands) |
- |
| 4 onwards | as in 6.10 and 7.8 |
8. Slice 3c (2026-11-19): stage bodies in the oracle, the engine list, and what stays unavailable
Nothing in this section was run against libcuda, a CUDA program, any node of the original
driver or a GPU. [A] readings of this slice: REA Ghidra procedure_assembly of
_nv019120rm; capstone on the relocated object for _nv031235rm, _nv034563rm (first 0x350
bytes), _nv041632rm, _nv044827rm, _nv044826rm. [E] is the GPU record
target/rmapi/original-rmapi-gpu.txt (now 11 cases), replayed by rmapi::gpu_tests with no
mask.
8.1 Oracle: original stage bodies in front of the handlers
GpuSequence.stage(name) calls the original stage bodies of one engine class on the constructed
GPU the way the stage wrappers do (GPU not initialized, expanded visibility, GPUs lock held), once
per constructed instance, and requires status 0 from each. Registers a body reads enter the case
with the value the case names, else with their first read in the transcript of 0000:b3:00.0;
writes are recorded, not applied (lines stage, stage-reads, stage-writes). New fixtures:
os_delay_us, os_get_monotonic_tick_resolution_ns, the data symbol os_page_size (0x1000).
| Stage name | Body | Reads | Writes (not applied) |
|---|---|---|---|
objce-preinit |
OBJCE StatePreInitLocked _nv019109rm x9 |
0x200, 0x104414 + 0x80 i | 0x200 (PMC enable with the engine's bit), 0x104414 + 0x80 i = 0xb |
kce-init |
KernelCE StateInitLocked _nv039835rm x9 |
none | none |
objce-init |
OBJCE StateInitUnlocked _nv019107rm x9 |
none | none |
objce-preload |
OBJCE StatePreLoad _nv019113rm x9 |
0x104414 + 0x80 i | 0x104204 = 0x40, 0x104200 = 0xc242 (first engine), 0x104414 + 0x80 i = 0xa |
kce-load |
KernelCE StateLoad _nv039837rm x9 (HAL +0x120) |
0x3080, 0x26a8, 0x2630, 0x104040..0x104060, 0x104034, 0x104038 | 0x2630 = 1, then 0 once per unstubbed engine |
kms-preinit |
KernelMemorySystem StatePreInitLocked _nv041691rm |
0x120074, 0x2243c, 0x1373a0, 0x21c14, 0x21c00, 0x17e27c, 0x12006c, 0x17e000, 0x9a016c, 0x14058c, 0x17e480 | none |
Limits. (1) kce-load of the shim owner logs three assertions of the original (A53d, S1f.a15,
A343, recorded in the stage line): they come from the scheduling pause around the mapping
update, which finds no initialized FIFO; the mapping update itself completes with status 0.
(2) The sweep of this emulation removes KernelNvlink (7.2), so _nv039739rm returns
NOT_SUPPORTED and the mapping update takes its path without an NVLink topology: nothing is
written to the PCE-LCE registers and the stubbed state is derived from the registers as found.
On the traced board the original took the other path (the transcript shows it rewriting
0x104034..0x104060, lines 164830-164842, with the values it had read), so the register values
of the case are the ones the original itself programmed earlier. (3) Stage bodies that did
not run to status 0 in this fixture: MemorySystem InitLocked _nv045882rm (CPU exception
in _nv044284rm after assertions A191, A1af), KernelMemorySystem InitLocked _nv041688rm
(0x1f), MemoryManager InitLocked _nv044120rm (0x1f), KernelGmmu InitLocked _nv040957rm
(needs nv_alloc_pages for the fault buffer), KernelGraphicsManager InitLocked _nv034082rm
(unmapped read), KernelGraphics PostLoad _nv041068rm (0x16: it starts FECS). Bodies that ran
to 0 but are not part of a recorded case: MemoryManager PreInitLocked _nv044123rm, KernelBus
PreInitLocked _nv039599rm, OBJBIF PreInitLocked/InitLocked, KernelBif InitLocked (with an
os_pat_supported fixture), Graphics PreInitLocked/InitLocked, KernelFifo and KernelPerf
InitLocked.
8.2 The engine list 0x20800170 (implemented)
| Step | Finding | Evidence |
|---|---|---|
| Mapping update | KernelCE StateLoad of the shim owner -> _nv039840rm -> internal control 0x20802a0d (_nv057499rm -> _nv057498rm, which needs the OBJCE shim owner byte +0x489 that OBJCE StatePreLoad sets) -> OBJCE HAL +0x2b8 _nv019124rm -> HAL +0x2a8 _nv019120rm |
[E] call trace; [D] |
| Stub rule | LCE i is stubbed when no PCE2LCE_CONFIG word (0x104040 + 4 p, p < 9) has i in bits 3:0; for the graphics copy engines (LCE 0 and 1) only when, in addition, bit 30 of GRCE_CONFIG(i) (0x104034 + 4 i) is clear. Stubbed: OBJCE+0x488 = 1, class records of engine 0x793ceb00 or i deleted, KernelCE+0x24d mirrors it | [A] _nv019120rm; [E] six register variants, peek oce<i> |
| Engine table | _nv031235rm walks 57 static records (RM engine type, class id, instance, valid) and lists each valid one whose descriptor still owns a class record |
[A]; [E] engine-table line read out of .rodata |
| Reply | count, then the NV2080 type of each listed engine (_nv030671rm); words after the list untouched. On the traced board: 15 engines (GR0, COPY0..7, NVDEC0, NVENC0..2, SW, SEC2), equal to one of the three lists of the capture |
[E]; [O] |
| Other statuses | device handle 0x56 (server), GPU not returned by gpumgrGetGpu 0x26 (the handler takes the device lock itself) | [E] |
Rust: rmapi::providers::kernel_ce (CeMapping::stubbed, ENGINE_TABLE, engines),
class_db::Stage::Loaded. Inputs on hardware: the eleven registers above, read-only, once, at
the first open of the GPU's device node, after the two fuse words (node::ATTACH_REGISTERS,
13 offsets; the original reads the same eleven in _nv019120rm). If a word shows the bus
error pattern 0xbadxxxxx the mapping is unknown and the command answers 0x56. Not from a
bring-up level: no level programs these registers, so what is read is whatever the original
driver (or the reset state) left there; the NVLink auto-configuration (_nv039739rm and the
0xd4-byte table records at .data 0xf8f4a0 of the analysis image) is not implemented. The
capture machine's eight GPUs report three different lists (15, 14 and 11 engines), i.e. three
different mappings. Not modelled: the MIG filter _nv041750rm and the substitution
_nv039783rm, which changed nothing in the executed cases.
8.3 What stays unavailable, with what the experiments established
"after X" = the original handler was executed with body X in front of it and its reply compared with the capture; these runs were exploratory and are not in the recorded oracle.
| Command | Finding | Why not implemented |
|---|---|---|
0x20802a0a |
handler _nv057479rm (KernelCE side) issues 0x20802a0b (_nv057481rm -> _nv018962rm): per unstubbed LCE byte 0 = 1 (GRCE, _nv018998rm), 2 (OBJCE HAL +0x2a0 _nv019005rm), 0x60, 0x80 (OBJCE+0x45b); byte 1 from OBJCE HAL +0x278 _nv018882rm, +0x462, HAL +0x2f0; then KernelCE HAL +0x160 _nv039699rm adds NVLink bits. After the CE stages: mask 0xff as captured, caps e301 e301 e003 e003 e201 e201 e003 e003 against the captured e301 e301 e403 e803 f201 f201 f003 f003 [E]+[D] |
the four HAL bodies were not read at instruction level and the differing bits are NVLink-dependent (class iii) |
0x20800102 |
no difference from the capture for the eleven indexes after the sweep [E]; _nv029324rm dispatches per index through _nv060460rm |
the per-index readers were not read |
0x801307 |
no difference after kms-preinit and MemoryManager PreInitLocked; _nv043913rm combines MemoryManager+0x41f, +0x459, +0x470, +0xd02, KernelMemorySystem+0x278, +0x279, +0x288, static configuration +4, +5, _nv043849rm, the chipset and GPU+0xe00 [D] |
the writers of those bytes were not traced; MemoryManager PreInitLocked also writes 0x100e34 and 0x100e48 |
0x20801803 |
no difference after KernelBus PreInitLocked except the BAR2 address of the machine; the handler copies KernelBus+0x50c (count), +0x550 (sizes), +0x510 (offsets) [D]. The BAR1 size reported is 0x8_0000_0000 although the fixture's PCI resource is 0x4_0000_0000, so the size does not come from the resource | _nv039599rm (HAL +0x100, _nv039376rm, _nv039375rm, _nv039334rm; reads 0x8860c, 0x88610, 0x1708, 0x10100c) was not read |
0x20801303 |
after the two memory PreInit bodies indexes 0x17, 0x18, 0x19, 0x1b, 0x22, 0x23 equal the capture; 8 (RAM size), 0xb, 0xd, 0x1a, 0x3b differ; 0x16/9/0x10 fault in _nv035546rm (no heap) |
needs the Init bodies of 8.1 (3), which do not run in this fixture; no request of the workload consists only of matching indexes |
0x20801823 |
after OBJBIF and KernelBif InitLocked indexes 0, 2, 0x10, 0x2c equal the capture and 0xf is the bus number; 0xb (1 against 5), 0x2d (0x200000 against 0x222000) and 6 (0 against 0x17a3903) differ; index 3 differs in the machine-dependent link capability bits. The second request read 0x88088, 0x1373a0, 0x21250, 0x88610, 0x88084 at call time | link state of the Load stage; the per-index readers were not read |
0x2080122a, 0x2080122b, 0x2080121b, 0x20801227, 0x20801218, 0x20801201 |
KernelGraphics answers from one static-information block (assertions A2b7, A2dd, Ad5b without it); it is loaded by KernelGraphics PostLoad _nv041068rm, which read 0x404030, 0x21c1c, 0x22430, 0x21dbc..0x21dd0 and then started FECS (writes 0x409044, 0x409840, 0x409a20) and returned 0x16 |
the masks cannot be separated from the FECS-dependent load in the original; class (iii) until FECS runs |
0x20803801 |
11 bytes differ after the CE stages; KernelGraphicsManager InitLocked faults | (iii) with the above |
0x20800110, 0x20800111 |
0x40 after the sweep (_nv030641rm, _nv030699rm -> _nv019378rm) |
VBIOS and board identification, not attempted |
0x2080014a, 0x20800195 |
0x31 after the sweep (_nv030562rm, _nv030397rm) |
PMU identity |
0x2080012f, 0x20803002, 0x13a, 0x2080200a, 0x801909 |
as in 7.5 | (iii) |
8.4 Corrections
status::ILLEGAL_ACTIONwas 0x17 in this module; 0x17 isNV_ERR_IN_USEand 0x16 isNV_ERR_ILLEGAL_ACTION(nvstatuscodes.h). The constant returned byNV_ESC_REGISTER_FDkeeps its value under the nameIN_USE.- 7.5 called the engine-list producer "KernelCE InitLocked". InitLocked (
_nv039835rm) only registers a callback and touches no register; the update is in StateLoad (HAL +0x120_nv039837rm) and needs OBJCE StatePreLoad before it.
9. Slice 4 (2026-11-19): VA spaces
Same caveats as section 8. Code: rmapi::vaspace, the VaSpace and ThirdPartyP2p kinds of
rmapi::gpu, dependant invalidation in rmapi::server. Cases gpu-vaspace (constructor
matrix, controls, P2P) and gpu-vaspace-dependants; both run the sweep and kms-preinit
first. The oracle asserts that no 0x90f1 allocation and no control of this section reads or
writes a register.
9.1 Classes
| Class | Identity | Constructor | Parameters | Controls the workload issues |
|---|---|---|---|---|
0x90f1 FERMI_VASPACE_A |
VaSpaceApi (0xcd048b), parents Device and Subdevice, multi-instance, 56 bytes required, RS flags 0x2122 (no GPUs lock on alloc; the constructor takes it itself) | _nv059869rm -> _nv060601rm (vmmCreateVaspace) -> _nv059856rm -> _nv034563rm (gvaspaceConstruct_) |
NV_VASPACE_ALLOCATION_PARAMETERS: index, flags, vaSize, vaStartInternal, vaLimitInternal, bigPageSize, vaBase, pasid |
none on the object itself; UVM reaches it through rm_gpu_ops (9.4) |
0x503c NV50_THIRD_PARTY_P2P |
ThirdPartyP2P (0x34d08b), parent Subdevice, single instance per subdevice | _nv059452rm |
flags, type in bits 1:0 | 0x503c0102, later 0x503c0104/0x503c0105 |
0x50a0 NV50_MEMORY_VIRTUAL |
VirtualMemory, parent Device, 128 bytes required | _nv060585rm |
NV_MEMORY_ALLOCATION_PARAMS (flags 0x8c415, size 0xfb000000, offset 0x5000000, hVASpace = the RM-managed space) |
none |
0x50a0 is not implemented. Executed once, exploratorily: with the workload's parameters in
the RM-managed space the original's reply equals the capture (attr 0x16000000, attr2 0x100005,
rangeLo 0x5000000, rangeHi 0xffffffff, alignment 0x200000, offset 0x5000000, limit
0xfaffffff); a second identical request
is 0x1a; the same request in the externally owned space is 0x1a; hVASpace 0 is 0x40 (device of
VA mode 2); an unknown handle 0x57; a subdevice parent 0x36. _nv060585rm and the VA heap it
uses were not read; it belongs with the memory slice (9.6).
9.2 The constructor of 0x90f1 (all [E]; structure [S] vaspace_api.c, gpu_vaspace.c; [A] for the flag tests at the head of _nv034563rm)
Order of checks for a caller without kernel privilege (an administrator gets the same results):
| Rule | Result |
|---|---|
| no parameter block | 0x1f (server) |
| flags 0x10 or 0x4000; 0x40 without 0x8; 0x20 together with 0x8 | 0x1f |
| index 1 (BAR1 space) | 0x1f |
| device of VA mode 1 (single address space) | 0x40 |
| index 2, or 5 and above | 0x40 |
| index 3 | the device's own space: 0x40 on a device of VA mode 2 (none exists); on a device of mode 0 a reference to it, reported as base 0x100000 and size 0x1fffffff00000 whatever the other fields say |
| index 4 (FLA) | 0x56 |
| bigPageSize other than 0, 0x10000, 0x20000 | 0x1f |
| vaSize != 0: limit = vaBase + vaSize - 1; wrapped | 0x1f |
| flag 0x20 (mirrored) alone | 0x16 (needs the version 1 format) |
| limit 0 (also from vaSize 1 with vaBase 0) | the whole space: limit 2^49 - 1 |
| limit above 2^49 - 1 | 0x1f |
| start = vaBase, or 0x100000 when vaBase is 0 and flag 0x100 (allow zero) is clear; start above the limit | 0x1f |
| success | vaBase = start, vaSize = limit - start + 1; no other byte of the block changes; flag bits 0x8000 and above are ignored; vaStartInternal/vaLimitInternal are ignored without flag 0x80 |
The workload's two spaces: flags 0x48 with base 0x1000 gives size 0x1fffffffff000; flags 0 with
base 0x5000000 gives 0x1fffffb000000; both equal the capture (32 allocations replayed). The
constructor sets GVAS+0xf4 (mirrored), +0xf5 (fault capable) and +0xf6 (externally owned) from
internal flag bits 0x20000, 0x20000000 and 0x40000000 [A]; that allocation flags 0x20, 0x40 and
0x8 map to them is [S] translateAllocFlagsToVASpaceFlags. Not established
and answered 0x56 by the Rust constructor: vaSize together with flag 0x4 or 0x80. Devices of VA
mode 0 and 1 are constructed with a default space once kms-preinit has run; a device made with
VA flags or sizes answers 0x56 for index 3 and for 0x801806 with handle 0 here.
9.3 Controls and the P2P object
| Request | Rule | Evidence |
|---|---|---|
0x801806 DMA_ADV_SCHED_GET_VA_CAPS (Device, 192 bytes, _nv022155rm -> _nv034588rm) |
hVASpace (+164): 0 = the device's space (0x40 on VA mode 2); unknown 0x57; a handle of another class 0x33; a space of another device of the client is accepted. Reply: vaBitCount 49, pdeCoverageBitCount 21, one small-page format, bigPageSize and idealVRAMPageSize = the space's big page size, compressionPageSize 0x10000, dualPageTableSupported 1, big table {0x100 bytes (0x80 for 128 KiB), 0x200000}, small table {0x1000, 0x200000}, vaRangeLo = start, vaSpaceId 0, supportedPageSizeMask 0x211000 (0x221000). Bytes 44..164 and 180..184 untouched | [E] 17 requests; compressionPageSize = 1 << MemorySystem HAL +0xed8 [A] |
0x503c constructor |
type 1 (BAR1) succeeds; 0 and no block 0x56; 2 (NVLink) 0x40; 3 0x1f; a second object under the subdevice 0x63 (server); a device parent 0x36 | [E], [D], [S] |
0x503c0102 REGISTER_VA_SPACE |
the handle is not validated (0 and unknown values register); a handle already registered 0x19; the token (u64 at +8) is the first value of 0xfe00..0xff00 that is not a registered handle, so 0xfe00 unless the handles 0xfe00.. are registered; bytes 4..8 untouched. A handle that names a resource of the client at that moment makes the P2P object a dependant of it | [E], [S] CliAddThirdPartyP2PVASpace |
0x503c0103 UNREGISTER_VA_SPACE |
0x57 when not registered; the dependency is not removed | [E] |
| Privileged commands | 0x801813 SET_PAGE_DIRECTORY and 0x801814 UNSET_PAGE_DIRECTORY answer 0x1b for a non-administrator before the handler; 0x90f10107 0x1b also for an administrator (kernel only); 0x90f10108 0x56 |
[E] exploratory; no body here, the server does not model control privilege |
9.4 What RM does for the externally owned space (the channel address space)
- At allocation: CPU-side only (9.2). No page directory, no page table, no register access; the VA heap is created but nothing is allocated from it by the workload.
- Big-page and format queries:
0x801806(9.3).0x90f10101/0x90f10102are not issued. - Page-directory registration is kernel-only: UVM calls
rm_gpu_ops_dup_address_space_nv046800rmandrm_gpu_ops_set_page_directory_nv046861rm; the same commit routinegvaspaceExternalRootDirCommit_nv034568rmis behind0x801813. Executed once with an administrator caller and arbitrary values it returned 0x1f at assertion 0xc53 without touching a register;0x801814->_nv034570rmreturned 0 with nothing committed. Their bodies were not read. [S]: commit records the directory and rewrites the page-directory words of every instance block bound to the space; that is wherevaspace::PageDirectorystops (needs instance-block access, level 4, and for bound channels a FIFO, level 6). The UVM dossier (uvm.md, read after this slice was written; its statements are [D] and [S]) adds what the kernel path passes:DupAddressSpacerefuses a space that is not externally owned, andSetPageDirectoryissues0x801813with 0x20 bytes, 4 entries, flags(vidmem ? 0 : 1) | 8(all channels), subDeviceId = instance + 1, and answers 0x56 when a directory is already set. The exploratory call above used 2 entries and flags 0, so its 0x1f says nothing about that request. Whether the commit of an externally owned space with no channel bound is software-only is open in both documents. This slice provides what that dossier lists for the address space itself (class 0x90f1 with the externally-owned flag,0x801806with bigPageSize 0x10000); it does not provide0x801813, therm_gpu_opsentries,GetExternalAllocPtesorBindChannelResources(control0x2080012b). - PTE writes for RM memory mapped into the space (
rm_gpu_ops_get_external_alloc_ptes) and context-buffer mappings (bind_channel_resources) belong to the UVM and channel slices.
9.5 Server-side rules
| Rule | Finding | Evidence |
|---|---|---|
| Parents, duplicates | 0x90f1 under Device or Subdevice, any number; 0x503c one per subdevice | [E] |
| Dependants | when a resource is freed, every resource registered as its dependant is first invalidated: its destructor runs (one _nv019537rm call, before the freed resource's), its handle stays assigned, controls on it answer 0x6e (RESOURCE_LOST), the single-instance rule still counts it (0x63), and a later free of it runs _nv019537rm again |
[E] both cases |
| Free ordering with channels | not executable here (no channel class). Statically: 0xa06c and 0xc36f have freePriority 1 and are moved in front of everything else of the client (2.2), so a client free destroys channels and groups before the VA spaces they are bound to; whether a VA space freed explicitly while a channel group references it is refused or invalidates the group was not established |
[A dossier] table; open |
Deviations of the Rust code: fixed tables (32 spaces, 8 P2P objects, 12 registrations and 12 dependencies per P2P object; INSUFFICIENT_RESOURCES or NO_MEMORY when full); only the dependant itself is invalidated, not a subtree (the one dependant class has no children).
9.6 Requirements of the memory slice
| Item | What is known | What it needs |
|---|---|---|
0x0040 NV01_MEMORY_LOCAL_USER (VideoMemory, _nv060578rm) |
parameters and replies of the workload in dossier 2.5 (flags 0x1c101, attr 0x18000000, alignment 0x200000, 2 MiB to 250 MiB; returns attr 0x11800000, attr2 0x100005 and a heap offset) | a framebuffer heap with the original's user-visible policy. mmu/placement.rs models heapAlloc _nv035538rm only for the internal top-down requests of first open (highest free range that fits). The client path (_nv060574rm -> _nv014072rm -> _nv043803rm, page size _nv043861rm, alignment MemoryManager+0x1c8, and PMA when memmgrIsPmaInitialized) has no oracle: MemoryManager InitLocked does not run in the RM API fixture (8.1), so either that fixture gains the heap the placement harness builds, or the placement harness gains the client entry |
0x003e NV01_MEMORY_SYSTEM (SystemMemory, _nv058782rm) and 0x0071 (OsDescMemory, through NV_ESC_RM_ALLOC_MEMORY) |
flags and attributes in dossier 2.5; 0x71 pins user pages | nv_alloc_pages/nv_free_pages and user-page pinning in the adapter, DMA mapping of the pages (dma_adapter exists), mmap contexts on the control node |
0x50a0 |
9.1 | the VA heap of an RM-managed space (gvaspaceAlloc, eheap) with the fixed-offset request the workload makes; no hardware |
| BAR1 CPU mapping of 0x40 | RM_MAP_MEMORY returns BAR1 address 0x387000400000-style offsets, then RM_UPDATE_DEVICE_MAPPING_INFO |
the BAR1 address space of KernelBus InitLocked (instance block bound through 0x1704, page tables in framebuffer memory): not implemented, only BAR2 is (level 4). A new bring-up level after level 4, in front of the FIFO load (USERD base 0x2254 points into BAR1) |
0x503c0104/0x503c0105 |
handlers _nv059456rm/_nv059458rm |
a video memory object to register |
0xd01 |
asked for every mapped object | the address-space type of 0xc361, 0x90e6, 0x40, 0x3e objects |
9.7 Validation of slices 3c and 4
reports/rmapi-slice4-validation.json has the numbers and hashes. GPU record: 11 cases, 439
allocations, 260 frees, 307 controls, 10 descriptor registrations, 217 peeked words, 17 class and
engine tables, 32 stage-body groups, no mask. Capture replay: 903 requests (823 before), same
single mask; new are 32 x 0x90f1, 16 x 0x503c, 16 x 0x503c0102 and 16 x 0x20800170, the last
with a PCE-LCE image rebuilt from each GPU's own captured 0x20802a0a engine mask (an input
taken from the capture). Guest test: 335 assertions per module load (313 before).
10. Slice 5 (2026-11-20): memory objects
Nothing in this section was run against libcuda, a CUDA program, any node of the original
driver or a GPU. Code: rmapi::memory (new), the memory kinds of rmapi::gpu, the escapes
0x27, 0x4e, 0x4f, 0x5e and the control 0xd01 in rmapi::node, a change of the dependant rule
in rmapi::server. [E] here is a third record, target/rmapi/original-rmapi-memory.txt
(tools/check_rmapi_memory_binary.py), replayed by rmapi::memory_tests with no mask. Three
study files written for this slice by subagents carry the public-source and reading detail:
rmapi-memory-constructor-spec.md (decision spec of the four constructors, [S]),
rmapi-memory-mapping-notes.md (mapping escapes, the open layer's mmap rules, BAR1; [S], [T],
with [A] for _nv054155rm, _nv054198rm, _nv019591rm, _nv039293rm, _nv039290rm) and
rmapi-channel-slice-requirements.md (10.9).
10.1 Oracle: the original's own heap and allocator on the constructed GPU
Decision (task question "fixture or placement harness"): the RM API fixture was extended. A
client request needs the resource server, a client, a device and the constructed
MemoryManager, which only that fixture has; the placement harness builds its objects from
binders and has no resource server. Section 8.1 (3) said the memory Init bodies do not run in
the fixture; that was wrong for two reasons found here: MemorySystem PreInitLocked has to be
called through its HAL body _nv045895rm (the wrapper _nv003981rm takes other arguments),
and the bodies need four operating-system fixtures (page allocation, kernel mapping, the NUMA
memory configuration query, the page-mask data symbols). With those, each of these runs to
status 0 on the GPU the attach built, in first-open order:
| Body | What it leaves | Registers read (transcript of b3) |
|---|---|---|
MemorySystem PreInitLocked _nv045895rm |
region table [0, 0x7ffffffff], comptag geometry |
0x12006c, 0x100ce0, 0x1373a0, 0x2167c, 0x21c18, 0x9a0590, 0x118fb0, 0x409660, 0x9a0470, 0x9a050c, 0x21228, 0x17e3f4, 0x100b18, 0x100b14 |
MemoryManager PreInitLocked _nv044123rm |
reserved size 0x57000 | 0x100a0c, 0x100e34, 0x100e48, 0x2008, 0x104028 |
KernelBus PreInitLocked _nv039599rm |
aperture sizes | 0x8860c, 0x88610, 0x1708, 0x10100c |
MemorySystem InitUnlocked _nv045883rm, InitLocked _nv045882rm |
comptag store size | (list in the record's stage-reads line) |
KernelMemorySystem InitLocked _nv041688rm |
one zeroed uncached system page, its address >> 8 written to 0x100c10 (not applied) | 0x100c10 |
MemoryManager InitLocked _nv044120rm |
reserved base 0x7fffa0000 (size 0x60000), PMA initialized (MemoryManager+0x41c), heap at +0x468 with the PMA object at heap+0x128, three framebuffer regions | 0x2008, 0x104028, 0x100b20, 0x100b14, 0x100b18, 0x100b24 |
Resulting regions [E]: [0, 0x7eef5ffff] (the allocator's), [0x7eef60000, 0x7fff9ffff]
(internal heap, 0x11040000 bytes), [0x7fffa0000, 0x7ffffffff] (reserved). The internal heap
size is the product of _nv043815rm with the real engine objects of the constructed GPU; the
placement harness had 0x6600000 with zero cross-object terms (memory.md).
Fixture decisions that bound every [E] claim of this section:
- Scrub-on-free is switched off in the allocator object (pPma+0x298 cleared after heap creation). With it on, the original answers a client video memory request 0x40 (INVALID_STATE, "PMA object is not valid") until the copy-engine scrubber has registered, which needs a running FIFO [E]. Consequence: in the record freed frames are reusable at once; on hardware they pass through a scrub on a kernel copy-engine channel first.
- Page allocations get fabricated physical addresses (0x100000000 + 0x10000000 n).
- No BAR1 address space (KernelBus InitLocked and PostLoad do not run): a CPU mapping of video memory answers NO_MEMORY in the record. No page-level pools: a virtual reservation that is not lazy answers INSUFFICIENT_RESOURCES.
os_page_maskandos_page_shiftare set after the attach; a device file registers the control file (NV_ESC_REGISTER_FD) beforeNV_ESC_RM_ALLOC_MEMORY, as libcuda does (without it the request answers 0x23).- Registers 0x70010 and 0x70004 are not in the transcript; they read 0 (idle).
Executed original against captured original. The case mem-workload issues the 243
memory requests of the capture's last device in order (tools/rmapi_memory_workload.json,
extracted by tools/extract_rmapi_memory_workload.py), after two 2 MiB allocations that stand
for the 4 MiB the allocator had already handed out in the capture (UVM registers the GPU
first). The tool compares the emulated replies with the captured ones: all 58 allocations are
byte-identical including every allocator offset, as are 42 controls, 59 frees, 5 user-page
registrations and 38 system-memory mappings with their unmaps (statuses and flags; the
addresses are host physical addresses). The three differences are the one BAR1 mapping, its
update and its unmap (fixture decision 3).
10.2 The heap policy for client requests
| Question | Finding | Evidence |
|---|---|---|
| Which allocator | Not the framebuffer heap. vidmemConstruct _nv060578rm calls pmaAllocatePages _nv051433rm (+0xef9) before memmgrAllocResources _nv043803rm (+0x13d5) and vidmemAllocResources _nv060574rm (+0x1405), which then only describes the frames it was given. The heap _nv035538rm that mmu/placement.rs models serves RM-internal requests; a client request reaches it only when it is not allocator-owned, and with scrub-on-free enabled the original refuses those (0x40) |
[A] call order (capstone on the relocated object); [E] |
| Region boundary | the allocator owns framebuffer region 0, [0, internal heap base); the internal heap and the reserved region above it are never handed to clients |
[E] regions line; [S] memmgrPmaRegisterRegions |
| Direction | bottom-up first fit over 64 KiB frames at a multiple of the alignment (absolute address); top-down with FORCE_REVERSE_ALLOC (0x800); FORCE_MEM_GROWS_DOWN/UP have no effect | [E] 420 mixed requests and releases, region boundaries; [S] pmaRegmapScanContiguous |
| Page size | the request's PAGE_SIZE attribute, else 2 MiB from 2 MiB up and 64 KiB below (any size: a client request never gets 4 KiB by default); an explicit 4 KiB request still takes 64 KiB frames | [E]; [S] memmgrDeterminePageSize client leg |
| Size and alignment | size rounded up to the page (never to the alignment); alignment = the request's (only with HINT or FORCE) when it is a multiple or divisor of the page, else the page, or 0x1f with FORCE; the allocator then needs a power of two (0x1f); with COMPR (attr 13:12) at least 64 KiB | [A] _nv043790rm (REA), _nv051433rm+0x272; [E] |
| Attribute parsing | LOCATION must be VIDMEM and VIRTUAL clear (0x1f); PHYSICALITY becomes CONTIGUOUS; PAGE_SIZE and attr2 PAGE_SIZE_HUGE are written back; GPU_CACHEABLE default becomes YES; ZBC becomes PREFER_NO_ZBC unless attr2 bit 17; flags gain 0x8000 and lose 0x2000000; address and zcullCovg are cleared; format becomes 0 (0xfe with attr bit 17) |
[E] one field at a time (466 requests) |
| Compression, zcull | COMPR bits are cleared in the reply (nothing is allocated for them); ZCULL REQUIRED/SHARED (attr bit 10) is 0x1f, ANY is accepted and ignored; depth type (1) is 0x1f without a depth format | [E] |
| Owner, type, tag | owner 0, 0xffffffff and 0xdeaf0000..3 are 0x39; any other value is accepted and returned (not checked against the client); type above 17 is 0x1f (after the frames were taken and given back); types 3, 5, 8 set attr2 bit 18; tag is not interpreted | [E] |
| Refused | internalflags, attr2 bits 6 (0x1f), 19 (0x1b), 27 (0x1f), 29/30 (0x1f), 25 (0x1f), 9 (0x56), 10 (0x40); flags LAZY, EXTERNALLY_MANAGED, SPARSE, PREFER_PTES (0x1f), TURBO_CIPHER (0x1f), WPR1/WPR2 (0x40), PROTECTED (0x51: no protected region), hVASpace (0x1f), a range without USE_BEGIN_END (0x1f) | [E] |
| Ranges | USE_BEGIN_END: [ALIGN_UP(lo, page), ALIGN_DOWN(hi, page) - 1], which must be non-empty and end on a page boundary (0x1f); FIXED: the frames covering [offset, offset + size) rounded to max(alignment, page), reply size minus offset % alignment |
[E] |
| Reply | offset = first frame, size = rounded size, limit = size - 1, alignment as above; on failure the block is returned unchanged | [E] |
| Free | frames return to the allocator at once in the record (see fixture decision 1); neighbours need no coalescing in a frame map; no register is touched | [E] |
| Exhaustion | a contiguous request that does not fit is 0x51; with ALLOW_NONCONTIGUOUS (the workload's 0x18000000) the original retries non-contiguously | [E] for 0x51; [S] for the retry |
Not established, answered 0x56 by memory::video: an explicitly non-contiguous request and
the non-contiguous retry when it would succeed (the page list is not visible in a reply; the
retry's failures, 0x1f for an alignment above the page and 0x51 when the free pages do not add
up, are modelled); requests for a GPU without a known allocator region. Eviction (client
video memory is pinned and never evicted [S]) and blacklisted pages are not modelled.
Where the region comes from on hardware. GpuFacts.video must be set to region 0 of the
original's table: [0, reserved base - internal heap size). mmu/placement.rs computes the
reserved base and has the internal-heap formula (_nv043815rm) with its cross-object terms as
inputs; the terms of a real GV100 gave 0x11040000 here. Nothing sets the field in the kernel
yet, so 0x40 answers 0x56 on the node. A second producer is needed before real use: whoever
else takes allocator frames (UVM's page-tree chunks, the page-level pools, the scrubber's
buffers) must be entered in the same table, as the capture's 4 MiB show.
10.3 System memory (0x3e) and user pages (0x71)
| Item | Finding | Evidence |
|---|---|---|
| Checks | the common prologue (10.2 owner, internalflags, ranges); LOCATION VIDMEM or VIRTUAL 0x1f; type above 17, depth type, ZCULL as for video; flags FIXED and the virtual-only ones 0x1f; attr2 bit 6 0x1f; hVASpace 0x1f; COMPR REQUIRED 0x56 | [E] 195 requests |
| What is allocated | nv_alloc_pages(count of 4 KiB pages, granule, contiguous, cache type, zeroed 1, unencrypted 0, node): granule 0x1000, or 0x10000 / 0x200000 for an explicit BIG / HUGE page attribute (size then rounded to it); contiguous only for PHYSICALITY CONTIGUOUS; cache type 0 cached (COHERENCY 1, 3, 4, 5, 6, 7), 1 uncached (0), 2 write-combined (2); node -1, or the request's numaNode with attr2 bit 7 |
[E] every call compared |
| DMA | nothing at allocation: no DMA mapping call, no DMA mask query (the device's addressing was set at attach). The IOMMU mapping of the public source happens for user pages (10.3 last row) and at GPU mapping time | [E] absence of calls; [S] |
| Reply | LOCATION PCI (value 2 stays as sent); PHYSICALITY 2 or 1; PAGE_SIZE 4KB unless requested; GPU_CACHEABLE default becomes NO; alignment max(valid request, page); offset 0; limit size - 1 | [E] |
| Notifier (type 13) | a kernel mapping of the whole object is made at once (nv_alloc_kernel_mapping); the channel code writes notifications through it |
[E] |
| After the allocation | attr2 bit 16 (display) 0x40 and attr2 9:8 = 2 (SMMU) 0x56: the pages are allocated and given back | [E] |
| PROTECTED flag | the attributes are derived as for framebuffer memory (LOCATION VIDMEM, 64 KiB page, cacheable) while system pages are allocated | [E]; [S] calls it an oddity |
| Free | nv_free_kernel_mapping (notifier), then, for GPU-cacheable memory (attr2 bit 2), three register operations: 0x70000, 0x70010 and 0x70004 are each written 1 and polled, then nv_free_pages |
[E] |
| User pages (0x27, class 0x71) | on a device node whose file registered the control file; NVOS02 flags: LOCATION must be 0 and MAPPING 1 (0x29), COHERENCY 0, 1 or 5 (0x29), unaligned address 0x56, limit of all ones 0x2e; then os_lock_user_pages(address, 1 + limit / 4096, writable unless bit 21); INVALID_ADDRESS from it leads to os_lookup_user_io_memory; then the resource server (0x19, 0x36, 0x57, 0x23); a zero limit 0x3a; uncached or contiguous 0x29; nv_register_user_pages (unencrypted with flags 26:25 = 2); on any failure after the pinning os_unlock_user_pages. Only the status is returned (a generated handle is not). Free: unregister, then unlock |
[E] 73 requests |
The I/O-memory branch (a user mapping of device memory, after a successful
os_lookup_user_io_memory) is not implemented (0x56). The original also IOMMU-maps registered
user pages for the GPU inside osCreateOsDescriptorFromPageArray [S]; the fixture's device has
no IOMMU address space, so no call shows in the record: on hardware this is a requirement of
the kernel side.
10.4 Virtual memory (0x50a0) and the address heap of an RM-managed space
| Rule | Result | Evidence |
|---|---|---|
| VIRTUAL flag missing | 0x1f | [E] |
| hVASpace 0 on a device of VA mode 2 | 0x40 (mode 0/1 device spaces: not established, 0x56 here) | [E] |
| hVASpace unknown / not an address space | 0x57 / 0x33 | [E] |
| externally owned space (the channel space) | 0x1a | [E] |
| flag 0x8000000 (kernel privileged) | 0x1b | [E] |
| size, alignment | 10.2 rules with the virtual page size; then size rounded to the largest page of the request (64 KiB for a default request below 2 MiB) and, without ALIGNMENT_FORCE, alignment at least that page and 64 KiB | [E] |
| range | FIXED: exactly [offset, offset + size - 1] after the offset is rounded down to the alignment; else the whole space, with its lower end raised to 4 GiB when more than 4 GiB would remain (the workload's reply rangeLo 0x100000000 for non-fixed requests); USE_BEGIN_END: as sent |
[E] |
| placement | lowest fitting multiple of the alignment in ascending free blocks; with FORCE_MEM_GROWS_DOWN (flag 4, the workload's) the highest in descending ones; any failure 0x1a | [E] 205 requests incl. a bounded space filled up |
| reply | attr LOCATION ANY, CONTIGUOUS, PAGE_SIZE as sent (0 for a default request), attr2 as 10.2; rangeLo/rangeHi; alignment; offset; limit | [E] |
| range smaller than the size (USE_BEGIN_END) | status 0 with no range allocated: the original drops the failure of vaspaceFillAllocParams (assertion A89 in the record). The object exists; the reply shows offset 0 |
[E]; [S] and the closed pseudocode agree |
| not lazy (flag 0x400 clear) and not externally managed | page-table memory is reserved for the range after it is taken from the heap; when that fails the request answers 0x1a and the range stays allocated until the space is destroyed (the original does not free the heap block) | [E] in a fixture without page-level pools; [S] notes the missing free |
| freeing the space | its reservations are destroyed first, highest handle first (observed with generated handles) | [E] |
The workload's request (flags 0x8c415: fixed, lazy, grows down; size 0xfb000000 at 0x5000000 in the space created with base 0x5000000) is reproduced with the reply of the capture; no page table is touched for it.
10.5 Mapping escapes
| Request | Rule | Evidence |
|---|---|---|
NV_ESC_RM_MAP_MEMORY checks |
client of another file 0x23; unknown memory or device handle 0x57; device handle that is the client or not a device/subdevice 0x36; a device as memory 0x36; virtual memory, user pages, an address space 0x56; flags: access 3, bits 4, 14, 22 are 0x29, bit 8 is 0x1b, mapping kind REFLECTED alone 0x56 (each observed alone; combinations not established); offset at or past the end 0x20; empty or over-long range 0x2e | [E] 130 requests |
| reply flags | caching type forced to 6 by the dispatcher; kind DIRECT (0x8000) on success for system memory | [E] |
| address | nv_alloc_user_mapping(pages, offset / 4096, offset % 4096, length, protection 3 / 1 / 2 by access): in the open layer the physical address of the page plus the offset, not a kernel cookie |
[E]; [S] |
| context | os_match_mmap_offset(page-aligned address), then nv_add_mapping_context_to_file(control state, {address, length, offset rounded down, area = whole pages covered, caching 6}, protection 3, pages, page index, fd). RM does not look at the descriptor; the open layer does. A failure there is the request's status, after nv_free_user_mapping; the address stays in the reply |
[E] |
| records | one per request; several mappings of one object may share an address; NV_ESC_RM_UNMAP_MEMORY removes the first with that object and address (else 0x57) and calls nv_free_user_mapping; its device handle and flags are not examined |
[E] |
NV_ESC_RM_UPDATE_DEVICE_MAPPING_INFO |
renames the first mapping of the object at the old address (0x57 if none); the device handle may be the device or a subdevice, the client is 0x33 | [E] 11 requests on system memory; the workload uses it on the BAR1 mapping only |
| object or client freed while mapped | each remaining mapping gets nv_free_user_mapping, then the pages are released |
[E] |
| 0xd01 | 1 system memory and user pages, 2 video memory; virtual memory 0x1f; device, subdevice, address space 0x56; the client 0x31; unknown 0x57; the block is untouched on failure | [E]; [A] _nv019591rm (mapping notes) |
| 0x503c0104 / 0x503c0105 | registration of a video memory object with the P2P object: only the workload's form is established (status 0, block unchanged; unregister of an unregistered handle 0x57) | [E] workload case only |
| video memory | reaches OsMemory::map_video; the reply flags of a BAR1 mapping (REFLECTED, caching 2: 0x010d0000 for the workload's 0xc0000) are from the capture and the public source |
[O], [S] |
What the open layer then enforces at mmap (offset 0, one context per file for its lifetime
with status 0x63 for a second, page_index + pages <= num_pages on the control node, exact
length on a device node, vm_insert_page against remap_pfn_range) is public source and is in
rmapi-memory-mapping-notes.md sections 2 and 3; it is the kernel adapter's part (10.8).
10.6 Server-side rules found here
- A dependant that is itself on the pending-free list of the request (a client free) is freed
for good when the resource it depends on goes; one that is not (a free of the address space
alone) is invalidated and keeps its handle, and its destructor runs again when it is freed
[E].
Server::destroy_listednow makes that distinction; the slice 4 record (P2P dependants) is still reproduced. NV_ESC_RM_ALLOC_MEMORYgoes through the resource server with the caller's file; a generated handle is not written back.
10.7 Provider trait rmapi::memory::OsMemory: what is behind it and what each needs
| Method | Original | Kernel wiring it needs | Hardware |
|---|---|---|---|
alloc_pages, free_pages |
nv_alloc_pages, nv_free_pages |
page allocation with the cache attribute (set_memory_wc/uc for types 1 and 2), contiguous and 64 KiB / 2 MiB granules | none |
kernel_map, kernel_unmap |
nv_alloc_kernel_mapping |
a kernel virtual mapping of the pages (notifiers; later the channel code writes through it) | none |
user_map, match_offset, add_context, user_unmap |
nv_alloc_user_mapping, os_match_mmap_offset, nv_add_mapping_context_to_file, nv_free_user_mapping |
per-file mapping context and the mmap handler of the control node |
none |
lock_user_pages, unlock_user_pages, register_user_pages, unregister_user_pages, lookup_user_io |
os_lock_user_pages etc. |
pin_user_pages, and the IOMMU mapping of the pages for the GPU |
DMA mapping (existing dma_adapter) once the GPU maps them |
flush_gpu_cache |
three cache operations on release of GPU-cacheable system memory | BAR0 writes 0x70000, 0x70010, 0x70004 = 1, each polled to idle | BAR0, on a GPU whose memory system is initialized (after the Load stage) |
reserve_page_tables |
mmuWalkReserveEntries for a reservation that is not lazy |
the page-level pools (framebuffer memory from the allocator) and the page-table writer of an RM-managed space | BAR2 (level 4) and an instance block for the space |
map_video, unmap_video |
kbusMapFbAperture and its unmap |
a BAR1 level (below) and the device node's mmap of BAR1 with write-combining |
BAR1 |
BAR1 level (requirement for the bring-up owner; details and trace lines in
rmapi-memory-mapping-notes.md 5.1-5.5). After the BAR2 level and before the FIFO load
(USERD base 0x2254 points into BAR1): (1) three 4 KiB pages from the internal heap for the top
three directory levels (on b3 the root is 0x7fdf77000), zeroed through BAR2; PD3[0] and PD2[0]
linked, 64 PD1 entries sparse for a 32 GiB aperture; (2) TLB invalidate (0x100cb8, 0x100cec,
0x100cbc = 0x80000005, bracketed by reads of 0x100c80); (3) instance block at the reserved
base (0x7fffa0000 on b3): +0x208 = 0xffffffff, +0x20c = limit >> 32 (7), +0x204 = PDB >> 32,
+0x200 = PDB low | 0xc00 (0xfdf77c00); (4) flush 0x70000; (5) bind 0x1704 = 0x80000000 |
(instance block >> 12) = 0x807fffa0, poll 0x1710 & 3 == 0. VA layout: [0, 0x80000) the P2P
mailbox reservation, kernel channel USERDs from 0x80000 with 64 KiB entries, the preallocated
USERD top-down at 0x7ffdf0000 with 4 KiB entries, client objects bottom-up at 2 MiB alignment
with a 2 MiB PD0 entry. A client mapping returns PCI BAR1 base + VA; the mmap context is the
BAR range with caching 2 and an access window of one page. Open there: the PDE/PTE values of
BAR1 are not in the transcript (they are rep movsb data), the register sequence of an unmap
was not extracted, and whether unload rewrites 0x1704.
10.8 Kernel exposure
See 10.10 (written when the kernel side was finished).
10.9 Requirements of the channel slice
rmapi-channel-slice-requirements.md has the tables (parameters with captured values per
class, constructor chains, controls, ordering, a ten-step split C1..C10 each with its oracle).
The requirements that change what earlier documents assumed:
- 0x9067 needs a page directory first: in the externally owned space the context share
fails 0x40 unless a directory is registered, so
UVM_REGISTER_GPU_VASPACE(SetPageDirectory, control 0x801813) precedes it [A_nv040055rm]. - 0xa06c0101 needs UVM's bind: scheduling answers 0x40 while any GR channel of the group
is not context-bound (
KernelChannel+0x28e), which onlybind_channel_resourcessets [A_nv040005rm,_nv039890rm]. - 0xc36f0108 writes the error notifier: it returns the channel id and writes the second
notification record (bytes 0x10..0x1f) of the channel's 0x3e notifier, so the kernel
mapping of notifiers (10.3) is needed during context creation [A tail call in
_nv039941rm; writer body [D]]. - Channel parameters: flags 0, hVASpace 0, 1,024 entries, GPFIFO at GPU VA 0x200400000 +
0x3000 n, USERD at offset 0x2000 + 0x3000 n of the one 2 MiB 0x40 object; compute channels
carry the context share, copy groups carry the address space on the group; +0x84 is a
system-wide
cidcounter [A_nv039920rm]. - Channel ids: lowest free, in blocks of 8 per (domain, pid, subpid) [S]; the capture's 0x10..0x2f means kernel channels held 0..0xf, so the first user token is not a constant.
- Runlist: on GV100 the first engine object fixes the runlist of the channel and its group.
- Hardware at allocation: the constructor writes the instance block and RAMFC through BAR2 and clears 512 bytes of USERD in client video memory; no BAR0 write until the schedule. The client reaches GP_PUT through its own BAR1 mapping (no kernel BAR1 mapping of client USERD), so the BAR1 level of 10.7 is on the workload's critical path.
- From this slice the channel code needs: the physical address and size of a 0x40 object
(
memory::Backing::Video), the kernel mapping of a notifier (Backing::Systemwithkernel_mapped), and lifetime rules (the notifier is a resource dependency; USERD is held by a descriptor reference, with a deferred free in the public source, unchecked in the closed object). - Events:
ALLOC_OS_EVENTkeyed by (client, fd), 0x1a for a duplicate and 0x28 for a missing free; class 0x79 writes backhSrcResource; all 11 events are dataless; delivery is not needed fornative-hello. - Open: whether the golden context is created at the 0xc3c0 allocation or at UVM's first bind in an externally owned space (the public source points to the bind, the graphics dossier says the allocation); which path clears USERD in client video memory; the TSG id rule.
10.10 Kernel exposure of slice 5 (written by the kernel-side subagent, reviewed by the main agent)
Code: src/nvidia/kernel/rmapi_memory.rs (KernelOs, the OsMemory provider),
kernel-open/nvidia/rmapi_node.c (allocation records, per-file mapping context, mmap),
src/nvidia/kernel/rmapi_node.rs (now on execute_with, close_with, gpu_release_with,
detach_with). No hardware access: nothing here reads or writes a register, maps a BAR or
makes a DMA mapping. The new code is reachable only through ioctl and mmap on
/dev/nvidia-rs-rmapi-ctl and /dev/nvidia-rs-rmapi-gpu<minor>; it has run in the QEMU guest
only.
| Request on the node | Answer |
|---|---|
| 0x3e, non-contiguous, 4 KiB pages | pages from `alloc_page(GFP_KERNEL |
| 0x3e contiguous (more than one page), BIG or HUGE granules | 0x56 |
NV_ESC_RM_MAP_MEMORY of system memory, then mmap |
address = physical address of the page plus offset; context stored in the file named by the descriptor (must be a control-node file of this driver: 0x1f otherwise; one per file: 0x63); mmap needs offset 0 (EINVAL) and must stay inside the allocation (ERANGE); pages inserted with vm_insert_page |
0x50a0, 0xd01, NV_ESC_RM_UNMAP_MEMORY, NV_ESC_RM_UPDATE_DEVICE_MAPPING_INFO |
as the core (CPU-side) |
| 0x40 | 0x56: nothing sets GpuFacts.video (no heap is built by this driver's first open) |
0x71 (NV_ESC_RM_ALLOC_MEMORY) |
0x56 after the flag checks: pinning is not implemented |
| video memory mapping, non-lazy virtual reservation | 0x56 (hardware side) |
Declared deviations from the original's open layer: the cache type of an allocation is
recorded but not applied (pages are always mapped cached; the original changes the kernel
attributes at allocation and the user protection at mmap); a private mapping is refused
(the original forces it shared); flush_gpu_cache is a counted no-op, so GPU-cacheable system
memory is released without the three register operations (harmless while no GPU maps it,
wrong once one does); the 64 MiB cap is below the workload's 80 MiB buffer.
Guest test (tests/vm/rmapi_user_test.c): 409 assertions per module load (335 before), with
and without the emulated IOMMU: the workload's 0x3e requests and replies, 0xd01, map with a
fresh descriptor, mmap, a pattern written through one mapping and read through a second, the
one-context rule, wrong offset and over-long mmap, unmap, free, close with live objects and
mappings (with a leak check at node exit), the workload's 0x50a0 request with its reply, a
second one (0x1a), 0x40 (0x56).