nvidia-driver-rs 4526e6a816 Baseline: validated 30/30 tree with passing Level 7 hardware regression
- 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
2026-11-23 23:48:38 +00:00

Rust NVIDIA driver reconstruction — implementation in progress

This is not yet a functional GPU or CUDA driver. It implements verified host
contracts and builds a distinct Linux diagnostic module. The full requested
580.178.04 hardware matrix remains the target, including the legacy host-RM
and GSP paths. No card is currently supported for GPU execution by this code.

HAL-selection audit: earlier GPU binder reports incorrectly labeled RM index0
as monolithic. The original constructor maps legacy physical runtime3 to HAL
index2. Historical labels and conditional bindings are reconciled. The selected
PreInit/Load parent algorithms now live in gpu/pf.rs; their required transitive
operations and real initialized inputs remain incomplete. reports/parity-ledger.json
tracks these boundaries. No hardware execution used the mistaken selections.

Build and verify
  make test
  make check
  make modules
  make modules_install INSTALL_MOD_PATH=/absolute/staging/directory

Rust1.100.0 is pinned, including the x86_64-unknown-none kernel target. Linux
headers default to /lib/modules/$(uname -r)/build; override KERNEL_SOURCES and
KERNEL_OUTPUT for another prepared tree. The kernel integration is currently
x86_64 only. Build outputs live in kernel-open; nvidia_rs.ko is a diagnostic
module that executes Rust event/client lifetime and copied-buffer ioctl
logic through /dev/nvidia-rsctl. Its default empty pci_target binds no devices.
The isolated control module has been loaded, tested and unloaded; compare the
module hash in reports/live-control-session.json before applying those results
to a newer build. CUDA execution remains unavailable.
modules_install stages files only. Existing installed modules remain separate.

Implemented
- no_std ABI crate:14 checked wire structures, offsets, sizes and alignments;
  pointer fields remain integer addresses and are never dereferenced by codecs.
- Core controls: recovered tri-state policy, architecture-dependent predicate,
  licensing layout conversion and explicit unknown fallback errors.
- Static metadata:279 resource descriptors;1,128 product/subsystem rows;
 449 PCI IDs;1,388 binary legacy blacklist records;113 chip tuples.
- Hardware gates: PCI admission, bounded register-read interface and firmware
  policy/fallback decisions. These are not full initialization backends.
- Events: bounded file/event ownership, association references, posting pins,
  deferred destruction, overflow handling and cross-table token isolation.
- Virtual address reservations: alignment, overlap, overflow and stale-token
  checks. Reservation metadata does not create GPU mappings or allocate VRAM.
- GPFIFO/method encoding: explicit Maxwell-kernel/Turing/Hopper formats with
  validated address/length/segment constraints;120 cases checked with original
  C headers. Encoded entries are not submitted to hardware.

Verification boundaries
Recorded fixtures test221 allocation wrappers,203 nested parameter lengths
and policy-query buffers. These are local Rust codec/algorithm tests against
captured original-driver data, not execution of Rust code on a GPU. Event tests
exercise modeled interleavings; they do not prove kernel concurrency safety.
The retained original-driver CUDA41->42 result is not a Rust-driver test.

Remaining implementation
Physical NVIDIA validation of PCI/DMA/interrupt adapters, GPU memory ownership,
GPU root installation/TLB operations, per-chip initialization and recovery, channel
creation and submission, scheduling, GSP bootstrap/RPC, UVM, CUDA-compatible
kernel device/ioctl dispatch and feature-specific paths remain unimplemented.
Source types, private callbacks and several hardware contracts remain only
partly recovered. No unimplemented operation is reported as hardware success.

Evidence
/home/geodd/nvidia-driver/analysis-580.178.04/reports/DEEP_DIVE.txt
/home/geodd/nvidia-driver/analysis-580.178.04/reports/rust-driver-design.txt
reports/ contains implementation/test provenance. abi/ and tests/ contain
hash-linked fixtures. tools/ generates tables deterministically from evidence.
The reference /home/geodd/open-gpu-kernel-modules is not modified.

Active goal continuation
The full objective is tracked in reports/parity-ledger.json. Current progress
includes per-file client namespaces, exact observed free/NULL-control behavior,
client handle queries, transactional MMU publication/recovery, DMA lifetime
ownership and ordered engine-initialization sequencing. These remain partial
components until concrete PCI/DMA/MMIO/TLB and engine backends are implemented.
reports/client-lifecycle-differential.json compares eight bounded software
client cases on the original and loaded Rust modules; no GPU parity is implied.

