Files
nvdriver/tools/bind_dev_nodes.sh
Eric Hartford 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

78 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# Bind-mount nvidia_rs device nodes onto standard /dev/nvidia* paths so
# unmodified CUDA/NVML userspace tools (nvidia-smi, btop, llama.cpp, PyTorch)
# work system-wide without a per-process mount namespace.
#
# Refuses to run while stock nvidia.ko is loaded (safe for Dual-GPU hosts).
set -euo pipefail
MODE="${1:---bind}"
bind_one() {
local src="$1"
local dst="$2"
[ -c "$src" ] || return 0
local src_dev
src_dev=$(stat -Lc '%t:%T' "$src")
if [ -L "$dst" ]; then
local link_dev
link_dev=$(stat -Lc '%t:%T' "$dst" 2>/dev/null || true)
if [ "$link_dev" = "$src_dev" ]; then
return 0
fi
rm -f "$dst"
fi
if mountpoint -q "$dst" 2>/dev/null; then
local dst_dev
dst_dev=$(stat -Lc '%t:%T' "$dst" 2>/dev/null || true)
if [ "$dst_dev" = "$src_dev" ]; then
return 0
fi
umount "$dst"
fi
if [ ! -e "$dst" ]; then
touch "$dst"
fi
mount --bind "$src" "$dst"
}
unbind_one() {
local dst="$1"
if mountpoint -q "$dst" 2>/dev/null; then
umount "$dst"
fi
}
case "$MODE" in
--bind)
if [ -d /sys/module/nvidia ]; then
echo "ABORT: stock nvidia.ko is loaded; refusing to overwrite /dev/nvidia*." >&2
exit 1
fi
if [ ! -c /dev/nvidia-rs-rmapi-ctl ]; then
echo "ABORT: /dev/nvidia-rs-rmapi-ctl not found (is nvidia_rs loaded?)." >&2
exit 1
fi
bind_one /dev/nvidia-rs-rmapi-ctl /dev/nvidiactl
bind_one /dev/nvidia-rs-uvm /dev/nvidia-uvm
for src in /dev/nvidia-rs-rmapi-gpu[0-9]*; do
[ -c "$src" ] || continue
idx="${src#/dev/nvidia-rs-rmapi-gpu}"
bind_one "$src" "/dev/nvidia${idx}"
done
if [ -c /dev/nvidia-rs-modeset ] && [ ! -d /sys/module/nvidia_modeset ]; then
bind_one /dev/nvidia-rs-modeset /dev/nvidia-modeset
fi
;;
--unbind)
for dst in /dev/nvidiactl /dev/nvidia-uvm /dev/nvidia-modeset /dev/nvidia[0-9]*; do
[ -e "$dst" ] || continue
unbind_one "$dst"
done
;;
*)
echo "Usage: $0 [--bind|--unbind]" >&2
exit 2
;;
esac