diff options
161 files changed, 597 insertions, 2 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fd0ee61 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,38 @@ +# Open-IOV editor defaults. Per-area .clang-format files govern C layout; +# tools must not mass-reformat existing files (see +# docs/07-developers/onboarding-and-standards.md section 3). + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab +indent_size = 8 + +# Host kernel module: Linux kernel C style (tabs, tab width 8, ~80 columns). +[kernel/**.{c,h}] +indent_style = tab +indent_size = 8 +tab_width = 8 + +# Userspace library: LLVM base, 4 spaces, ~100 columns. +[userspace/**.{c,h}] +indent_style = space +indent_size = 4 +tab_width = 4 + +# Tools: LLVM base, 4 spaces, ~100 columns. +[tools/**.{c,h}] +indent_style = space +indent_size = 4 +tab_width = 4 diff --git a/CODESTD-REPORT-2026-10-08.md b/CODESTD-REPORT-2026-10-08.md new file mode 100644 index 0000000..e07c4a9 --- /dev/null +++ b/CODESTD-REPORT-2026-10-08.md @@ -0,0 +1,114 @@ +# Code-standards remediation report — 2026-10-08 + +Branch: `ws/code-standards` (worktree `/tmp/opencode/wt-codestd`, base +`master` @ `3956a2f3`). Source of improvements: +`handoff-code-standards.txt` §4 (prioritized), items 1–5 of the task brief. +Scope limits honoured: no GPU/module/QEMU/guest/ssh operations, no CI +behaviour changes, no non-public-path prose in tracked files. + +## Applied + +| # | Item | Files | Commit | +|---|---|---|---| +| 1 | `.editorconfig` (root) + `.clang-format` for `kernel/`, `userspace/`, `tools/` | 4 | `c1b99f89` | +| 2 | `docs/07-developers/onboarding-and-standards.md` §3.2: real userspace C style + userspace rules | 1 | `1abab5b6` | +| 4 | Same doc, new §3.4: de facto commit/doc/config/SPDX conventions | (same commit) | `1abab5b6` | +| 3 | SPDX sweep: `userspace/` (ours), `tools/`, `scripts/` | 155 | `8367674c` | + +Details: + +* **Item 1 (config-only).** Root `.editorconfig` (UTF-8, LF, final newline, + trim trailing whitespace; tabs for Makefiles and `kernel/**`, 4 spaces for + `userspace/**` and `tools/**`). `kernel/.clang-format` is Linux kernel + style (tabs, tab width 8, 80 columns, `BreakBeforeBraces: Linux`). + `userspace/.clang-format` and `tools/.clang-format` are LLVM base, 4-space + indent, 100 columns. Headers state that existing files are not to be + mass-reformatted. All three files parse as YAML (checked; `clang-format` + itself is not installed on this host). +* **Item 2.** §3.2 previously said "C: same style as the kernel module where + practical" — contradicted by every userspace source (4-space indent, e.g. + `libvgpu.c` 523 space-indented lines / 0 tabs). Rewritten to state the + actual 4-space/~100-column style, naming (`snake_case`, `*_t`, + `_LIBVGPU_H_` guards, `extern "C"`), status-type error handling + (`vgpu_error_t`, `map_errno` at the syscall boundary, no `abort()` in + libraries), the SPDX rule, and the shell `set -e` / `set -euo pipefail` + practice. +* **Item 4.** New §3.4 records: commit messages + (`<subsystem>: <description>`, issue refs `(ISSUE-0001)`), doc conventions + (`> Status:` preamble + `<!-- change (YYYY-MM-DD): ... -->` markers, + referencing `debug/risc-v-gsp-rm-vm/docs/`), `config/hardware` + + `config/versions` and `firmware/<SERIES>-GSP/<MAJOR.MINOR>/` layouts, and + the per-file SPDX enforcement point (BSD-3-Clause vs GPL-2.0). +* **Item 3.** 159 tracked sources under `userspace/`, `tools/`, `scripts/` + lacked an SPDX identifier (none of the 20 `scripts/` files had one; 12 + were in `userspace/`; the remaining 127 in `tools/`). Added the minimal + header to the 155 + that are ours — `/* ... */` for `.c`/`.h`, `# ...` for `.py`/`.sh`, after + any shebang/coding line — plus `Copyright (c) 2026 Open-IOV contributors`, + matching the existing line in `tools/gen_gsp_bindata.py`. Exactly 2 lines + added per file, no other content touched (verified: 310 insertions, 0 + deletions). Shell files pass `bash -n`; the 56 Python files compile. + * Excluded: `userspace/extern/{inc,src}` (4 files, vendored MIT) — + relicensing third-party code would be wrong. + * Note on the brief's "(0 in userspace)": the handoff actually reports + "no SPDX headers at all in userspace/lib or userspace/tests"; live + verification agreed (12 userspace files missing, 8 of them ours). +* Docs link checker (`scripts/check-docs-links.py`): 62 files, no broken + relative links after the doc edit. + +Changed-file counts: 4 + 1 + 155 + report = 161 files across the branch; ++125 / +48 / +310 lines (report excluded). + +## Not applied (with reasons) + +* **`kernel/**` SPDX sweep + `MODULE_LICENSE("GPL v2")` normalization** — + explicitly out of scope for this branch ("do NOT touch kernel/** (record as + follow-up)"). State at base: SPDX in 17/42 top-level kernel `.c`/`.h` + files (22 incl. subdirs), 6× `MODULE_LICENSE("GPL")` and 1× `"GPL v2"`. + Needs a GPL-2.0 pass of its own; recommend it as the next standards task. +* **CI enforcement (drop `|| true` for checkpatch/cppcheck, shellcheck + + `.shellcheckrc`, SPDX-header check, ruff config)** — improvement #3, but + the task's hard constraints forbid CI behaviour changes. Reported only + (below) for a future PR. +* **Formatting `kernel/gsp_emulation.c` and `kernel/dynamic_rpc_dispatcher.c`** + — improvement #1 allows "convert or record an explicit exemption"; this + branch is config-only (no mass reformatting), so the configs carry the + no-mass-reformat note and these two files remain outliers until a + dedicated, behaviour-neutral formatting commit. +* **Root `CONTRIBUTING.md`** (improvement #8) — not among task items 1–5. +* **`userspace/extern/**`** — vendored MIT (cargs, tomlc99); identifiers + intentionally left as upstream. +* **Study-material discipline (improvement #9)** — conventions for study + material are recorded alongside that material, not in this public worktree. +* **greeneye session-format rules in tracked docs** (improvement #6, partial) + — §3.4 covers commit/doc/config/SPDX conventions; the session-format rules + already live in `debug/risc-v-gsp-rm-vm/docs/01-DESIGN.md` and + `26-ARCHITECTURE.md`, so they were not duplicated. + +## CI findings (report-only, no changes) + +Verified against `.github/workflows/ci.yml` and `kernel/tests/Makefile`. + +1. **Kernel test modules built nowhere, insmodded anyway** — + `.github/workflows/ci.yml:78` `sudo insmod + gsp_vgpu_comprehensive_test.ko` (and `:81` rmmod); `:87` + `gsp_vgpu_kunit_test.ko` (and `:90`); `:95` `gsp_vgpu_mock_test.ko` (and + `:98`). None of these modules is produced: `kernel/tests/Makefile:1` has + only `obj-m += gsp_emulation_test.o`. The `insmod` invocations fail the + step (no `|| true`), so the `kernel-test` job cannot be green as written. +2. **Orphaned test source** — `kernel/tests/gsp_rpc_test.c` has no `obj-m` + entry in `kernel/tests/Makefile`, so it is never compiled. +3. **Legacy guest-driver build** — `.github/workflows/ci.yml:69-70` + `make -C driver KDIR=...`; there is no `driver/` directory in the + repository (0 tracked files), so the step fails after `make kernel` + succeeds. +4. **Advisory static analysis** — `.github/workflows/ci.yml:221` + checkpatch ends with `|| true` and `:226` cppcheck ends with `|| true`; + both can never fail the job (matches handoff §2.3). +5. **Note (intentional):** `.github/workflows/ci.yml:249` runs + `./test_vgpu_userspace ... || true` with the comment "Expected to fail + without driver, but should run" — documented behaviour, not a defect. + +Suggested future PR (out of scope here): reconcile the test-module names or +build the missing modules, drop the `driver/` step, gate checkpatch/cppcheck +on changed files, and add shellcheck/SPDX checks. diff --git a/docs/07-developers/onboarding-and-standards.md b/docs/07-developers/onboarding-and-standards.md index ef6388e..ee4c2b9 100644 --- a/docs/07-developers/onboarding-and-standards.md +++ b/docs/07-developers/onboarding-and-standards.md @@ -123,9 +123,27 @@ The following rules each come from a real bug and are enforced in review: ### 3.2 Userspace and tools (`userspace/`, `tools/`, `scripts/`) -* C: same style as the kernel module where practical. +* **C: 4-space indentation, ~100 columns** — deliberately *not* the kernel + style. This is the style the existing sources use (`libvgpu.c`, + `rpc_emulator.c`, the test binaries); the per-area configs are + `userspace/.clang-format` and `tools/.clang-format` (LLVM base). Do not + mass-reformat existing files; the config governs new code and hunks you + are already editing. +* C naming and structure: `snake_case` functions and structs + (`gsp_alloc_args`, `rpc_emu_bar_config`), types as `*_t` + (`vgpu_error_t`), `_LIBVGPU_H_`-style include guards, and prototypes in + the matching header with `extern "C"` for the public API. +* C error handling: return the library's status type (`vgpu_error_t`), not + raw `errno`; translate at the syscall boundary (`map_errno`), check every + allocation and return value, and fail closed. No `abort()`/`exit()` in + library code — the caller owns the error. +* Every C/Python/shell source file starts with + `SPDX-License-Identifier: BSD-3-Clause` plus a one-line copyright; + kernel sources use `GPL-2.0` instead. Per-file identifiers govern (see + [`../README.md`](../README.md) §7). * Python/shell: `shellcheck` clean shell, `python3` with no exotic - dependencies; scripts must be re-runnable and idempotent. + dependencies; scripts must be re-runnable and idempotent. Shell scripts + start with `set -e`; operational scripts use the full `set -euo pipefail`. * Tools must live **in-tree** (never in `/tmp`) so they survive reboots and are reviewable. @@ -145,6 +163,34 @@ The following rules each come from a real bug and are enforced in review: offset are 0x100000 too low (the wrong functions) — re-derive any conclusion drawn from them. +### 3.4 Tracked conventions (de facto) + +These are the practices review already expects; they are written down so new +contributors do not have to infer them. + +* **Commit messages**: `<subsystem>: <description>` — an imperative, + lower-case subsystem token (`vgsp`, `vgsp-rm`, `sema`, `guest-diag`, + `scripts`, `tools`, `debug/issue`), then what changed. Cite issues inline + as `(ISSUE-0001)`; the register is + [`../../debug/issue/README.md`](../../debug/issue/README.md). Commit + messages are public: describe behaviour and evidence (same rule as tracked + docs). +* **Document status and change markers**: long-lived deep-dive documents open + with a `> Status: ...` preamble under the H1 and append a + `<!-- change (YYYY-MM-DD): ... -->` comment recording substantive edits — + see + [`../../debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md`](../../debug/risc-v-gsp-rm-vm/docs/00-OVERVIEW.md). +* **Config and firmware layout**: `config/hardware/` holds per-architecture + profiles and `config/versions/` per-driver-version profiles — portability + work is a config change before it is a code change. A versioned firmware + tree is `firmware/<SERIES>-GSP/<MAJOR.MINOR>/` (images fetched by + `install.sh`; analysis artifacts tracked). See + [`../06-portability/hardware-software-matrix.md`](../06-portability/hardware-software-matrix.md). +* **SPDX enforcement point**: the per-file `SPDX-License-Identifier` governs + a file's license regardless of its directory; every new source file must + carry one (BSD-3-Clause for userspace/tools/scripts/docs, GPL-2.0 for + `kernel/**`). + ## 4. Tooling | Tool | Purpose | diff --git a/kernel/.clang-format b/kernel/.clang-format new file mode 100644 index 0000000..a3c3acb --- /dev/null +++ b/kernel/.clang-format @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Linux kernel style for kernel/**: tabs, tab width 8, ~80 columns +# (see docs/07-developers/onboarding-and-standards.md 3.1). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Linux +BreakBeforeTernaryOperators: false +BreakStringLiterals: false +ColumnLimit: 80 +ContinuationIndentWidth: 8 +DerivePointerAlignment: false +IndentCaseBlocks: false +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 +PointerAlignment: Right +ReflowComments: false +SortIncludes: Never +SpaceAfterCStyleCast: false +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: 1 +TabWidth: 8 +UseTab: Always diff --git a/scripts/auto-opencode-setup.sh b/scripts/auto-opencode-setup.sh index 4126d3d..0d54032 100755 --- a/scripts/auto-opencode-setup.sh +++ b/scripts/auto-opencode-setup.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # auto-opencode-setup.sh - Configure auto-opencode session on login # Usage: sudo ./auto-opencode-setup.sh [enable|disable] [graphical|multi-user] [auto-login] diff --git a/scripts/browse-project.py b/scripts/browse-project.py index 72ee46c..fa876ee 100755 --- a/scripts/browse-project.py +++ b/scripts/browse-project.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ browse-project.py -- read-only TUI browser for the Open-IOV tree. diff --git a/scripts/build_nvidia_openrm.sh b/scripts/build_nvidia_openrm.sh index 6772d64..891522e 100755 --- a/scripts/build_nvidia_openrm.sh +++ b/scripts/build_nvidia_openrm.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Build NVIDIA OpenRM kernel modules with Open-IOV vGPU VFIO symbols # This script ensures KBUILD_EXTRA_SYMBOLS is correctly passed to the build diff --git a/scripts/check-docs-links.py b/scripts/check-docs-links.py index fcb39ca..ea5122d 100755 --- a/scripts/check-docs-links.py +++ b/scripts/check-docs-links.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """Check relative links in the project's tracked markdown documentation. Walks docs/, wiki/ and userspace/cuda/, extracts markdown links, and fails if diff --git a/scripts/create_mdev.sh b/scripts/create_mdev.sh index 2a5ad09..8763861 100755 --- a/scripts/create_mdev.sh +++ b/scripts/create_mdev.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # create_mdev.sh - Create NVIDIA vGPU mediated device for QEMU # Usage: ./create_mdev.sh [PCI_ADDRESS] [VGPU_TYPE] diff --git a/scripts/debug_guest_init.sh b/scripts/debug_guest_init.sh index 324f403..9837fe7 100755 --- a/scripts/debug_guest_init.sh +++ b/scripts/debug_guest_init.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # debug_guest_init.sh - One-command debug launch for guest NVIDIA driver initialization # Usage: ./debug_guest_init.sh [options] diff --git a/scripts/launch_qemu_direct.sh b/scripts/launch_qemu_direct.sh index 8ff315f..e7b1199 100755 --- a/scripts/launch_qemu_direct.sh +++ b/scripts/launch_qemu_direct.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # launch_qemu_direct.sh - launch the vGPU VM directly, with a serial # socket, QMP socket and guest agent socket that tools/guest-diag scripts # expect. The mdev UUID is taken from $1 or MDEV_UUID, else the first diff --git a/scripts/launch_qemu_vgpu.sh b/scripts/launch_qemu_vgpu.sh index 2b64f63..ab82a66 100755 --- a/scripts/launch_qemu_vgpu.sh +++ b/scripts/launch_qemu_vgpu.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # launch_qemu_vgpu.sh - Launch QEMU with NVIDIA vGPU mediated device # Usage: ./launch_qemu_vgpu.sh [install|run] [MDEV_UUID] [GUEST_IMAGE] [OPTIONS] diff --git a/scripts/load_vgpu_stack.sh b/scripts/load_vgpu_stack.sh index bce2ec2..d0187f8 100755 --- a/scripts/load_vgpu_stack.sh +++ b/scripts/load_vgpu_stack.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # load_vgpu_stack.sh - Load complete vGPU driver stack # Usage: ./load_vgpu_stack.sh [firmware_name] diff --git a/scripts/qemu_gdb_attach.sh b/scripts/qemu_gdb_attach.sh index 310c196..fb7597f 100644 --- a/scripts/qemu_gdb_attach.sh +++ b/scripts/qemu_gdb_attach.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # qemu_gdb_attach.sh - Launch QEMU with GDB server for guest kernel debugging # Usage: ./qemu_gdb_attach.sh [gdb_port] [freeze_at_start] diff --git a/scripts/setup_guest_driver.sh b/scripts/setup_guest_driver.sh index f4f2757..c23db6f 100755 --- a/scripts/setup_guest_driver.sh +++ b/scripts/setup_guest_driver.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # setup_guest_driver.sh - Setup NVIDIA driver in QEMU guest # Run this INSIDE the guest VM after installation diff --git a/scripts/stack_manager.sh b/scripts/stack_manager.sh index 294a0ee..1a0d2ab 100755 --- a/scripts/stack_manager.sh +++ b/scripts/stack_manager.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # stack_manager.sh - Complete vGPU stack management (load, unload, test, debug) # Usage: ./stack_manager.sh <command> [options] diff --git a/scripts/test_cuda_workloads.sh b/scripts/test_cuda_workloads.sh index ba3663a..55a2076 100755 --- a/scripts/test_cuda_workloads.sh +++ b/scripts/test_cuda_workloads.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # CUDA Workload Validation # Tests various CUDA workloads in the guest diff --git a/scripts/test_graphics_workloads.sh b/scripts/test_graphics_workloads.sh index b3a873a..42777cb 100755 --- a/scripts/test_graphics_workloads.sh +++ b/scripts/test_graphics_workloads.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Graphics Workload Validation # Tests Vulkan/OpenGL/video workloads in the guest diff --git a/scripts/test_gsp_emu.sh b/scripts/test_gsp_emu.sh index 0f80c30..60078aa 100755 --- a/scripts/test_gsp_emu.sh +++ b/scripts/test_gsp_emu.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # GSP Emulation Unit Tests # Runs kernel module tests for GSP emulation engine diff --git a/scripts/test_guest_driver.sh b/scripts/test_guest_driver.sh index f391d64..f9b76c6 100755 --- a/scripts/test_guest_driver.sh +++ b/scripts/test_guest_driver.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Guest Driver Validation Suite # Tests the guest NVIDIA driver with vGPU diff --git a/scripts/test_vgpu_stack.sh b/scripts/test_vgpu_stack.sh index 4df9cdc..ad81606 100755 --- a/scripts/test_vgpu_stack.sh +++ b/scripts/test_vgpu_stack.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Comprehensive Test Suite for Open-IOV vGPU-IO # Runs all validation tests in sequence diff --git a/scripts/test_windows_guest.sh b/scripts/test_windows_guest.sh index 7876bf4..a87e03a 100755 --- a/scripts/test_windows_guest.sh +++ b/scripts/test_windows_guest.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Windows Guest Validation # Tests Windows guest with NVIDIA driver diff --git a/scripts/unload_vgpu_stack.sh b/scripts/unload_vgpu_stack.sh index 1cb484a..58a31b8 100755 --- a/scripts/unload_vgpu_stack.sh +++ b/scripts/unload_vgpu_stack.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # unload_vgpu_stack.sh - Unload vGPU driver stack set -euo pipefail diff --git a/scripts/windows_guest_automation.sh b/scripts/windows_guest_automation.sh index f95471e..78e8045 100755 --- a/scripts/windows_guest_automation.sh +++ b/scripts/windows_guest_automation.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # windows_guest_automation.sh - Windows guest test automation via WinRM/SSH set -euo pipefail diff --git a/tools/.clang-format b/tools/.clang-format new file mode 100644 index 0000000..fa09baa --- /dev/null +++ b/tools/.clang-format @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Tools style: LLVM base, 4-space indent, ~100 columns +# (see docs/07-developers/onboarding-and-standards.md 3.2). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBraces: Attach +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWidth: 4 +PointerAlignment: Right +SortIncludes: Never +TabWidth: 4 +UseTab: Never diff --git a/tools/benchmark_infrastructure.sh b/tools/benchmark_infrastructure.sh index 606aa10..9efe06a 100755 --- a/tools/benchmark_infrastructure.sh +++ b/tools/benchmark_infrastructure.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # benchmark_infrastructure.sh - Benchmark runner for VM vs bare metal comparison set -euo pipefail diff --git a/tools/debug/nv2080_ctrl.c b/tools/debug/nv2080_ctrl.c index 46ade02..fb1b924 100644 --- a/tools/debug/nv2080_ctrl.c +++ b/tools/debug/nv2080_ctrl.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * NV2080 Control Command Sender * C program to send NV2080 RM control commands via ioctl diff --git a/tools/debug/nv2080_ctrl.sh b/tools/debug/nv2080_ctrl.sh index 22c7117..e432120 100755 --- a/tools/debug/nv2080_ctrl.sh +++ b/tools/debug/nv2080_ctrl.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # NV2080 Control Command Tool # Sends NV2080 RM control commands to the NVIDIA kernel module via ioctl # Usage: ./nv2080_ctrl.sh <device_fd> <command> [params...] diff --git a/tools/failure_analyzer.py b/tools/failure_analyzer.py index 11351da..5fd6f67 100644 --- a/tools/failure_analyzer.py +++ b/tools/failure_analyzer.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ failure_analyzer.py - Analyze and classify guest initialization failures Correlates host tracepoints, guest logs, and QEMU state diff --git a/tools/firmware/verify_gsp_firmware.sh b/tools/firmware/verify_gsp_firmware.sh index 79f474c..b5c6427 100755 --- a/tools/firmware/verify_gsp_firmware.sh +++ b/tools/firmware/verify_gsp_firmware.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Verify GSP firmware for TU104 # Usage: ./verify_gsp_firmware.sh diff --git a/tools/ghidra/analyze_fwimage.py b/tools/ghidra/analyze_fwimage.py index 5d98504..6cf8d24 100644 --- a/tools/ghidra/analyze_fwimage.py +++ b/tools/ghidra/analyze_fwimage.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ Analyze GSP firmware .fwimage binary in Ghidra. Usage: python3 analyze_fwimage.py <fwimage_bin> <project_dir> <project_name> diff --git a/tools/ghidra/analyze_gsp_firmware.sh b/tools/ghidra/analyze_gsp_firmware.sh index b2e40d5..bf5d4f6 100755 --- a/tools/ghidra/analyze_gsp_firmware.sh +++ b/tools/ghidra/analyze_gsp_firmware.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Full GSP firmware analysis pipeline # Usage: ./analyze_gsp_firmware.sh <firmware_bin> [output_dir] diff --git a/tools/ghidra/create_gsp_project.py b/tools/ghidra/create_gsp_project.py index 3f505f1..2d9a588 100644 --- a/tools/ghidra/create_gsp_project.py +++ b/tools/ghidra/create_gsp_project.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ Create Ghidra project for GSP firmware analysis. Usage: python3 create_gsp_project.py <firmware_bin> <project_dir> <project_name> diff --git a/tools/ghidra/diff_gsp_firmware.py b/tools/ghidra/diff_gsp_firmware.py index 8145982..f9ddaec 100644 --- a/tools/ghidra/diff_gsp_firmware.py +++ b/tools/ghidra/diff_gsp_firmware.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ Diff two GSP firmware versions. Usage: python3 diff_gsp_firmware.py <old_firmware> <new_firmware> <output_report> diff --git a/tools/ghidra/gsp-fwimage-570.144/scripts/basic_analysis.py b/tools/ghidra/gsp-fwimage-570.144/scripts/basic_analysis.py index 4992106..ad15d1e 100644 --- a/tools/ghidra/gsp-fwimage-570.144/scripts/basic_analysis.py +++ b/tools/ghidra/gsp-fwimage-570.144/scripts/basic_analysis.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Ghidra script to do basic disassembly analysis of GSP .fwimage binary # Usage: analyzeHeadless ... -postScript basic_analysis.py diff --git a/tools/ghidra/gsp-tu104-570.144/scripts/analyze_gsp_fwimage.py b/tools/ghidra/gsp-tu104-570.144/scripts/analyze_gsp_fwimage.py index 4a6fb56..083e01f 100644 --- a/tools/ghidra/gsp-tu104-570.144/scripts/analyze_gsp_fwimage.py +++ b/tools/ghidra/gsp-tu104-570.144/scripts/analyze_gsp_fwimage.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Ghidra script to analyze GSP .fwimage binary # Usage: analyzeHeadless ... -postScript analyze_gsp_fwimage.py diff --git a/tools/ghidra/gsp-tu104-570.144/scripts/basic_analysis.py b/tools/ghidra/gsp-tu104-570.144/scripts/basic_analysis.py index 4992106..ad15d1e 100644 --- a/tools/ghidra/gsp-tu104-570.144/scripts/basic_analysis.py +++ b/tools/ghidra/gsp-tu104-570.144/scripts/basic_analysis.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Ghidra script to do basic disassembly analysis of GSP .fwimage binary # Usage: analyzeHeadless ... -postScript basic_analysis.py diff --git a/tools/ghidra/gsp-tu104-570.144/scripts/extract_fwimage.py b/tools/ghidra/gsp-tu104-570.144/scripts/extract_fwimage.py index d8b0bfd..c9288ed 100644 --- a/tools/ghidra/gsp-tu104-570.144/scripts/extract_fwimage.py +++ b/tools/ghidra/gsp-tu104-570.144/scripts/extract_fwimage.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Ghidra script to extract .fwimage section from GSP firmware ELF # Usage: analyzeHeadless ... -postScript extract_fwimage.py diff --git a/tools/ghidra/gsp-tu104-570.144/scripts/extract_gsp_version.py b/tools/ghidra/gsp-tu104-570.144/scripts/extract_gsp_version.py index ef44d7d..8e577f1 100644 --- a/tools/ghidra/gsp-tu104-570.144/scripts/extract_gsp_version.py +++ b/tools/ghidra/gsp-tu104-570.144/scripts/extract_gsp_version.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Ghidra script to extract version from .fwversion section of GSP binary # Usage: analyzeHeadless ... -postScript extract_gsp_version.py diff --git a/tools/gr-regs/analyze_regs.py b/tools/gr-regs/analyze_regs.py index b03aca4..a8227da 100644 --- a/tools/gr-regs/analyze_regs.py +++ b/tools/gr-regs/analyze_regs.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors import collections, sys path = sys.argv[1] if len(sys.argv) > 1 else '/tmp/opencode/regs-m63.txt' cmp_mode = len(sys.argv) > 2 and sys.argv[2] == 'cmp' diff --git a/tools/gr-regs/reg_sampler.py b/tools/gr-regs/reg_sampler.py index 24c8296..8ed765e 100644 --- a/tools/gr-regs/reg_sampler.py +++ b/tools/gr-regs/reg_sampler.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # reg_sampler.py - read-only BAR0 register sampler for GR/FECS/SKED ground truth. # # Purpose diff --git a/tools/guest-diag/bp999.py b/tools/guest-diag/bp999.py index ff7a23f..2729aac 100644 --- a/tools/guest-diag/bp999.py +++ b/tools/guest-diag/bp999.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: break on the libcuda instructions that produce CUDA errors # 719 (0x2cf) and 999 (0x3e7), then print the stack that led there and the # error record the scanner reads (FUN_0054fa00 walks ctx[0x1291] -> +0x10 -> diff --git a/tools/guest-diag/bp999v2.py b/tools/guest-diag/bp999v2.py index 766bc3b..3bd9cd9 100644 --- a/tools/guest-diag/bp999v2.py +++ b/tools/guest-diag/bp999v2.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: break at the 999/719 RETURN sites of the libcuda scanner # FUN_0054fa00 and dump the record values the scanner actually read (they are # still in its stack locals, so the host clearing the notification afterwards diff --git a/tools/guest-diag/bpwait.py b/tools/guest-diag/bpwait.py index 9b708c8..d44fd32 100644 --- a/tools/guest-diag/bpwait.py +++ b/tools/guest-diag/bpwait.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: catch the tracker-gate exit with a NONZERO dispatcher status and # dump the wait-entry array the gate polls. This names the wait that ends the # client's context-init spin (the value that becomes the CUDA error). diff --git a/tools/guest-diag/bpz.py b/tools/guest-diag/bpz.py index 53d46a6..b61579a 100644 --- a/tools/guest-diag/bpz.py +++ b/tools/guest-diag/bpz.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: name the silent-rollback 999 site in the cuCtxCreate path. # # Sites (file vaddr of libcuda.so.570.144; runtime = base + off): diff --git a/tools/guest-diag/bpz10.py b/tools/guest-diag/bpz10.py index 30aa1da..7766103 100644 --- a/tools/guest-diag/bpz10.py +++ b/tools/guest-diag/bpz10.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: name the first failing call inside FUN_003e90c0 (ucode-image # create, second half) after FUN_003d1e70 (blob parse) succeeded. # diff --git a/tools/guest-diag/bpz11.py b/tools/guest-diag/bpz11.py index 601a73d..2fb5c02 100644 --- a/tools/guest-diag/bpz11.py +++ b/tools/guest-diag/bpz11.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: split FUN_00391ee0 (ucode-image registration, file 0x291ee0). # # PART 76 + bpz10 run: FUN_003e90c0's failing call is FUN_00391ee0, which diff --git a/tools/guest-diag/bpz12.py b/tools/guest-diag/bpz12.py index 3a5767c..d4b4d8e 100644 --- a/tools/guest-diag/bpz12.py +++ b/tools/guest-diag/bpz12.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: split FUN_00386b90 (ucode image section callback, file # 0x286b90) - bpz11 showed FUN_00386020 returned 1 from this callback. # diff --git a/tools/guest-diag/bpz13.py b/tools/guest-diag/bpz13.py index 6f2aa8f..3096f30 100644 --- a/tools/guest-diag/bpz13.py +++ b/tools/guest-diag/bpz13.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: dump FUN_003e35f0 args at the call from FUN_00e0e970 (file # 0xd0e970 -> call site 0xd0eb65, caller return 0xd0eb6a). # diff --git a/tools/guest-diag/bpz14.py b/tools/guest-diag/bpz14.py index 24302c9..b960676 100644 --- a/tools/guest-diag/bpz14.py +++ b/tools/guest-diag/bpz14.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: dump the device-object TPC/SM count fields in the guest at the # FUN_003e3e80 call from FUN_00e0e970 (caller return 0xd0eae1). # diff --git a/tools/guest-diag/bpz16.py b/tools/guest-diag/bpz16.py index c67175d..48b4a53 100644 --- a/tools/guest-diag/bpz16.py +++ b/tools/guest-diag/bpz16.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: probe the guest's chip-info vtable call (ds->[0x4d38]) and the # 0xc48/0xc4c fields at the FUN_003e3e80 call from FUN_00e0e970. # diff --git a/tools/guest-diag/bpz18.py b/tools/guest-diag/bpz18.py index ed82084..7e955cd 100644 --- a/tools/guest-diag/bpz18.py +++ b/tools/guest-diag/bpz18.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: trace the path through FUN_0042aec0 (GPU arch/config init) in # the guest, launched as `gdb --args /tmp/cdt` so early device-init code is # caught. diff --git a/tools/guest-diag/bpz19.py b/tools/guest-diag/bpz19.py index 9dfed68..82a9bd3 100644 --- a/tools/guest-diag/bpz19.py +++ b/tools/guest-diag/bpz19.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: trace the path through FUN_0042aec0 (GPU arch/config init) by # attaching to a running cdt at the CDT_PAUSE (bpz18 variant). # diff --git a/tools/guest-diag/bpz2.py b/tools/guest-diag/bpz2.py index 2d399ff..1058de5 100644 --- a/tools/guest-diag/bpz2.py +++ b/tools/guest-diag/bpz2.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: capture the post-pump failure call in FUN_00374240 (ctx init). # # From the previous run: the engine event pump FUN_0031a3b0 returned 0 diff --git a/tools/guest-diag/bpz20.py b/tools/guest-diag/bpz20.py index cf8ee8c..d90bc20 100644 --- a/tools/guest-diag/bpz20.py +++ b/tools/guest-diag/bpz20.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: catch the write that ZEROES ds+0xe94 after the CASE1 body set # it to 0x18. Run via run_cycle.sh gdb-launch (device init happens during # cuInit, before the CDT_PAUSE). diff --git a/tools/guest-diag/bpz21.py b/tools/guest-diag/bpz21.py index f9809a7..f56b066 100644 --- a/tools/guest-diag/bpz21.py +++ b/tools/guest-diag/bpz21.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: dump param_2[] at FUN_00337e60 entry when called from # FUN_00550ff0 (file 0x450ff0). bpz20 showed FUN_00550ff0 -> FUN_00337e60 # overwrites ds+0xe94 with param_2[0x23]; on the host that is 0x18 (24 TPC). diff --git a/tools/guest-diag/bpz3.py b/tools/guest-diag/bpz3.py index ae90f86..4528622 100644 --- a/tools/guest-diag/bpz3.py +++ b/tools/guest-diag/bpz3.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: find the exact site that sets r14d=999 in FUN_00374240. # # Run #2 showed every post-pump call site up to 0x2755bf returning 0, then diff --git a/tools/guest-diag/bpz4.py b/tools/guest-diag/bpz4.py index eca9618..69cb2b0 100644 --- a/tools/guest-diag/bpz4.py +++ b/tools/guest-diag/bpz4.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: identify the vtable slot that returns 999 in ctx bring-up. # # Run #3 found the failing store at file 0x275cec: the indirect call at diff --git a/tools/guest-diag/bpz5.py b/tools/guest-diag/bpz5.py index 568b2f2..d47968e 100644 --- a/tools/guest-diag/bpz5.py +++ b/tools/guest-diag/bpz5.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: identify WHICH engine-setup hook returns 999. # # Run #4 named the target: file 0x4d1fa0 (the +0x4580 table slot) — an engine diff --git a/tools/guest-diag/bpz6.py b/tools/guest-diag/bpz6.py index 7742da2..c515878 100644 --- a/tools/guest-diag/bpz6.py +++ b/tools/guest-diag/bpz6.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: at the membar-WAR hook failure, read the device arch/impl and # test the FUN_0035a4d0(0x13, arch, rev) descriptor lookup in-process. # diff --git a/tools/guest-diag/bpz7.py b/tools/guest-diag/bpz7.py index 2294298..02f29ed 100644 --- a/tools/guest-diag/bpz7.py +++ b/tools/guest-diag/bpz7.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: split the membar-WAR hook failure into lookup vs ucode-load. # # The remap table at file 0x3dc5b80 maps (chip=7,rev=5)->(7,0) (real Turing diff --git a/tools/guest-diag/bpz8.py b/tools/guest-diag/bpz8.py index e0567e5..c44b028 100644 --- a/tools/guest-diag/bpz8.py +++ b/tools/guest-diag/bpz8.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: localize the ucode-image load failure inside FUN_00e21850. # # Run #7: in the membar-WAR hook the descriptor lookup FUN_0035a4d0(0x13,7,5) diff --git a/tools/guest-diag/bpz9.py b/tools/guest-diag/bpz9.py index 06c5d96..bbed25f 100644 --- a/tools/guest-diag/bpz9.py +++ b/tools/guest-diag/bpz9.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: split the failing ucode image create (FUN_003e99d0). # # Run #9: FUN_00e21850 -> FUN_003e99d0 returned 1 for the membar-WAR blob. diff --git a/tools/guest-diag/bridge_sems.sh b/tools/guest-diag/bridge_sems.sh index a024524..fee71ca 100755 --- a/tools/guest-diag/bridge_sems.sh +++ b/tools/guest-diag/bridge_sems.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # bridge_sems.sh - bridge the guest's own page table view into the host service. # # The emulation cannot (yet) translate the CUDA client's sysmem semaphores diff --git a/tools/guest-diag/ctx999.py b/tools/guest-diag/ctx999.py index e5472c8..b99e455 100644 --- a/tools/guest-diag/ctx999.py +++ b/tools/guest-diag/ctx999.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: catch where a hanging/failing cuCtxCreate goes. # # Arms the libcuda 999-scanner sites (FUN_0054fa00 entry/999/0x2cf returns) diff --git a/tools/guest-diag/cuda_cycle.sh b/tools/guest-diag/cuda_cycle.sh index cc333fb..fed6e98 100755 --- a/tools/guest-diag/cuda_cycle.sh +++ b/tools/guest-diag/cuda_cycle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # cuda_cycle.sh - one full CUDA bring-up attempt: restart the VM, push the # guest tools, start cdt holding on failure, wait for the 20 GR channels, # register/pin the completion counters, and arm the RM-error scanner so the diff --git a/tools/guest-diag/cycle_cdt.sh b/tools/guest-diag/cycle_cdt.sh index 3aaa723..9fc5b69 100755 --- a/tools/guest-diag/cycle_cdt.sh +++ b/tools/guest-diag/cycle_cdt.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # cycle_cdt.sh - full test cycle: push tools, start cdt, inject the libcuda # tracker page mapping when the tracker wait is reached, poke UVM's tracker # when it stalls, and report where cdt ends up. diff --git a/tools/guest-diag/dbg_seq.sh b/tools/guest-diag/dbg_seq.sh index 247bc91..e222d3c 100755 --- a/tools/guest-diag/dbg_seq.sh +++ b/tools/guest-diag/dbg_seq.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors /tmp/ptio /tmp/cdt > /dev/null 2>/tmp/tr.log n=$(grep -n 'req=0x25' /tmp/tr.log | head -1 | cut -d: -f1) echo "marker line: $n" diff --git a/tools/guest-diag/dbg_seq2.sh b/tools/guest-diag/dbg_seq2.sh index 8710fd9..28290eb 100755 --- a/tools/guest-diag/dbg_seq2.sh +++ b/tools/guest-diag/dbg_seq2.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors /tmp/ptio /tmp/cdt > /dev/null 2>/tmp/tr.log n=$(grep -n 'req=0x25' /tmp/tr.log | head -1 | cut -d: -f1) echo "=== controls AFTER register (line $n), first 40: ===" diff --git a/tools/guest-diag/dumpctx.py b/tools/guest-diag/dumpctx.py index 983997e..4f433a3 100644 --- a/tools/guest-diag/dumpctx.py +++ b/tools/guest-diag/dumpctx.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script (run with: sudo gdb -p <pid> -batch -x /tmp/dumpctx.py) # Dumps the libcuda client wait-loop context: the ctx object's queue/entry # array (ctx+0x10 = count, ctx+0x18 = array of 0x28-byte entries) plus each diff --git a/tools/guest-diag/gdb_now.sh b/tools/guest-diag/gdb_now.sh index b58fe3d..4aa394e 100644 --- a/tools/guest-diag/gdb_now.sh +++ b/tools/guest-diag/gdb_now.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb_now.sh <pid> - attach gdb once immediately (root), dump all threads, # detach, CONT. Used when the host has seen the final RM control, so the # attach is timed to the post-control window instead of state sampling. diff --git a/tools/guest-diag/guest_engines.c b/tools/guest-diag/guest_engines.c index 10209e2..e04de76 100644 --- a/tools/guest-diag/guest_engines.c +++ b/tools/guest-diag/guest_engines.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* guest_engines.c - query the guest client RM for the data UVM's register * path depends on: virtualization mode, subdevice count, ENGINE LIST, * CLASS LIST, CE caps and CE->PCE masks. Uses the NVOS64 serialized alloc diff --git a/tools/guest-diag/guest_kprobes.sh b/tools/guest-diag/guest_kprobes.sh index d3db7b3..58c539a 100644 --- a/tools/guest-diag/guest_kprobes.sh +++ b/tools/guest-diag/guest_kprobes.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # guest_kprobes.sh - (re)install the UVM trace probes used by semfix_watch.py. # Runs in the guest as root; kprobes do not survive a guest boot, so this must # run after every VM restart. diff --git a/tools/guest-diag/guest_pin_stream.py b/tools/guest-diag/guest_pin_stream.py index 581dc9d..6c22e62 100644 --- a/tools/guest-diag/guest_pin_stream.py +++ b/tools/guest-diag/guest_pin_stream.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # guest_pin_stream.py - stream the CUDA client's push-buffer VA->PA pairs to # the host over vsock, continuously and without the guest agent on the hot # path. Runs in the guest as root (pagemap reads). diff --git a/tools/guest-diag/guest_pmap.py b/tools/guest-diag/guest_pmap.py index 96b7ddc..e2622c4 100644 --- a/tools/guest-diag/guest_pmap.py +++ b/tools/guest-diag/guest_pmap.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # guest-side helper: translate GPU/user VAs of a process through its pagemap. # Usage: sudo python3 guest_pmap.py <pid> <hex-va> [hex-va ...] import os diff --git a/tools/guest-diag/guest_pmap_all.py b/tools/guest-diag/guest_pmap_all.py index 1a4df34..a1766c1 100644 --- a/tools/guest-diag/guest_pmap_all.py +++ b/tools/guest-diag/guest_pmap_all.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # guest-side helper: dump present pages of the target's /dev/nvidia* mappings # as "va,pa" lines (root in the guest), starting at or above va-min and # stopping after max-pairs lines so the guest agent's output stays small. diff --git a/tools/guest-diag/guest_pmap_win.py b/tools/guest-diag/guest_pmap_win.py index 501e7bc..8732859 100644 --- a/tools/guest-diag/guest_pmap_win.py +++ b/tools/guest-diag/guest_pmap_win.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # guest_pmap_win.py - dump present pages of a process's VA range through the # guest's own pagemap (root in the guest). Batched reads (512 entries per # pread) so a 256 MB window takes about a second, not minutes. diff --git a/tools/guest-diag/inject_counters.sh b/tools/guest-diag/inject_counters.sh index 5ee60fd..5bec72a 100755 --- a/tools/guest-diag/inject_counters.sh +++ b/tools/guest-diag/inject_counters.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # inject_counters.sh - register the running CUDA client's per-channel GPU # completion counters with the host sema service (the PART 45/46 manual # procedure, made durable). The host then tracks each GR channel's consumed diff --git a/tools/guest-diag/inject_maps.sh b/tools/guest-diag/inject_maps.sh index 6dcabb5..3f018db 100755 --- a/tools/guest-diag/inject_maps.sh +++ b/tools/guest-diag/inject_maps.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # inject_maps.sh - while cdt runs, collect pushbuffer/ring VAs from the host # dmesg (sema-chan entry logs) plus channel GPFIFO ring VAs, translate them # through the guest's own pagemap, and inject the VA->PA pairs into the diff --git a/tools/guest-diag/inject_tracker.sh b/tools/guest-diag/inject_tracker.sh index 0a292e4..5438a6d 100755 --- a/tools/guest-diag/inject_tracker.sh +++ b/tools/guest-diag/inject_tracker.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # inject_tracker.sh - find the libcuda tracker slot the stuck cdt is polling, # translate its page through the guest pagemap, pin the mapping in the service. set -u diff --git a/tools/guest-diag/invd.py b/tools/guest-diag/invd.py index 313daa3..5838947 100644 --- a/tools/guest-diag/invd.py +++ b/tools/guest-diag/invd.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: read the device arch/impl and test the membar-WAR descriptor # lookup (FUN_0035a4d0) live on the parked cdt. # diff --git a/tools/guest-diag/ioctl_trace.c b/tools/guest-diag/ioctl_trace.c index 661636f..4835b10 100644 --- a/tools/guest-diag/ioctl_trace.c +++ b/tools/guest-diag/ioctl_trace.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* ioctl_trace.c - log the NVIDIA driver ioctls of a child process. * * libcuda issues raw syscall instructions, so LD_PRELOAD/ltrace never see diff --git a/tools/guest-diag/kret.sh b/tools/guest-diag/kret.sh index 9ed1220..ba374f8 100755 --- a/tools/guest-diag/kret.sh +++ b/tools/guest-diag/kret.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # kret.sh - kretprobe the nvGpuOps* call chain in the guest's nvidia.ko and # capture return values while /tmp/cdt runs. Run with sudo. set -u diff --git a/tools/guest-diag/kretprobes.sh b/tools/guest-diag/kretprobes.sh index a5357db..4945c51 100644 --- a/tools/guest-diag/kretprobes.sh +++ b/tools/guest-diag/kretprobes.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # kretprobes.sh - return-value probes for the UVM API entry points, so the # failing UVM operation names itself in the trace tail. TR=/sys/kernel/tracing diff --git a/tools/guest-diag/launch_qemu_rootport.sh b/tools/guest-diag/launch_qemu_rootport.sh index 1ddcb92..d7ef097 100755 --- a/tools/guest-diag/launch_qemu_rootport.sh +++ b/tools/guest-diag/launch_qemu_rootport.sh @@ -1,2 +1,4 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors exec /bin/qemu-system-x86_64 -D /home/rmcore/.local/libvf.io/logs/qemu/e726ba0b-204f-4ec9-91da-983ed7f41d06-session.txt -no-hpet -mem-prealloc -qmp unix:/tmp/qemu-qmp.sock,server,nowait -chardev socket,path=/tmp/qemu-guest-agent.sock,server=on,wait=off,id=qga0 -device virtio-serial-pci -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -serial file:/tmp/vgpu-guest-serial.log -gdb tcp::1234 -display none -device ivshmem-plain,id=shmem0,memdev=ivshmem_kvmfr -object memory-backend-file,id=ivshmem_kvmfr,mem-path=/dev/shm/kvmfr-e726ba0b-204f-4ec9-91da-983ed7f41d06,size=128M,share=yes -device ivshmem-plain,id=shmem1,memdev=ivshmem_kvmsr -object memory-backend-file,id=ivshmem_kvmsr,mem-path=/dev/shm/kvmsr-e726ba0b-204f-4ec9-91da-983ed7f41d06,size=2M,share=yes -object memory-backend-file,id=pc.ram,size=4096M,mem-path=/dev/shm/vgpu-guest-ram,share=yes,prealloc=on -uuid e726ba0b-204f-4ec9-91da-983ed7f41d06 -machine pc-q35-4.2,accel=kvm,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram -cpu host,ss=on,vmx=on,pcid=on,hypervisor=on,arat=on,tsc-adjust=on,umip=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaveopt=on,pdpe1gb=on,ibpb=on,amd-stibp=on,amd-ssbd=on,skip-l1dfl-vmentry=on,pschange-mc-no=on,hv-vapic,hv_time,hv-spinlocks=0x1fff,hv-vendor-id=null,kvm=on,topoext=on -rtc clock=host,base=localtime -m 4096 -smp cores=4,threads=1,sockets=1 -hda /home/rmcore/.local/libvf.io/kernel/linux.qcow2 --enable-kvm -device pcie-root-port,id=rp0,chassis=1,slot=30,bus=pcie.0 -device vfio-pci,id=hostdev0,bus=rp0,sysfsdev=/sys/bus/mdev/devices/<MDEV-UUID>,display=off -device rtl8139,netdev=net0 -netdev user,id=net0 -net user,hostfwd=tcp::2222-:22 -net nic -device vhost-vsock-pci,guest-cid=50718 -qmp unix:/tmp/sockets/e726ba0b-204f-4ec9-91da-983ed7f41d06/main.sock,server,nowait -qmp unix:/tmp/sockets/e726ba0b-204f-4ec9-91da-983ed7f41d06/master.sock,server,nowait diff --git a/tools/guest-diag/memprobe.py b/tools/guest-diag/memprobe.py index c2bab9f..f246476 100644 --- a/tools/guest-diag/memprobe.py +++ b/tools/guest-diag/memprobe.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # memprobe.py - read/write another process's memory through /proc/<pid>/mem # (root only, no gdb/ptrace attach needed). # diff --git a/tools/guest-diag/nmi_catch.sh b/tools/guest-diag/nmi_catch.sh index 3afa895..af46a23 100644 --- a/tools/guest-diag/nmi_catch.sh +++ b/tools/guest-diag/nmi_catch.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # nmi_catch.sh [rounds] [sleep] - trigger sysrq-l NMI backtraces and append a # compact summary of the nvidia frames seen in each round (guest side, root). # diff --git a/tools/guest-diag/oneshot_gdb.sh b/tools/guest-diag/oneshot_gdb.sh index 9161ee4..c272acc 100644 --- a/tools/guest-diag/oneshot_gdb.sh +++ b/tools/guest-diag/oneshot_gdb.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # oneshot_gdb.sh <pid> - catch the client's USERSPACE spin (state R and # /proc/<pid>/syscall == "running"; a kernel busy-wait shows its syscall # number). Fires gdb ONCE, dumps all threads, detaches, CONTs. diff --git a/tools/guest-diag/pdwatch_cycle.sh b/tools/guest-diag/pdwatch_cycle.sh index fe758fd..d1cbe41 100755 --- a/tools/guest-diag/pdwatch_cycle.sh +++ b/tools/guest-diag/pdwatch_cycle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pdwatch_cycle.sh - TASK 2: watch every write landing in the root PD pages # 0x200000..0x204000 (and the 0x208000 table) through a full cdt2 run, with # the walk state sampled during the CP park and after completion. diff --git a/tools/guest-diag/peek.c b/tools/guest-diag/peek.c index 857afd0..7c959ec 100644 --- a/tools/guest-diag/peek.c +++ b/tools/guest-diag/peek.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* peek.c - print RIP/RBX/RSP/RDI of every thread of a process (root). usage: peek PID [lo_off hi_off] (offsets from the libcuda r-xp base) Flags threads whose RIP is inside [base+lo, base+hi) with SPIN. */ diff --git a/tools/guest-diag/phys_claim_cycle.sh b/tools/guest-diag/phys_claim_cycle.sh index e89fbfc..6ce7cff 100755 --- a/tools/guest-diag/phys_claim_cycle.sh +++ b/tools/guest-diag/phys_claim_cycle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # phys_claim_cycle.sh - supervised physical-GPU claim/release cycle harness. # # Drives one or more full "D0 pre-lock" cycles of the physical-ownership diff --git a/tools/guest-diag/pin_client_sems.sh b/tools/guest-diag/pin_client_sems.sh index af39fd1..9d5cdac 100755 --- a/tools/guest-diag/pin_client_sems.sh +++ b/tools/guest-diag/pin_client_sems.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pin_client_sems.sh - bridge the CUDA client's device mappings into the # emulation for the live cdt process. # diff --git a/tools/guest-diag/pin_gr_stream.py b/tools/guest-diag/pin_gr_stream.py index 7f8e4b8..aba3912 100644 --- a/tools/guest-diag/pin_gr_stream.py +++ b/tools/guest-diag/pin_gr_stream.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pin_gr_stream.py - pin the CUDA client's GR push-buffer pages from a vsock # stream produced by guest_pin_stream.py (guest truth via /proc/<pid>/pagemap). # diff --git a/tools/guest-diag/pin_gr_window.py b/tools/guest-diag/pin_gr_window.py index 71f73d0..194ac9d 100644 --- a/tools/guest-diag/pin_gr_window.py +++ b/tools/guest-diag/pin_gr_window.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pin_gr_window.py - pin the CUDA client's GR push-buffer pages from guest # truth, per boot (host-side dev tool, no guest changes beyond the helper). # diff --git a/tools/guest-diag/pin_miss_pages.sh b/tools/guest-diag/pin_miss_pages.sh index fd7722a..34786ac 100755 --- a/tools/guest-diag/pin_miss_pages.sh +++ b/tools/guest-diag/pin_miss_pages.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pin_miss_pages.sh - adaptive tracker-sem pinner. # # Watches the host journal for "release miss va=0x..." lines, resolves those diff --git a/tools/guest-diag/pin_sem_fast.sh b/tools/guest-diag/pin_sem_fast.sh index 16cecc4..c4493f3 100755 --- a/tools/guest-diag/pin_sem_fast.sh +++ b/tools/guest-diag/pin_sem_fast.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pin_sem_fast.sh - low-latency tracker-sem pinner (2 s poll vs 15 s). # # Pins the client tracker-sem page (0x20400f000, covers 0x20400fec0..ff70) diff --git a/tools/guest-diag/pmap_va.sh b/tools/guest-diag/pmap_va.sh index e5bcef4..dbe91df 100755 --- a/tools/guest-diag/pmap_va.sh +++ b/tools/guest-diag/pmap_va.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # pmap_va.sh <pid|name> <hex-va> [hex-va ...] # Push guest_pmap.py to the running VM and translate the VAs of the named # process through the guest's own pagemap (root in the guest). diff --git a/tools/guest-diag/ptrace_ioctl.c b/tools/guest-diag/ptrace_ioctl.c index 5f96b31..1762d4c 100644 --- a/tools/guest-diag/ptrace_ioctl.c +++ b/tools/guest-diag/ptrace_ioctl.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* ptrace_ioctl.c - follow a child with PTRACE_SYSCALL and dump the buffer * results of selected UVM ioctls. Needed because libcuda issues raw syscall * instructions (LD_PRELOAD/ltrace never see these). diff --git a/tools/guest-diag/push_guest_tools.sh b/tools/guest-diag/push_guest_tools.sh index 9a45fd3..f19f30d 100755 --- a/tools/guest-diag/push_guest_tools.sh +++ b/tools/guest-diag/push_guest_tools.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # push_guest_tools.sh - (re)build the guest-side diagnostic binaries from the # sources kept in this directory. The guest's /tmp is wiped on boot, so run # this after every VM start; the sources here are the persistent copies. diff --git a/tools/guest-diag/read_va.py b/tools/guest-diag/read_va.py index fca3994..ef65672 100755 --- a/tools/guest-diag/read_va.py +++ b/tools/guest-diag/read_va.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # read_va.py - dump a guest process's memory at a VA (GPU VAs of UVM sysmem # objects are usually also valid CPU VAs in the owning process). # diff --git a/tools/guest-diag/rmq_probe.c b/tools/guest-diag/rmq_probe.c index 7554309..8acf1c3 100644 --- a/tools/guest-diag/rmq_probe.c +++ b/tools/guest-diag/rmq_probe.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rmq_probe.c - minimal legacy-ioctl RM client to read device controls: * 0x800289 NV0080_CTRL_CMD_GPU_GET_VIRTUALIZATION_MODE * 0x800280 NV0080_CTRL_CMD_GPU_GET_NUM_SUBDEVICES diff --git a/tools/guest-diag/run_cycle.sh b/tools/guest-diag/run_cycle.sh index 28ea18d..53ebf52 100755 --- a/tools/guest-diag/run_cycle.sh +++ b/tools/guest-diag/run_cycle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # run_cycle.sh - one instrumented CUDA bring-up cycle with full capture. # # Recipe (PART 70 + PART 71): restart VM/module, push tools, install kprobes diff --git a/tools/guest-diag/run_traced.sh b/tools/guest-diag/run_traced.sh index 009e20b..cb7228c 100755 --- a/tools/guest-diag/run_traced.sh +++ b/tools/guest-diag/run_traced.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # run_traced.sh - run cdt under the ioctl tracer, keep the libcuda tracker page # mapped (pagemap + sema_map_add) and poke UVM's tracking semaphore forward as # the sweep completes pushes, so the run reaches the rc=999 rollback where the diff --git a/tools/guest-diag/scan.c b/tools/guest-diag/scan.c index d229dc8..1608ba0 100644 --- a/tools/guest-diag/scan.c +++ b/tools/guest-diag/scan.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* scan.c - find the libcuda tracker objects in a process without ptrace. Tracker layout (object p): p+0x9418 submitted, p+0x9420 completed, p+0x9428 mirror, p+0x9430 sem object; sem object +0x10 -> sem VA (a diff --git a/tools/guest-diag/scan2.c b/tools/guest-diag/scan2.c index 6220038..dfc1ae7 100644 --- a/tools/guest-diag/scan2.c +++ b/tools/guest-diag/scan2.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* scan2.c - find qwords whose value points into a /dev/nvidia* mapping of the target process, and report the u32 stored there (semaphore hunt). usage: scan2 PID [max_print] */ diff --git a/tools/guest-diag/scan3.c b/tools/guest-diag/scan3.c index 94f6a42..2683e89 100644 --- a/tools/guest-diag/scan3.c +++ b/tools/guest-diag/scan3.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* scan3.c - scan all writable memory of a process for qwords equal to any of the given 64-bit needles; print every hit address. usage: scan3 PID 0xNEEDLE [0xNEEDLE ...] */ diff --git a/tools/guest-diag/scanerr.py b/tools/guest-diag/scanerr.py index 96c4170..cca649b 100755 --- a/tools/guest-diag/scanerr.py +++ b/tools/guest-diag/scanerr.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script: at the libcuda error-scanner entry (FUN_0054fa00), walk the # context list and dump every non-zero RM error record (magic words, # errorClass at +0x8, shorts at +0xc/+0xe). The scanner is called often with diff --git a/tools/guest-diag/sem_counters.py b/tools/guest-diag/sem_counters.py index 66af258..94a01f4 100755 --- a/tools/guest-diag/sem_counters.py +++ b/tools/guest-diag/sem_counters.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # sem_counters.py - enumerate a guest process's per-channel GPU completion # counters (the u32 slots the client polls to observe push completion). # diff --git a/tools/guest-diag/sem_slots.py b/tools/guest-diag/sem_slots.py index 70d184c..f405771 100755 --- a/tools/guest-diag/sem_slots.py +++ b/tools/guest-diag/sem_slots.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # sem_slots.py - read or write the per-channel u32 completion counters of a # guest process (verification and fallback for the host's counter publish). # diff --git a/tools/guest-diag/semfix_uvmt.py b/tools/guest-diag/semfix_uvmt.py index ba4f4f7..cf54445 100755 --- a/tools/guest-diag/semfix_uvmt.py +++ b/tools/guest-diag/semfix_uvmt.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # semfix_uvmt.py - single-QMP tracking-semaphore/resolution watcher. # # One QMP client does everything semfix_watch.py and uvmt_poll.py did, because diff --git a/tools/guest-diag/semfix_watch.py b/tools/guest-diag/semfix_watch.py index 0a2a6fb..049a612 100644 --- a/tools/guest-diag/semfix_watch.py +++ b/tools/guest-diag/semfix_watch.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # semfix_watch.py - keep UVM VA->PA translations fresh from guest truth # (host-side dev tool, no guest changes). # diff --git a/tools/guest-diag/sempages.py b/tools/guest-diag/sempages.py index f8d15b2..f74edb1 100755 --- a/tools/guest-diag/sempages.py +++ b/tools/guest-diag/sempages.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Print the distinct pages of the semaphore VAs a process references # (reuses memprobe.py's scanner; run in the guest as root). The VA window is # derived from the process's /dev/nvidia* mappings unless lo/hi are given. diff --git a/tools/guest-diag/stack_sampler.sh b/tools/guest-diag/stack_sampler.sh index f210422..af6f57d 100755 --- a/tools/guest-diag/stack_sampler.sh +++ b/tools/guest-diag/stack_sampler.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # stack_sampler.sh - per-thread kernel stack sampler for the CUDA client. # # The client's failing wait is not always visible in strace: libcuda runs diff --git a/tools/guest-diag/state_log.sh b/tools/guest-diag/state_log.sh index de3d6ed..aa5f0f6 100644 --- a/tools/guest-diag/state_log.sh +++ b/tools/guest-diag/state_log.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # state_log.sh <pid> - 200ms sampler of state/syscall/wchan for the whole run. PID="$1" : > /tmp/state.log diff --git a/tools/guest-diag/sysc_shim.c b/tools/guest-diag/sysc_shim.c index 9b07e4c..e2ab6f0 100644 --- a/tools/guest-diag/sysc_shim.c +++ b/tools/guest-diag/sysc_shim.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* sysc_shim.c - intercept syscall() so we can dump ioctl buffer *results* * for UVM ioctls (libcuda calls syscall(SYS_ioctl, ...) directly, so an * ioctl() wrapper is bypassed but syscall() is not). diff --git a/tools/guest-diag/track_waits.sh b/tools/guest-diag/track_waits.sh index 54c4905..50d67c1 100644 --- a/tools/guest-diag/track_waits.sh +++ b/tools/guest-diag/track_waits.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # track_waits.sh - guest-side wait sampler: while a CUDA client (cdt) runs, # repeatedly dump the per-channel completion counters (values), the tracker # wait entries (trkinfo.py, every 2nd pass) and the push pages the host could diff --git a/tools/guest-diag/trkinfo.py b/tools/guest-diag/trkinfo.py index 0d6d629..0b4498f 100644 --- a/tools/guest-diag/trkinfo.py +++ b/tools/guest-diag/trkinfo.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # gdb script (run with: sudo gdb -p <pid> -batch -x /tmp/trkinfo.py) # Drills into the libcuda tracker wait: dumps every wait entry, the tracker # objects they reference (channel/context layout at p+0x9410 with the sem diff --git a/tools/guest-diag/uvm_rmmem_probe.sh b/tools/guest-diag/uvm_rmmem_probe.sh index 15ad73f..9778689 100755 --- a/tools/guest-diag/uvm_rmmem_probe.sh +++ b/tools/guest-diag/uvm_rmmem_probe.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # uvm_rmmem_probe.sh - guest-side kprobe that dumps every UVM rm_mem mapping # as it is used: {type, CPU VA, GPU0 VA, GPU1 VA, size} for each call to # uvm_rm_mem_get_cpu_va. This is the ground truth for VA -> physical diff --git a/tools/guest-diag/uvmprobe.sh b/tools/guest-diag/uvmprobe.sh index de7293c..fd26c63 100644 --- a/tools/guest-diag/uvmprobe.sh +++ b/tools/guest-diag/uvmprobe.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # uvmprobe.sh - guest-side: probe UVM's external-range/map API return statuses # while cdt runs, and capture UVM's own debug-print output. nvidia-modprobe -c 0 diff --git a/tools/guest-diag/uvmt_poll.py b/tools/guest-diag/uvmt_poll.py index d145e6c..668435a 100644 --- a/tools/guest-diag/uvmt_poll.py +++ b/tools/guest-diag/uvmt_poll.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # uvmt_poll.py - poll the live state of the tracking semaphores the CUDA # client spins on, from the guest trace kptrs, via QMP (no guest agent # besides the trace read). Prints the payload word the client actually diff --git a/tools/guest-diag/uvmwait.sh b/tools/guest-diag/uvmwait.sh index 06b2dc7..cb1fe69 100644 --- a/tools/guest-diag/uvmwait.sh +++ b/tools/guest-diag/uvmwait.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # uvmwait.sh - guest-side: run cdt with UVM debug prints on, and snapshot the # UVM tracker-wait messages early (before any teardown floods dmesg). nvidia-modprobe -c 0 diff --git a/tools/guest-diag/vmcycle.sh b/tools/guest-diag/vmcycle.sh index d3dcbec..8177300 100755 --- a/tools/guest-diag/vmcycle.sh +++ b/tools/guest-diag/vmcycle.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # vmcycle.sh - reload cycle for the emulated vGPU stack: # stop QEMU -> remove mdevs -> rmmod/insmod vgsp.ko -> create a # fresh mdev -> patch its UUID into the runtime launch script -> relaunch. diff --git a/tools/guest-diag/vmrestart.sh b/tools/guest-diag/vmrestart.sh index f94521c..62402ba 100755 --- a/tools/guest-diag/vmrestart.sh +++ b/tools/guest-diag/vmrestart.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # vmrestart.sh - stop QEMU, reload vgsp.ko from the tree, fresh mdev, # relaunch the vGPU VM. Everything bounded so a stuck step cannot hang the # caller. diff --git a/tools/guest-diag/watch_ctx.sh b/tools/guest-diag/watch_ctx.sh index 0968571..0af95ca 100644 --- a/tools/guest-diag/watch_ctx.sh +++ b/tools/guest-diag/watch_ctx.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # watch_ctx.sh - guest-side watcher: (re)start cdt, snapshot the ioctl stream # (fd paths), attach gdb to the libcuda wait as soon as cuCtxCreate is reached # and POKE the per-entry trackers (p+0x9410+0x10/0x18 = 1) to test whether that diff --git a/tools/guest_agent/guest_test_agent.py b/tools/guest_agent/guest_test_agent.py index 15a578d..b659af1 100644 --- a/tools/guest_agent/guest_test_agent.py +++ b/tools/guest_agent/guest_test_agent.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ guest_test_agent.py - Runs inside guest VM, executes tests, reports results Communication via vsock, serial, or HTTP diff --git a/tools/guest_init_monitor.py b/tools/guest_init_monitor.py index bc34a08..eb40e41 100644 --- a/tools/guest_init_monitor.py +++ b/tools/guest_init_monitor.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors """ guest_init_monitor.py - Monitor guest kernel initialization for NVIDIA driver Correlates host tracepoints with guest dmesg/serial output diff --git a/tools/module_ops/dry_run.sh b/tools/module_ops/dry_run.sh index e6bb6f2..5ac6934 100755 --- a/tools/module_ops/dry_run.sh +++ b/tools/module_ops/dry_run.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Run vGPU dry-run validation # Usage: sudo ./dry_run.sh diff --git a/tools/module_ops/load_converged.sh b/tools/module_ops/load_converged.sh index dbd090e..e83fcde 100755 --- a/tools/module_ops/load_converged.sh +++ b/tools/module_ops/load_converged.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Load vGPU stack in converged mode # Usage: sudo ./load_converged.sh [dry_run] diff --git a/tools/module_ops/unload_all.sh b/tools/module_ops/unload_all.sh index 4c73a0b..6ceadea 100755 --- a/tools/module_ops/unload_all.sh +++ b/tools/module_ops/unload_all.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Unload all vGPU modules cleanly # Usage: sudo ./unload_all.sh diff --git a/tools/rmq/grctx_oracle.c b/tools/rmq/grctx_oracle.c index a2fc5fa..aa4bd2d 100644 --- a/tools/rmq/grctx_oracle.c +++ b/tools/rmq/grctx_oracle.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* grctx_oracle - query the host NVIDIA RM for the engine context buffer sizes. * * Goal: recover the table that GSP-RM serves for diff --git a/tools/rmq/kmod/wpr2_reset_kmod.c b/tools/rmq/kmod/wpr2_reset_kmod.c index 523fac7..1e46960 100644 --- a/tools/rmq/kmod/wpr2_reset_kmod.c +++ b/tools/rmq/kmod/wpr2_reset_kmod.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* wpr2_reset_kmod - kernel module that clears GPU WPR2 registers via BAR0 ioremap. * * When nvidia.ko is unloaded without a clean GSP teardown, GSP firmware stays diff --git a/tools/rmq/rmq.c b/tools/rmq/rmq.c index 189d647..f179dbb 100644 --- a/tools/rmq/rmq.c +++ b/tools/rmq/rmq.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rmq - query host NVIDIA RM via /dev/nvidia0 ioctls (oracle for TU104 static data) */ #include <stdio.h> #include <stdlib.h> diff --git a/tools/rmq/wpr2_reset.c b/tools/rmq/wpr2_reset.c index 4435843..41e102f 100644 --- a/tools/rmq/wpr2_reset.c +++ b/tools/rmq/wpr2_reset.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* wpr2_reset - clear GPU WPR2 registers via BAR0 MMIO to unstick GSP boot. * * When nvidia.ko is unloaded, GSP firmware can remain resident in WPR2 diff --git a/tools/rmtool/include/rm_api.h b/tools/rmtool/include/rm_api.h index 5d7f8cf..8358597 100644 --- a/tools/rmtool/include/rm_api.h +++ b/tools/rmtool/include/rm_api.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rm_api.h - minimal self-contained NVIDIA RM userspace client. * * ABI and control IDs mirror the NV570 SDK (nvos.h, ctrl2080*.h) but the diff --git a/tools/rmtool/include/rmtool.h b/tools/rmtool/include/rmtool.h index 55166f8..76dd583 100644 --- a/tools/rmtool/include/rmtool.h +++ b/tools/rmtool/include/rmtool.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rmtool.h - internal shared declarations for rmtool commands and output. */ #ifndef RMTOOL_H #define RMTOOL_H diff --git a/tools/rmtool/src/engine.c b/tools/rmtool/src/engine.c index c247e47..283856c 100644 --- a/tools/rmtool/src/engine.c +++ b/tools/rmtool/src/engine.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* engine.c - rmtool engine list/info via read-only GPU/engine controls. */ #include <getopt.h> #include <stdio.h> diff --git a/tools/rmtool/src/gpu.c b/tools/rmtool/src/gpu.c index ff9b26c..7db1353 100644 --- a/tools/rmtool/src/gpu.c +++ b/tools/rmtool/src/gpu.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* gpu.c - rmtool gpu list/topology/info: enumeration and identity queries. */ #include <getopt.h> #include <stdio.h> diff --git a/tools/rmtool/src/main.c b/tools/rmtool/src/main.c index 4e4b440..79a34bb 100644 --- a/tools/rmtool/src/main.c +++ b/tools/rmtool/src/main.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* main.c - rmtool entry point: command dispatch and global help/version. * * rmtool is a read-only host RM oracle for the Open-IOV accuracy loop. It diff --git a/tools/rmtool/src/mem.c b/tools/rmtool/src/mem.c index a85bd70..52a3e5a 100644 --- a/tools/rmtool/src/mem.c +++ b/tools/rmtool/src/mem.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* mem.c - rmtool mem stats: read-only FB/heap/BAR1 information. * * Allocation, mapping, pinning and arbitrary-handle inspection are diff --git a/tools/rmtool/src/nv2080.c b/tools/rmtool/src/nv2080.c index 5dd808e..0cf1cf1 100644 --- a/tools/rmtool/src/nv2080.c +++ b/tools/rmtool/src/nv2080.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* nv2080.c - rmtool nv2080 class list / method call and sample. * * The generic control entry point is restricted to a read-only allowlist so diff --git a/tools/rmtool/src/output.c b/tools/rmtool/src/output.c index 6de5d02..289256c 100644 --- a/tools/rmtool/src/output.c +++ b/tools/rmtool/src/output.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* output.c - table/JSON/CSV formatting helpers shared by rmtool commands. */ #include <ctype.h> #include <stdio.h> diff --git a/tools/rmtool/src/query.c b/tools/rmtool/src/query.c index c9a7460..37cf3f8 100644 --- a/tools/rmtool/src/query.c +++ b/tools/rmtool/src/query.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* query.c - shared read-only RM queries used by rmtool and rmtop. */ #include <stdio.h> #include <stdlib.h> diff --git a/tools/rmtool/src/rm_api.c b/tools/rmtool/src/rm_api.c index 17fb48b..fd459cd 100644 --- a/tools/rmtool/src/rm_api.c +++ b/tools/rmtool/src/rm_api.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rm_api.c - RM ioctl client, GPU discovery and control plumbing. * * The ioctl ladder (root -> device -> subdevice) and NV_ESC_RM_CONTROL diff --git a/tools/rmtop/include/rmtop.h b/tools/rmtop/include/rmtop.h index 9335e89..0b55187 100644 --- a/tools/rmtop/include/rmtop.h +++ b/tools/rmtop/include/rmtop.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* rmtop.h - state and rendering declarations for the rmtop dashboard. */ #ifndef RMTOP_H #define RMTOP_H diff --git a/tools/rmtop/src/main.c b/tools/rmtop/src/main.c index b7985df..67ea4eb 100644 --- a/tools/rmtop/src/main.c +++ b/tools/rmtop/src/main.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* main.c - rmtop: ncurses real-time read-only GPU dashboard. * * Interactive mode needs a terminal; --once renders the same panels as plain diff --git a/tools/rmtop/src/panel.c b/tools/rmtop/src/panel.c index 9ad5ac8..63f21f1 100644 --- a/tools/rmtop/src/panel.c +++ b/tools/rmtop/src/panel.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* panel.c - rmtop sampling (read-only RM + /proc) and plain rendering. */ #include <stdio.h> #include <stdlib.h> diff --git a/tools/test/cuda_drv_test.c b/tools/test/cuda_drv_test.c index 9501cb3..9c2bd21 100644 --- a/tools/test/cuda_drv_test.c +++ b/tools/test/cuda_drv_test.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* cuda_drv_test.c - minimal CUDA driver-API smoke test (dlopen, no toolkit). * * Run inside the guest. Exercises the paths CUDA needs beyond NVML: diff --git a/tools/test/cuda_drv_test2.c b/tools/test/cuda_drv_test2.c index a3d3190..6d37f72 100644 --- a/tools/test/cuda_drv_test2.c +++ b/tools/test/cuda_drv_test2.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* cuda_drv_test2.c - minimal CUDA driver-API smoke test (dlopen, no toolkit) * with copy-path pause points for live inspection. * diff --git a/tools/test/gpage_test.c b/tools/test/gpage_test.c index 33d0c8d..1ad2212 100644 --- a/tools/test/gpage_test.c +++ b/tools/test/gpage_test.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* gpage_test.c - guest-page GPA probe for the physical-backend guest-memory path. * * Run as root inside the guest (plain gcc on Ubuntu 24.04, no CUDA). diff --git a/tools/test/run_integration_tests.sh b/tools/test/run_integration_tests.sh index 06e309c..5f97898 100755 --- a/tools/test/run_integration_tests.sh +++ b/tools/test/run_integration_tests.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # GSP vGPU-IO Integration Test Runner set -e diff --git a/tools/vm/launch_vgpu_qemu.sh b/tools/vm/launch_vgpu_qemu.sh index 0355ef1..818f0bb 100755 --- a/tools/vm/launch_vgpu_qemu.sh +++ b/tools/vm/launch_vgpu_qemu.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # QEMU launch script for NVIDIA vGPU testing # This script assumes: # 1. nvidia-vgpu-vfio.ko is loaded on host (with dry_run=1 for testing) diff --git a/tools/vm/setup_mdev.sh b/tools/vm/setup_mdev.sh index ef31f46..22bd943 100755 --- a/tools/vm/setup_mdev.sh +++ b/tools/vm/setup_mdev.sh @@ -1,4 +1,6 @@ #!/bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2026 Open-IOV contributors # Setup script for NVIDIA vGPU mdev device # This script creates an mdev device for QEMU testing diff --git a/userspace/.clang-format b/userspace/.clang-format new file mode 100644 index 0000000..e331ac6 --- /dev/null +++ b/userspace/.clang-format @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Userspace library style: LLVM base, 4-space indent, ~100 columns +# (see docs/07-developers/onboarding-and-standards.md 3.2). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBraces: Attach +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWidth: 4 +PointerAlignment: Right +SortIncludes: Never +TabWidth: 4 +UseTab: Never diff --git a/userspace/examples/example_vgpu.c b/userspace/examples/example_vgpu.c index ede6873..735f0b3 100644 --- a/userspace/examples/example_vgpu.c +++ b/userspace/examples/example_vgpu.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Example Application * Demonstrates basic VF creation, memory allocation, and BAR configuration diff --git a/userspace/include/libvgpu.h b/userspace/include/libvgpu.h index 7f6505b..33fbfb5 100644 --- a/userspace/include/libvgpu.h +++ b/userspace/include/libvgpu.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Userspace Library (libvgpu) * Simple C API for VF management and GPU operations diff --git a/userspace/lib/libvgpu.c b/userspace/lib/libvgpu.c index a25a228..bd27610 100644 --- a/userspace/lib/libvgpu.c +++ b/userspace/lib/libvgpu.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Userspace Library Implementation */ diff --git a/userspace/lib/rpc_emulator.c b/userspace/lib/rpc_emulator.c index 9f7f2c7..3a74b9c 100644 --- a/userspace/lib/rpc_emulator.c +++ b/userspace/lib/rpc_emulator.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Userspace RPC Emulator * diff --git a/userspace/lib/rpc_emulator.h b/userspace/lib/rpc_emulator.h index 1b641bf..35cb76e 100644 --- a/userspace/lib/rpc_emulator.h +++ b/userspace/lib/rpc_emulator.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Userspace RPC Emulator - Header */ diff --git a/userspace/tests/test_guest_init.c b/userspace/tests/test_guest_init.c index 135c16f..4148da6 100644 --- a/userspace/tests/test_guest_init.c +++ b/userspace/tests/test_guest_init.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * Test for guest vGPU driver initialization * This test verifies that the guest vGPU driver can initialize properly diff --git a/userspace/tests/test_host_init.c b/userspace/tests/test_host_init.c index a08fe33..aa3ddbb 100644 --- a/userspace/tests/test_host_init.c +++ b/userspace/tests/test_host_init.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * Test for host vGPU initialization */ diff --git a/userspace/tests/test_vgpu_userspace.c b/userspace/tests/test_vgpu_userspace.c index cd22111..5858dbe 100644 --- a/userspace/tests/test_vgpu_userspace.c +++ b/userspace/tests/test_vgpu_userspace.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright (c) 2026 Open-IOV contributors */ /* * GSP vGPU-IO Userspace Test * Tests VFIO interface and driver functionality from userspace |