PCI/DMA and compatibility continuation
The module now registers an opt-in PCI driver with pci_target empty by default.
An empty target acquires no hardware. An explicit target is a bring-up path
only: no physical PCI bind, DMA transfer or engine execution has been validated.
Probe now creates a Rust-owned DMA context after chip/product admission and
retains its PCI lease through removal. Host mock tests verify this lifetime;
reports/pci-rust-preparation-validation.json records the build and boundaries.
Do not treat successful preparation/boot-register reads as GPU readiness.
Production GPU storage now uses a driver base reference and external owned
GpuLease tokens. Removal blocks new leases before releasing the base;
the final lease closes DMA and hands failed cleanup to a retained retry
owner. External leases pin module code, and unload waits for delayed cleanup
owners before destroying their workqueue. SystemMemory preparation retains
this real lease; it cannot assert hardware readiness. Host and EDU guest
tests cover these paths, including one injected cleanup failure and retry.
See reports/gpu-lifetime-validation.json for evidence and caller contracts.
The Linux coherent-DMA bridge retains PCI/mask leases and supports bounded
backing access. It is compiled and tested against mocked OS APIs; actual GPU
DMA remains pending. Legacy NVOS21 and 32-bit compat ioctls now share the
validated fixed-width layouts. A real i386 executable passed five client cases
on both original and isolated Rust control nodes. See live-control-session.json,
live-compat32-validation.json, compat-implementation.json and pci-linux-adapter.txt
under reports/. GV100 original engine tables and verified BIF prefixes are in
src/nvidia/src/gpu/gv100.rs; full initialization is still incomplete.

OS-adapter VM validation and page tables
make test-host-adapters runs the host C/Rust FFI and adapter fixtures.
make test-vm-adapters boots an isolated QEMU guest with no host PCI passthrough
and tests the C OS adapter sources on EDU, using MSI and shared INTx, then an
emulated IOMMU DMA domain. This is not NVIDIA hardware or Rust GPU execution.
See reports/vm-adapter-findings.txt and tests/vm/README.txt for exact boundaries.
The guest also exercises Rust LinuxDma ownership and five unpublished Volta
page-table levels backed by real coherent allocations. All four IRQ/IOMMU
combinations now pass 35 Rust checks and 131 distinct outer assertions, including C-header
word comparisons, instance backing and retained cleanup retry/unload.
reports/vm-adapter-validation.json and its IOMMU counterpart identify the
tested guest artifacts. No GPU root is published by these tests.
Prepared GPUs are published in an IRQ-locked registry during probe and retired
before the driver base is released. Generation-tagged private keys reject stale
lookups; acquired leases retain GPU/module lifetime across retirement. These
keys are not original RM GPU IDs or a claim of hardware readiness. Duplicate
probe failure and its retained cleanup retry are also tested in the guest.
The unpublished page-table builder now has actual coherent backing through
LinuxDma, with checked cleanup and a C-header word oracle. GPU root install and
TLB completion remain unimplemented. The recovered GV100 BIF power callback
and parent StateLoad control flow are translated, with mandatory unresolved
children that fail when no implementation exists. Other engine callbacks,
initialized policy state and actual hardware execution remain required. See
reports/gpu-gv100-load.txt for the exact implemented and unresolved paths.

Configured timeout policy
gpu/timeout.rs implements the original elapsed/delay and thread-state fallback
rules, with 2304 unchanged matching-public-C vectors and focused failure tests.
The Linux coarse jiffies clock is guest-tested through Rust. Thread-state and
GPU timer ownership remain mandatory services. These components do not make
the GPU ready. reports/gpu-timeout.txt records exact evidence and limitations.

Thread-node timeout policy
gpu/thread_timeout.rs implements original initialization, compute/non-compute
deadline selection, reset and yield policy. Six focused tests and512 unchanged
matching-public-C vectors pass. The Linux context adapter is guest-tested in
process and hardirq contexts. Registry ownership and entry/exit scope remain
required; a PID snapshot does not own a thread node. See gpu-thread-timeout.txt
under reports/ for evidence and remaining gaps.

Selected GV100 timer sampling
gpu/timer.rs implements the PF-monolithic OBJTMR high/low/high read, invalid
low-word retries and error-count/recovery ordering. It selects original PTIMER
or usermode offsets from initialized GPU policy. Original reset callbacks are
mandatory; an executed recovery returning time zero is kept distinct from a
stable zero timestamp and from unavailable services. A finite read bound does
not manufacture an original timeout. 148 original-instruction emulator vectors
check rollover, bad values, both register windows, zero retries and error-count
wrap. make check regenerates those vectors using REA_PYTHON with Unicorn and
pyelftools. The actual initialized timer owner, interrupt/callback scheduler and
full timeout backend remain required. See reports/gpu-timer-validation.json.

GPU delay continuation
The timer's short low-word getter now warns and invokes the full reader on
invalid low bits; it never masks them into a plausible time. The selected
PTIMER delay preserves the original 12us mode boundary, wrapping arithmetic,
simulation clamp, attachment/reset status precedence and trace ordering.
A borrowed Service binds both delay modes to the actual sampling algorithms;
GPU owner queries, recovery and diagnostics remain mandatory services. The
independent poll/read caps report safety exhaustion instead of completion.
24 low-getter and 44 delay instruction-emulation cases plus focused integration
tests cover these paths. This does not establish an initialized physical timer,
callback scheduler, GPU execution or CUDA support. See
reports/gpu-timer-delay-validation.json for evidence and limits.

