summaryrefslogtreecommitdiffstats
path: root/scripts/setup_guest_driver.sh
diff options
context:
space:
mode:
authorOpen-IOV <dev@open-iov.org>2026-09-23 05:44:08 -0400
committerOpen-IOV <dev@open-iov.org>2026-09-23 05:46:43 -0400
commit68cdd7728a7cc6715bbbff7decfe2b11c3bdf558 (patch)
tree3dc8ce2e6af313a97ec6852f5c663a9a93665d2e /scripts/setup_guest_driver.sh
downloadopen-iov-68cdd7728a7cc6715bbbff7decfe2b11c3bdf558.tar.gz
open-iov-68cdd7728a7cc6715bbbff7decfe2b11c3bdf558.zip
Open-IOV: initial public release
Open-IOV virtualizes NVIDIA GPUs so that unmodified guest drivers run with real GPU functionality - CUDA first, 3D and video to follow - on unmodified hosts, without a proprietary vGPU license and without patching any driver, firmware or hypervisor. Core principle: emulate the interface, pass through the work. kernel/ open-iov-vfio.ko - host VFIO mdev driver: virtual GPU device (PCI config space, BAR shadows, MSI-X), GSP boot emulation, GSP-RM message-queue/RPC emulation, memory model (GPU-VA to guest-PA discovery) and the semaphore-completion service that advances guest UVM progress. userspace/ libiov.so management API and examples. tools/ guest diagnostics, firmware analysis wrappers, RM probes. scripts/ stack manager, VM harness, build/load/test automation. config/ hardware/version profiles (the portability surface). docs/ documentation tree - start at docs/README.md. wiki/ long-form firmware and protocol deep dives. Status: initialization works end to end for a stock 570.144 Linux guest on Turing (TU104): driver probe, nvidia-smi, the full GSP-RM control battery, object creation and the early CUDA/UVM start-up path. GPU work forwarding - the step that makes CUDA kernels execute on real hardware - is the active work item; see docs/04-implementation/01-known-knowns-and-unknowns.md. License: BSD-3-Clause for the project; GPL-2.0 for kernel modules that link GPL-only kernel interfaces. See LICENSE and docs/09-reference/legal-and-licensing.md.
Diffstat (limited to 'scripts/setup_guest_driver.sh')
-rwxr-xr-xscripts/setup_guest_driver.sh99
1 files changed, 99 insertions, 0 deletions
diff --git a/scripts/setup_guest_driver.sh b/scripts/setup_guest_driver.sh
new file mode 100755
index 0000000..f4f2757
--- /dev/null
+++ b/scripts/setup_guest_driver.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# setup_guest_driver.sh - Setup NVIDIA driver in QEMU guest
+# Run this INSIDE the guest VM after installation
+
+set -euo pipefail
+
+echo "=========================================="
+echo "Setting up NVIDIA driver in guest"
+echo "=========================================="
+
+# Check if running as root
+if [[ $EUID -ne 0 ]]; then
+ echo "ERROR: This script must be run as root"
+ exit 1
+fi
+
+# Check kernel version
+KERNEL_VER=$(uname -r)
+echo "Kernel: $KERNEL_VER"
+
+# Install dependencies
+echo "Installing build dependencies..."
+apt-get update
+apt-get install -y \
+ build-essential \
+ dkms \
+ linux-headers-"$KERNEL_VER" \
+ linux-headers-generic \
+ pciutils \
+ clinfo
+
+# Check for NVIDIA GPU in guest
+echo "Checking for NVIDIA GPU in guest..."
+lspci -d 10de: | grep -E "VGA|3D controller" || {
+ echo "WARNING: No NVIDIA GPU detected in guest"
+ echo "Make sure QEMU is started with -device vfio-pci,sysfsdev=..."
+}
+
+# Option 1: Install from Ubuntu repository (easiest)
+echo ""
+echo "Choose installation method:"
+echo " 1) Ubuntu repository (nvidia-driver-550-open)"
+echo " 2) NVIDIA runfile (latest)"
+echo " 3) Build from source (open-gpu-kernel-modules)"
+read -p "Select [1-3]: " choice
+
+case $choice in
+ 1)
+ echo "Installing from Ubuntu repository..."
+ apt-get install -y nvidia-driver-550-open
+ ;;
+ 2)
+ echo "Downloading NVIDIA runfile..."
+ RUNFILE="NVIDIA-Linux-x86_64-570.144.run"
+ wget -q "https://us.download.nvidia.com/XFree86/Linux-x86_64/570.144/$RUNFILE"
+ chmod +x "$RUNFILE"
+ ./"$RUNFILE" --silent --dkms --no-opengl-files
+ ;;
+ 3)
+ echo "Building from open-gpu-kernel-modules source..."
+ git clone https://github.com/NVIDIA/open-gpu-kernel-modules.git /tmp/open-gpu-kernel-modules
+ cd /tmp/open-gpu-kernel-modules
+ git checkout 570.144
+ make -C kernel-open/modules SYSSRC=/usr/src/linux-headers-"$KERNEL_VER" -j$(nproc)
+ make -C kernel-open/modules SYSSRC=/usr/src/linux-headers-"$KERNEL_VER" modules_install
+ depmod -a
+ ;;
+ *)
+ echo "Invalid choice"
+ exit 1
+ ;;
+esac
+
+# Install firmware
+echo "Installing GSP firmware..."
+mkdir -p /lib/firmware/nvidia/tu102/gsp
+# Firmware files should be copied from host or downloaded
+# For TU104 (Turing), we need:
+# - bootloader-535.113.01.bin
+# - booter_load-535.113.01.bin
+# - gsp-535.113.01.bin
+echo "Copy firmware files to /lib/firmware/nvidia/tu102/gsp/"
+echo " (bootloader, booter_load, gsp binaries)"
+
+# Load driver
+echo "Loading NVIDIA driver..."
+modprobe nvidia
+
+# Verify
+echo ""
+echo "=========================================="
+echo "Verification"
+echo "=========================================="
+nvidia-smi
+echo ""
+dmesg -T | grep -i nvidia | tail -20
+
+echo ""
+echo "Setup complete! Recommended: reboot the guest" \ No newline at end of file