14 Commits

Author SHA1 Message Date
8fc8703677 build/tools: forward LLVM to kbuild, preserve major-195 nodes, and trim GV100 WPR stack (#661)
* build/tools: forward LLVM to kbuild, preserve major-195 nodes, and trim GV100 WPR stack

- Forward LLVM=$(LLVM) to kbuild invocations in Makefile
- Treat /sys/module/nvidia symlinks safely in install.sh and tools/bind_dev_nodes.sh, and preserve major-195 character device nodes when nvidia_rs registers them directly
- Split gv100_decode_and_plan in wpr_blob.rs to keep kernel stack frames well below the 1,024-byte IBT/codegen limit

* tools/bind_dev_nodes.sh: match nvidia-ctl and nvidia-gpu major-195 chrdev names

---------

Co-authored-by: braulio <braulio@localhost>
2026-12-06 00:24:01 -08:00
4f3029ebd7 tools/docs: NixOS portability for first-open runner, bind_dev_nodes, pahole, and live-swap udev freeze (#506)
* tools/docs: NixOS portability for first-open runner, bind_dev_nodes, pahole, and live-swap udev freeze

* docs: note udev queue restart on failed or aborted live swaps

* docs: drain in-flight udev workers with udevadm settle before freezing queue
2026-12-04 20:28:24 -08:00
d1596ff615 Merge origin/master into feat/ga102-desktop-master 2026-12-03 01:12:21 -08:00
270d44c110 Merge pull request #240 from morebrackets/fix/tools-vbios-flash-resize-bar1-bind-dev-nodes-safety
fix(tools): harden vbios_flash.sh, resize-bar1.sh, and bind_dev_nodes.sh safety
2026-12-02 16:40:53 -08:00
12032594d6 Reject empty option values in vbios_flash.sh and clean unmounted stubs in bind_dev_nodes.sh
- Require non-empty values for --index/--nvflash/--rom/--backup-dir in
  tools/vbios_flash.sh so --index "" exits 2 instead of selecting all GPUs.
- Move empty regular-file stub cleanup after the mountpoint check in
  tools/bind_dev_nodes.sh::unbind_one() (guarding against symlinks) so
  already-unmounted stubs are also removed.
2026-12-02 16:19:10 -08:00
2d5eb284c3 Merge origin/master (ec7c96a) into feat/ga102-desktop-master 2026-12-02 14:08:14 -08:00
bc24624481 rmapi/caps: match stock 580.178.04 nvidia-caps minors (IMEX=4323, 8192 range, full mig-minors) 2026-12-02 13:39:26 -08:00
163e45b73b fix(tools): harden vbios_flash.sh, resize-bar1.sh, and bind_dev_nodes.sh safety
- tools/vbios_flash.sh:
  - Support non-zero PCI domains when walking ancestor bridges to wake to D0 (replace hardcoded */0000:* check with full DDDD:BB:DD.F regex).
  - Back up every target adapter's VBIOS before flashing instead of only ADAPTER_INDICES[0].
  - Validate missing option values before shift 2 and verify --index is a non-negative integer present in detected adapters.
- tools/resize-bar1.sh:
  - Verify none of DRIVER_MOD, nvidia, nvidia_rs, or nouveau remain loaded before writing PCI config space.
  - Wrap PCI_COMMAND memory-decode disable/restore in try/finally, guard against empty ReBAR size masks (avoiding sizes.bit_length()-1 == -1), clamp want to the 6-bit PCI_REBAR_CTRL_BAR_SIZE field, and abort cleanly if no root ports resolve.
- tools/bind_dev_nodes.sh:
  - Remove newly created empty stub files if mount --bind fails, and remove empty regular-file stubs on --unbind (never touching real character device nodes).
2026-12-02 01:19:41 -08:00
84dc9ae45f gsp/rmapi: register nvidia-caps chrdev, wire ga10x SET_REGISTRY unlocks/disable_ecc, and verify booter-unload (#83, #131, #132)
Three fixes for bare-metal GSP-RM bring-up and runtime feature parity:

1. Register the 'nvidia-caps' character device alongside /proc/driver/nvidia/capabilities (#83):
   - Exposing /proc/driver/nvidia/capabilities/mig/{config,monitor} without an 'nvidia-caps'
     major in /proc/devices caused bare-metal NVML 580 (nvidia-smi) to abort with
     'Failed to initialize NVML: GPU access blocked by the operating system' (exit 17).
   - Register a minimal 'nvidia-caps' cdev (matching 580.178.04 nv-caps.c), assign distinct
     minors (1=mig/config, 2=mig/monitor, 3=fabric-imex-mgmt), expose /proc/driver/nvidia-caps/
     {mig-minors,nvlink-minors,sys-minors}, skip cleanly if stock /proc/driver/nvidia or
     /proc/driver/nvidia-caps already exists, and create/clean /dev/nvidia-caps/nvidia-cap{1,2,3}
     in tools/bind_dev_nodes.sh.

2. Wire SET_REGISTRY feature unlocks & disable_ecc=1 on default ga10x_gsp=1 path (#131, #132):
   - Add BootRegistryOptions / write_registry_with_options() in nv_rs_core::gpu::ga10x_gsp
     and encode EnableResizableBar=1, dyn_bar1_p2p keys, unpriv_profiling, and RMEnableEcc=0
     (when disable_ecc=1) in Ga10xGsp::system_info(). Previously these were only sent on
     gsp_bringup.rs (ga10x_gsp=0).

3. Verify Booter Unload mailbox0 and WPR2 teardown state (#83):
   - Add classify_booter_unload() matching 580.178.04 kgspExecuteBooterUnloadIfNeeded_TU102
     and check both mbox0 != 0 and WPR2_ADDR_HI != 0 in Ga10xGsp::unload() instead of
     silently logging result=0 when Booter Unload fails (e.g. mbox0=0x88 on GA104M).

Verified:
- cargo fmt --all -- --check, cargo clippy, cargo test (15/15 ga10x_gsp, 986/986 workspace)
- make modules + tools/check_kernel_module.py PASS (0 GOT, 0 memcpy/memset, max stack 1000B)
- QEMU EDU + QEMU EDU --iommu guest validation PASS
- Live GA107M (RTX 3050 Mobile, 10de:25a2) VFIO VM: real uncovered /proc/driver/nvidia +
  /proc/driver/nvidia-caps + /dev/nvidia-caps/nvidia-cap{1,2,3} + nvidia-smi RC=0,
  disable_ecc=1 SET_REGISTRY boot OK, clean booter-unload WPR2 teardown & rmmod OK.
2026-12-01 22:00:59 -08:00
152640770a tools/packaging: add desktop DRM ABI checker, QEMU smoke guest, and install/udev wiring 2026-12-01 19:20:50 -08:00
38993210b9 fix(#158,#159,#160,#165) + feat(#168,#169,#173,#174): Docker/CDI devnodes, safe V100 HBM default & per-GPU backoff, GV100 NV6 LCE4 routing, and opt-in PCIe/idle/tensor/VRAM unlocks 2026-12-02 02:55:05 +00:00
3ada318df4 Drop-in UX (#133), Maxwell/Pascal ACR FW, Hopper/Blackwell split-RM, and #142 Phases 3-4
- Zero-friction first-run UX (#133): default runtime_engines=1 and pci_target=*
  in nvidia_rs.ko (with explicit bringup=N precedence via resolve_bringup_mode);
  install.sh auto-extracts pre-GSP firmware packs + GSP blobs, installs
  /etc/modprobe.d/nvdriver.conf (install nvidia /bin/false, char-major-195-*
  alias), /etc/modules-load.d/nvdriver.conf, and /etc/udev/rules.d/70-nvdriver.rules,
  and enables BIND_DEV_NODES=1 by default.
- Maxwell & Pascal real firmware loading (GM10x-GP108): extend
  tools/extract_gv100_firmware.py (--family gm20x|gp100|gp10x|all) using
  REA-verified 580.178.04 ACR/PMU bundles (_nv016827rm/_nv016828rm/_nv016888rm)
  with a shared pack_container() builder; wire LoadedPack::request_legacy and
  HS Falcon IMEM/DMEM upload + execution into boot_maxwell_pascal_pre_gsp.
- Unified Hopper/Blackwell split-RM routing: add GspFirmwareChipFamily::boot_mode()
  (FwsecBooter vs Fmc) as a single source of truth; integrate GH100/GB10x/GB20x
  FMC BootROM handshake into Ga10xGsp::boot/unload via PciRegIo so every GSP-RM
  GPU from Turing through Blackwell runs on the unified gsp_route.rs split-RM.
- Issue #142 Phases 3-4: add FileMappingLedger and GpuSlotLedger (+ unit tests)
  to src/nvidia/src/rmapi/alloc_registry.rs + rmapi_memory.rs FFI, removing
  struct nv_rs_rmapi_mapping and redundant bar0/bar1/numa_status fields from
  kernel-open/nvidia/rmapi_node.c.

Validated: cargo fmt/clippy/test (957+2), NV_RS_KERNEL_IBT=0 & 1 make modules +
check_kernel_module.py (largest_stack=1000), test_gate_cases.py (18/18),
extract_gv100_firmware.py --check, and QEMU EDU verify_rust_guest.py (non-IOMMU
and --iommu, maxframe=984).
2026-12-01 23:03:43 +00:00
bf60e3a72e Harden raw BAR1 dmabuf export, unmap DMA on GPU removal, and fix 6.3/pipefail checks
Require CAP_SYS_ADMIN for NV_RS_ESC_EXPORT_TO_DMABUF_FD now that RMAPI nodes are 0666, unmap retained RMAPI and UVM DMA mappings in nv_rs_rmapi_node_gpu_remove() before PCI teardown, bump the nv_vma_start_write() guard to Linux 6.4+ (6.3 doesn't have vma_start_write), and switch bind_dev_nodes.sh from lsmod|grep to /sys/module checks so pipefail SIGPIPE can't bypass the stock-driver guard.
2026-11-30 11:15:49 -08:00
87a26a2aee Support 0x2080a61d power limit query and non-root /dev/nvidia* access
btop queries nvmlDeviceGetPowerManagementLimit, which hits RM control 0x2080a61d and was falling through to NOT_SUPPORTED. Wire it up next to 0x2080a61f to return the 300W limit.

Also switch the RMAPI and UVM misc devices to mode 0666 (matching stock /dev/nvidia*) and add a small bind-mount helper (wired optionally via BIND_DEV_NODES=1 in install.sh) so tools like btop, nvidia-smi, and non-root services can use nvidia_rs directly without a mount namespace.
2026-11-30 10:53:36 -08:00