Owned process-context register access
GpuLease::register_io creates GpuRegisters with its own GPU/module lease;
the cleanup owner retains PCI resources until that lease drains. It implements
the recovered RegisterIo interface without exposing a raw PCI lease. GPU removal
blocks reads/writes before dispatch to the C adapter, while existing accesses
retain storage through cleanup/retry. The unsafe constructor requires actual HAL
selection, process context and operation/access policy ownership; it grants no
readiness or register-sequence lock. Host lifetime fixtures and all four EDU
guest cases exercise this path. See reports/gpu-register-access-validation.json.

Register sequence ownership
The production owner supplies a process-context operation mutex to
GpuLease::lock_register_io. LockedGpuRegisters unlocks before releasing its GPU
lease; removal marks the GPU removed, drains an existing sequence, then marks
PCI removed and releases the base reference. Acquisition rechecks removal after
waiting and rejects unavailable lock services. The EDU guest tests blocked
removal on another task, denied new operations, disabled-IRQ rejection and final
cleanup after unlocking. This is one serialization primitive; the original RM
global/multi-GPU lock hierarchy, actual HAL policy and physical quiescence remain
required. See reports/gpu-operation-validation.json.

Linux delay and scheduling services
The exact580 os_delay_us policy splits full milliseconds and microseconds into
actual kernel busy-delay primitives and rejects hard-IRQ requests above20000us.
The RM nanosecond wrapper floors ns/1000 with minimum1us, including inputzero.
CPU yield checks actual interrupt/atomic/IRQ state then invokes the original
TASK_INTERRUPTIBLE schedule_timeout(1) sequence. ThreadServices composes these
and LinuxClock with mandatory diagnostic services for thread_timeout policy;
current-node registry/entry ownership is still required.400 unchanged-source
oracle vectors and13 original thunk cases validate units/status/call ordering.
The EDU guest exercises process and hard-IRQ paths; it does not prove precise
duration or GPU timing. See reports/host-time-validation.json.

Ordinary thread-state ownership
The kernel Registry owns dynamically allocated ordinary-task entries, retains
task/module references, rejects duplicate PID entries, and records the original
wrapping sequence and eight-entry trace. Timeout operations resolve the actual
registered entry. FIFO callbacks execute before unlink; typed globally unique
callback IDs reject stale cancellation across entry lifetimes. Linux guest
coverage includes real IRQ-saving locks and allocation, lookup/reset/check/yield,
callbacks, duplicate failure and clean unload. No global RM entry point is wired
to this internal owner yet. ISR routes, mutable overrides, entry/exit assertion
services and deferred GPU work remain required. See reports/thread-state-validation.json.

Proprietary timer initialization
Selected static timer StateInitLocked is059663, with HAL+190=059661.
This proprietary helper checks9430bit4 and programs9410then9400 from actual
OS wall-clock seconds/useconds. It is not the empty public-source method.
The wrapper preserves gating and atomic busy-marker semantics and ignores an
executed helper6b exactly as original. Unavailable services retain partial
state and quarantine retries. The kernel provider retains the actual locked
GPU/PCI/module owner; required diagnostics have no success default.
StateLoad pending-event restoration, full timer construction, physical access
routing and global engine wiring remain required. See reports/timer-init-validation.json.

Firmware-copy backing is now integrated into Kbuild with actual Linux buddy
pages, verified PFN/PTE policy, streaming DMA and retryable WB cleanup. Isolated
EDU guest tests prove UC/WB transitions, complete source-byte DMA round trips,
and cleanup after logical removal; no NVIDIA device is rebound or programmed.
The source-selection/constructor/runtime policy still gates final VBIOS use.
See reports/rom-fw-linux-validation.json for precise boundaries and artifacts.

The selected GV100 fault ring has a concrete owned Linux coherent backing and
bounded device-shared word access. Four guest DMA/IRQ modes verify45 word-access
predicates each, including device payload/valid publication and full-packet clear
readback. Actual fault-buffer programming, IRQ wiring and physical channel/reset
providers remain required. See reports/fault-words-linux-validation.json.

An owned Linux nano-timer provider now retains stable callback storage and a
GPU/module lease through synchronous cancellation. Four Linux guest modes
exercise29 predicates each, including removal while the timer is the last
external GPU owner. RM timer event restoration still needs ISR/deferred dispatch
and actual event/lifecycle wiring. See reports/nano-timer-validation.json.

The native memory fixture adds24 checks using actual coherent Linux DMA: seven
SYS pages, GV100 page tables and instance backing, shader/CB0/GPFIFO readback,
freeze pins, refusal to free frozen backing and explicit unpublished quiescence
before cleanup. All four IRQ/IOMMU variants pass. The GV100 probe identity is
synthetic on EDU; no root, channel or runlist is installed in hardware and no
shader executes. See reports/native-memory-vm-validation.json.
Description
No description provided
Readme MIT 157 MiB
Languages
Rust 65.3%
Python 17.9%
C 15%
Shell 0.7%
Makefile 0.5%
Other 0.4%