summaryrefslogtreecommitdiffstats
path: root/scripts/qemu_gdb_attach.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
commit2302fc09080bad51c73f293294e19fd4db464eb0 (patch)
treec722d186347fdef5a34131e9e143b1549b1daf8e /scripts/qemu_gdb_attach.sh
downloadopen-iov-2302fc09080bad51c73f293294e19fd4db464eb0.tar.gz
open-iov-2302fc09080bad51c73f293294e19fd4db464eb0.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/qemu_gdb_attach.sh')
-rw-r--r--scripts/qemu_gdb_attach.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/scripts/qemu_gdb_attach.sh b/scripts/qemu_gdb_attach.sh
new file mode 100644
index 0000000..310c196
--- /dev/null
+++ b/scripts/qemu_gdb_attach.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+# qemu_gdb_attach.sh - Launch QEMU with GDB server for guest kernel debugging
+# Usage: ./qemu_gdb_attach.sh [gdb_port] [freeze_at_start]
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+BASE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
+
+GDB_PORT="${1:-1234}"
+FREEZE="${2:-true}" # -S flag to freeze at startup
+
+# Default QEMU command from launch_qemu_vgpu.sh
+QEMU_CMD=(
+ qemu-system-x86_64
+ -enable-kvm
+ -cpu host
+ -smp 4
+ -m 8G
+ -device vfio-pci,sysfsdev=/sys/bus/mdev/devices/$(cat /sys/bus/mdev/devices/*/uuid 2>/dev/null | head -1),display=off
+ -drive file=/var/lib/libvirt/images/ubuntu-vgpu.qcow2,format=qcow2,if=virtio
+ -netdev user,id=net0,hostfwd=tcp::2222-:22
+ -device virtio-net-pci,netdev=net0
+ -nographic
+ -serial mon:stdio
+)
+
+# Add GDB server options
+if [[ "$FREEZE" == "true" ]]; then
+ QEMU_CMD+=(-s -S) # -s = gdbserver on :1234, -S = freeze at startup
+else
+ QEMU_CMD+=(-s) # -s = gdbserver on :1234, run normally
+fi
+
+# Override port if specified
+if [[ "$GDB_PORT" != "1234" ]]; then
+ QEMU_CMD+=(-gdb "tcp::$GDB_PORT")
+fi
+
+echo "=========================================="
+echo "QEMU GDB Debug Launch"
+echo "=========================================="
+echo "GDB Port: $GDB_PORT"
+echo "Freeze at start: $FREEZE"
+echo "QEMU Command: ${QEMU_CMD[*]}"
+echo ""
+echo "In another terminal, connect with:"
+echo " gdb ./vmlinux"
+echo " (gdb) target remote localhost:$GDB_PORT"
+echo " (gdb) break nvidia_probe"
+echo " (gdb) continue"
+echo ""
+echo "Or use the GDB script:"
+echo " gdb -x $BASE_DIR/tools/gdb_scripts/nvidia_init.gdb ./vmlinux"
+echo ""
+
+# Launch QEMU
+exec "${QEMU_CMD[@]}" \ No newline at end of file