### Basic verification example Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/verify-cli.md Example output after a successful installation and cold reboot. ```bash cd /workspace/home/cmpunlocker sudo ./verify.sh # BDF PCI ID Variant Expect Actual Status # 0000:04:00.0 20c2 8gb ~65536 65536 MiB OK # ... "All 1 unlockable GPU(s) report unlocked memory" # (service.sh verify prints GEN2 OK rows) ``` -------------------------------- ### Example: prepare command Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example output of the prepare command, showing the steps of checking unlocked memory and binding to vfio-pci, with a note about installing a stock NVIDIA driver in the guest. ```bash sudo ./tools/passthrough.sh prepare 0000:04:00.0 # Step 1/2: Checking the cards are unlocked # ✓ 0000:04:00.0: 65536 MiB unlocked # ... 0000:04:00.0 -> vfio-pci # In the guest, install only a stock NVIDIA driver — nothing from cmpunlocker. ``` -------------------------------- ### Basic install with defaults Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/install-cli.md Runs the installer with all defaults on a single-card 8GB system. The output shows the inventory line and the completion message, followed by the recommended next steps. ```bash cd /workspace/home/cmpunlocker sudo ./install.sh # -> Inventory: 1 unlockable (1× 8gb, 0× 10gb) # -> ... "cmpunlocker install finished!" # Next: sudo shutdown -h now ; sudo ./verify.sh ``` -------------------------------- ### Library usage example Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/common-lib.md A comprehensive example demonstrating logging, step tracking, bus ID normalization, device profile lookup, and error handling. ```bash source "$(dirname "$0")/common/lib.sh" banner step_init 2 step "Inventory" # Step 1/2: Inventory for bdf in 0000:04:00.0 04:00.0 beef:04:00.0; do echo "normalized: $(normalize_bus_id "$bdf")" done # normalized: 0000:04:00.0 (domain already 4 hex digits -> %04x keeps it) # normalized: 0000:04:00.0 (2-digit bus -> domain 0000 prepended) # normalized: beef:04:00.0 (domain %04x: minimum 4 digits, no padding needed) # note: anything not matching one of the two shapes is echoed back unchanged, # e.g. normalize_bus_id "garbage" -> "garbage" devid=20c2 echo "profile: $(profile_from_devid "$devid")" # 8gb echo "expect: $(expected_mib_for_profile 8gb) MiB" # 65536 SMI_MEM_CACHE="0000:04:00.0, 8192" echo "current: $(smi_memory_for_bus 0000:04:00.0) MiB" # 8192 (comma-separated cache) step "Done" [[ "${EUID}" -eq 0 ]] || die "Run as root" # exits 1 with ✗ Run as root on stderr ``` -------------------------------- ### Typical installation workflow Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/index.md Standard sequence of commands for system administrators to install, reboot, verify, and remove the driver modifications. ```bash sudo ./install.sh # detect, patch, build, install, arm services sudo shutdown -h now # cold reboot required sudo ./verify.sh # confirm unlock + Gen2 sudo ./remove.sh --yes # full uninstall, restores stock modules ``` -------------------------------- ### Run passthrough-setup.sh with sudo and CMPUNLOCKER_KVER Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md This command runs the passthrough setup script with root privileges, setting the kernel version to the current running kernel. It is the example of what install.sh does. ```bash sudo CMPUNLOCKER_KVER="$(uname -r)" ./tools/passthrough-setup.sh ``` -------------------------------- ### Install cmpunlocker Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/docs/INSTALLATION.md Run the installer script with sudo. Requires root access and the listed prerequisites. ```bash sudo ./install.sh ``` -------------------------------- ### Install Gen2 service Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-gen2.md Installs the Gen2 service. Requires root, install, lspci, setpci, tools/hammer.sh, and systemd/gen2.service. Must find at least one supported GPU (10de:20c2|10de:2082) and the patched module must exist and contain the marker 'CMP Gen2:'. The service is enabled but not started in the current session. ```bash sudo ./tools/service.sh install # == Status == Gen2 service; 'Installed NVIDIA module contains the Gen2 probe-retrain patch' # Enabled gen2.service for the next boot # (service is not started now; the active desktop PCIe link was not touched) ``` -------------------------------- ### install.sh CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Run the installation script with optional profile and configuration flags. Note that --profile flags are ignored if the GPU inventory is mixed. ```bash sudo ./install.sh [--profile=8gb|10gb] [--no-iommu] [--no-gen2-service] [--no-passthrough] ``` -------------------------------- ### Example: status command Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example output of the status command, showing per-BDF table with driver, reset method, and memory, plus confirmation that cmp_no_bus_reset is loaded. ```bash sudo ./tools/passthrough.sh status # BDF DRIVER RESET_METHOD MEMORY # 0000:04:00.0 nvidia [ ] 65536 MiB # ✓ cmp_no_bus_reset loaded (bus reset blocked) ``` -------------------------------- ### Example: restore command Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example output of the restore command, showing the recovery process for a card with a stuck ACR stamp after a killed VM, including reset and re-arming. ```bash sudo ./tools/passthrough.sh restore 0000:04:00.0 # ☠ gsp-restore: write protected once set -> the card needs a reset # Step 2/4: Allowing a reset so the stuck stamp can be cleared # ... 0000:04:00.0: released # ✓ re-armed for the next VM ``` -------------------------------- ### Using custom inventory file Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/verify-cli.md Example of the script output when using a pre-defined inventory file instead of lspci enumeration. ```bash # /lib/modules/$(uname -r)/updates/cmpunlocker/gpu_inventory contains: # 0000:04:00.0 20c2 8gb 65536 sudo ./verify.sh # Using inventory: /lib/modules/6.8.0-31-generic/updates/cmpunlocker/gpu_inventory ``` -------------------------------- ### Direct invocation of driver/build.sh with environment variables Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/driver-build.md Run the build script directly with the required environment variables, emulating what install.sh does. On success it prints 'Build and install finished. Verify with: nvidia-smi' and exits 0; on precondition/build failure it exits 1. If modules build but the running driver cannot be swapped, it warns and suggests a reboot while still exiting 0. ```bash cd /workspace/home/cmpunlocker sudo env \ CMPUNLOCKER_DRIVER_VERSION=615.78.08 \ CMPUNLOCKER_CARD_PROFILE=10gb \ CMPUNLOCKER_GPU_INVENTORY="0000:04:00.0 2082 10gb 40960" \ driver/build.sh # [INFO] Applying memory profile 10gb (40GB geometry)... # [ OK ] Wrote gpu_inventory (1 GPU(s)) ``` -------------------------------- ### Force memory profile during installation Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/docs/INSTALLATION.md Use the --profile option to select the memory profile. 8GB card unlocks 64GB, 10GB card unlocks 40GB. ```bash sudo ./install.sh --profile=8gb # 8GB card → 64GB unlock ``` ```bash sudo ./install.sh --profile=10gb # 10GB card → 40GB unlock ``` -------------------------------- ### Show GSP boot registers Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example of running gsp-restore in 'show' mode to display current register values and their status. Output lines show register name, current value, and whether it is ok or needs restore. ```bash /usr/local/lib/cmpunlocker/gsp-restore show 0000:04:00.0 # 0x001180F8 bsi_secure_scratch_14 = 0x00000000 (ok) # 0x001FA824 wpr2_addr_lo = 0x1FFFFE00 (ok) # 0x001FA828 wpr2_addr_hi = 0x00000000 (ok) ``` -------------------------------- ### Restore GSP boot registers (clean state) Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example of running gsp-restore in 'restore' mode when the boot state is already clean. The command exits with status 0. ```bash /usr/local/lib/cmpunlocker/gsp-restore restore 0000:04:00.0 # cmpunlocker: 0000:04:00.0 GSP boot state already clean # [$? == 0] ``` -------------------------------- ### Inspect passthrough-arm service status and logs Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Commands to check the status and boot logs of the cmpunlocker-passthrough service, with example log lines showing successful reset_method clearing, persistence mode off, and bus reset blocking. ```bash systemctl status cmpunlocker-passthrough.service --no-pager journalctl -u cmpunlocker-passthrough.service -b | tail # cmpunlocker-passthrough: 0000:04:00.0: reset_method cleared # cmpunlocker-passthrough: 0000:04:00.0: persistence mode off # cmpunlocker-passthrough: bus reset blocked on 1 card(s): 0000:04:00.0 ``` -------------------------------- ### Failure case for locked memory Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/verify-cli.md Example output when the script detects locked memory, resulting in an exit status of 1. ```bash sudo ./verify.sh # ✗ 0000:04:00.0: still stock 8192 MiB (expect ~65536) # ... # ✗ 1 GPU(s) failed unlock verification. Cold reboot if modules were just installed. # [exit 1] ``` -------------------------------- ### Restore GSP boot registers (stuck stamp) Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Example of running gsp-restore in 'restore' mode when a register is write-protected, causing exit status 1. The output explains the cause and provides a recovery command. ```bash sudo /usr/local/lib/cmpunlocker/gsp-restore restore 0000:04:00.0 # cmpunlocker: 0000:04:00.0 cannot clear bsi_secure_scratch_14 - it is write protected once set. # cmpunlocker: this happens when a VM was killed instead of shut down. # cmpunlocker: the next VM will not see the GPU until you run: # cmpunlocker: sudo ./tools/passthrough.sh restore 0000:04:00.0 # [$? == 1] ``` -------------------------------- ### passthrough.sh prepare Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Validates each GPU, runs the arming helper, binds each card to vfio-pci, and runs gsp-restore restore per card. ```APIDOC ## [CLI] passthrough.sh prepare ### Description Validates each GPU, runs the arming helper, binds each card to vfio-pci, and runs gsp-restore restore per card. ### Method CLI ### Endpoint sudo ./tools/passthrough.sh prepare [...] ### Parameters #### Path Parameters - **pci-address** (string) - Required - Full PCI address (e.g., 0000:04:00.0) ### Response #### Success Response - **BDF** (string) - PCI address - **MEMORY** (string) - Memory in MiB from nvidia-smi #### Response Example ``` # Step 1/2: Checking the cards are unlocked # ✓ 0000:04:00.0: 65536 MiB unlocked # ... 0000:04:00.0 -> vfio-pci # In the guest, install only a stock NVIDIA driver — nothing from cmpunlocker. ``` ``` -------------------------------- ### install.sh usage signature Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/install-cli.md The full usage block from install.sh lines 24-26, showing the script's command-line options: --profile, --no-iommu, --no-gen2-service, and --no-passthrough. Requires root. ```bash #!/bin/bash set -euo pipefail Usage: sudo ./install.sh [--profile=8gb|10gb] [--no-iommu] [--no-gen2-service] [--no-passthrough] ``` -------------------------------- ### driver/build.sh full signature Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/driver-build.md Full signature of the driver/build.sh script. It is run by install.sh step 5, but can be invoked directly as root. No CLI arguments are read; configuration is entirely via environment variables. ```bash #!/bin/bash set -euo pipefail sudo driver/build.sh ``` -------------------------------- ### Basic usage of read-constants.py Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Shows the command to run read-constants.py with the required arguments and the expected output constants. ```bash cd /workspace/home/cmpunlocker python3 tools/read-constants.py common/constants.yaml driver/patches driver/build.sh 8gb # CFG1='0x02779000' # LMR='0x0000020B' # FB_BYTES='0x0000001000000000' # UNLOCK_LABEL='64GB' # SKIP_GEOMETRY_REWRITE='0' # PROFILE_STOCK_MIB='8192' # PROFILE_UNLOCKED_MIB='65536' # CONSTANTS_UNLOCK_COUNT='17' ``` -------------------------------- ### Verify Gen2 service after reboot Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-gen2.md Verifies that all supported GPUs are negotiated at Gen2 or better. Requires root. Prints per-GPU status and runs nvidia-smi. Exits 1 if any GPU is still at Gen1. ```bash sudo ./tools/service.sh verify # GPU Upstream LnkSta Current speed Width Result # 0000:04:00.0 0000:00:02.0 0x0042 5.0 GT/s PCIe 2.0 x16 GEN2 OK # ✓ All supported GPUs are negotiated at Gen2 or better ``` -------------------------------- ### Sourcing the library Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/common-lib.md Include the library in your script using the source command. The path should be relative to the script location or the project root. ```bash source "${SCRIPT_DIR}/common/lib.sh" # or from tools/: source "${PROJECT_DIR}/common/lib.sh" ``` -------------------------------- ### Repository layout Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/index.md Overview of the project directory structure, including scripts, configuration files, and driver components. ```text common/constants.yaml Profile/unlock/passthrough data contract (validated at build time) common/lib.sh Shared sourced functions (colors, logging, bus-id helpers) install.sh Main installer (root) remove.sh Uninstaller (root, needs --yes) verify.sh Post-install verification (root) driver/VERSION Supported nvidia-open versions driver/build.sh Patched-module build pipeline (standalone, env-driven) driver/patches/*.patch 14 patches against open-gpu-kernel-modules driver/passthrough/ cmp_no_bus_reset kernel module + Makefile systemd/gen2.service Early-boot PCIe Gen2 retrain unit tools/service.sh gen2.service install/remove/verify/status tools/hammer.sh The retrain loop executed by gen2.service tools/passthrough*.sh VFIO passthrough lifecycle helpers tools/gsp-restore.py GSP boot-register restore helper (also installed to /usr/local/lib/cmpunlocker/gsp-restore) tools/read-constants.py constants.yaml ↔ patches ↔ build.sh consistency validator tools/retrain.sh Legacy one-shot retrain (superseded by hammer.sh) tests/ pytest suite (syntax, shellcheck, patch application, module build) ``` -------------------------------- ### Verification commands Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/passthrough-module.md Checks that the module is loaded and that the reset_method file is empty, indicating the device reset is blocked. ```bash cat /proc/modules | grep cmp_no_bus_reset # loaded ls /sys/bus/pci/devices/0000:04:00.0/reset_method # empty (device reset blocked) ``` -------------------------------- ### Run gen2-hammer (hammer.sh) as root Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-gen2.md Executes the early-boot retrain loop. Requires root privileges. Logs progress and success/failure to /var/log/gen2.log. The output shows typical log lines including the final return code. ```bash sudo /usr/local/sbin/gen2-hammer # [2026-07-18T05:00:03+00:00] early retrain started (attempts=600, interval=0.05s) # [2026-07-18T05:00:03+00:00] 0000:04:00.0: start via upstream 0000:00:02.0; initial Gen1; target Gen2 # [2026-07-18T05:00:03+00:00] 0000:04:00.0: SUCCESS Gen2 at iteration 7; LnkSta=0x0042; LnkCap2=0x23 # [2026-07-18T05:00:03+00:00] early retrain finished (rc=0) ``` -------------------------------- ### gsp-restore CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Shows the command-line syntax for gsp-restore, with modes 'show' and 'restore' and a PCI address argument. The default mode is 'restore'. ```text gsp-restore [show|restore] # default mode: restore ``` -------------------------------- ### Full signature of verify.sh Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/verify-cli.md The standard way to execute the verification script with root privileges. ```bash #!/bin/bash set -euo pipefail sudo ./verify.sh ``` -------------------------------- ### systemd/gen2.service unit file Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-gen2.md Systemd unit that runs `/usr/local/sbin/gen2-hammer` as a oneshot service early in boot (before `basic.target`). It has a 45-second timeout and is conditionally skipped if the hammer binary is absent. ```ini [Unit] Description=CMP 170HX early-boot PCIe Gen2 retrain DefaultDependencies=no After=sysinit.target Before=basic.target multi-user.target graphical.target ConditionPathExists=/usr/local/sbin/gen2-hammer [Service] Type=oneshot ExecStart=/usr/local/sbin/gen2-hammer TimeoutStartSec=45 RemainAfterExit=no [Install] WantedBy=sysinit.target ``` -------------------------------- ### gsp-restore.py CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Run the GSP restore utility. The default mode is restore if no mode is specified. ```python gsp-restore [show|restore] # default mode: restore ``` -------------------------------- ### verify.sh CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Run the verification script. This script takes no options and reads the inventory or lspci. ```bash sudo ./verify.sh # no options; reads inventory or lspci ``` -------------------------------- ### tools/passthrough.sh CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Manage GPU passthrough settings for specific PCI addresses. Addresses must be provided in full format, such as 0000:04:00.0. ```bash sudo tools/passthrough.sh status [...] sudo tools/passthrough.sh prepare [...] sudo tools/passthrough.sh restore [...] ``` -------------------------------- ### CLI signature for passthrough.sh Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Shows the usage syntax for the passthrough CLI. Requires root privileges and full PCI addresses. ```bash sudo ./tools/passthrough.sh status [...] sudo ./tools/passthrough.sh prepare [...] sudo ./tools/passthrough.sh restore [...] ``` -------------------------------- ### tools/service.sh CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Manage the service state using the service.sh tool with one of the specified commands. ```bash sudo tools/service.sh install | remove | verify | status ``` -------------------------------- ### Force profile and skip IOMMU Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/install-cli.md Forces the 10GB profile and skips IOMMU changes. Use this when the system has multiple cards of the same variant. ```bash sudo ./install.sh --profile=10gb --no-iommu ``` -------------------------------- ### read-constants.py CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Run the constants reader script with the required configuration files and profile parameters. ```python read-constants.py ``` -------------------------------- ### Build commands for cmp_no_bus_reset module Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/passthrough-module.md Build the kernel module with make, specifying the kernel version via KVER. The clean target removes build artifacts. ```bash make -C driver/passthrough KVER="$(uname -r)" # produces cmp_no_bus_reset.ko make -C driver/passthrough KVER="$(uname -r)" clean ``` -------------------------------- ### Forced Gen2 modprobe option Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-gen2.md Line written by `install.sh` to `/etc/modprobe.d/cmp-pcie-gen2.conf` to force the patched `nvidia.ko` to negotiate Gen2 once loaded. ```text options nvidia NVreg_RegistryDwords="RmForceEnableGen2=1;RMPcieLinkSpeed=0x1" ``` -------------------------------- ### Eval pattern used by driver/build.sh:78-80 Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Shows how the build script captures the output of read-constants.py and evaluates it as environment variables. ```bash CONSTANTS_ENV="$(python3 tools/read-constants.py \ common/constants.yaml driver/patches driver/build.sh 8gb)" \ || die "common/constants.yaml rejected (see error above)" eval "${CONSTANTS_ENV}" echo "$CFG1 $LMR $FB_BYTES $UNLOCK_LABEL" # 0x02779000 0x0000020B 0x0000001000000000 64GB ``` -------------------------------- ### Full removal with --yes Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/remove-cli.md Full removal with confirmed intent. Prints step lines and the final message, and saves a log file with a timestamp. ```bash sudo ./remove.sh --yes # ✗/✓ step lines; "cmpunlocker has been removed from system." # Log saved to: logs/remove_20260718_120000.log ``` -------------------------------- ### Uninstall cmpunlocker Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/docs/INSTALLATION.md Run the removal script with the --yes flag to uninstall. ```bash sudo ./remove.sh --yes ``` -------------------------------- ### Module metadata macros Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/passthrough-module.md Declares the module license and description. Required for GPL compliance and identification. ```c MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Block secondary bus reset on CMP 170HX for VFIO passthrough"); ``` -------------------------------- ### Manual load for two cards Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/passthrough-module.md Loads the module with two PCI addresses. The dmesg output confirms the flag is set for each device. ```bash sudo modprobe cmp_no_bus_reset devs=0000:04:00.0,0000:05:00.0 # dmesg: # pci 0000:04:00.0: cmp_no_bus_reset: NO_BUS_RESET set # pci 0000:05:00.0: cmp_no_bus_reset: NO_BUS_RESET set ``` -------------------------------- ### Verify-what-happens gate (non --yes) Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/remove-cli.md Running remove.sh without the --yes or -y argument prints the removal plan and the instruction to run with --yes, then exits with status 1. ```bash cd /workspace/home/cmpunlocker sudo ./remove.sh # prints the removal plan and: # Run: sudo ./remove.sh --yes # [exit 1] ``` -------------------------------- ### Error handling for missing requirements Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/install-cli.md Shows the error output when required prerequisites are missing. The script exits with status 1 early. ```bash sudo ./install.sh # ✗ Could not detect an installed NVIDIA driver. Install nvidia-open 615.78.08... first. # [$? == 1] ``` -------------------------------- ### Profile ignored on mixed inventory Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/install-cli.md Attempts to force the 8GB profile on a host with both variants present. The --profile flag is ignored and a warning is issued, leaving the inventory as "mixed". ```bash sudo ./install.sh --profile=8gb # mixed inventory -> warning, stays "mixed" ``` -------------------------------- ### CLI invocation: python3 tools/read-constants.py Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Run the validator with the required arguments: constants.yaml, patch-dir, build.sh, and profile. On success prints one shell assignment per line to stdout and exits 0; on inconsistency prints `error: …` to stderr and exits 1. ```bash python3 tools/read-constants.py ``` -------------------------------- ### passthrough.sh restore Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Runs gsp-restore restore per card. If any card reports a stuck ACR version stamp, performs a reset and rebinds to nvidia. ```APIDOC ## [CLI] passthrough.sh restore ### Description Runs gsp-restore restore per card. If any card reports a stuck ACR version stamp, performs a reset and rebinds to nvidia. ### Method CLI ### Endpoint sudo ./tools/passthrough.sh restore [...] ### Parameters #### Path Parameters - **pci-address** (string) - Required - Full PCI address (e.g., 0000:04:00.0) ### Response #### Success Response - **BDF** (string) - PCI address - **STATUS** (string) - Status of the restore operation #### Response Example ``` # ☠ gsp-restore: write protected once set -> the card needs a reset # Step 2/4: Allowing a reset so the stuck stamp can be cleared # ... 0000:04:00.0: released # ✓ re-armed for the next VM ``` ``` -------------------------------- ### remove.sh CLI usage Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/configuration.md Run the removal script. The --yes or -y flag is required; any other first argument will print usage and exit with status 1. ```bash sudo ./remove.sh --yes # or -y; any other first argument prints usage and exits 1 ``` -------------------------------- ### Error handling with invalid address Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/passthrough-module.md Shows the failure when an invalid address is provided. The load aborts with -EINVAL and modprobe reports an error. ```bash sudo modprobe cmp_no_bus_reset devs=banana # dmesg: cmp_no_bus_reset: bad address banana # modprobe: ERROR: could not insert 'cmp_no_bus_reset': Invalid argument # [$? == 1] ``` -------------------------------- ### Error handling for unknown profile Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Shows the error message when an unknown profile is passed to read-constants.py. ```bash python3 tools/read-constants.py common/constants.yaml driver/patches driver/build.sh bogus # error: unknown profile 'bogus'; constants.yaml defines 10gb, 8gb, mixed ``` -------------------------------- ### udev rule for automatic gsp-restore Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md A udev rule that triggers gsp-restore when a PCI device with vendor 0x10de and device 0x20c2 is bound to vfio-pci. ```text ACTION=="bind", SUBSYSTEM=="pci", DRIVER=="vfio-pci", ATTR{vendor}=="0x10de", ATTR{device}=="0x20c2", RUN+="/usr/local/lib/cmpunlocker/gsp-restore %k" ``` -------------------------------- ### passthrough.sh status Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-passthrough.md Displays the status of CMP 170HX GPUs, including bound driver, reset method, and memory. With no BDFs, auto-discovers CMP 170HX via lspci. ```APIDOC ## [CLI] passthrough.sh status ### Description Displays the status of CMP 170HX GPUs, including bound driver, reset method, and memory. With no BDFs, auto-discovers CMP 170HX via lspci. ### Method CLI ### Endpoint sudo ./tools/passthrough.sh status [...] ### Parameters #### Path Parameters - **pci-address** (string) - Optional - Full PCI address (e.g., 0000:04:00.0) ### Response #### Success Response - **BDF** (string) - PCI address - **DRIVER** (string) - Bound driver name or 'none' - **RESET_METHOD** (string) - Contents of reset_method - **MEMORY** (string) - Memory in MiB from nvidia-smi #### Response Example ``` # BDF DRIVER RESET_METHOD MEMORY # 0000:04:00.0 nvidia [ ] 65536 MiB # ✓ cmp_no_bus_reset loaded (bus reset blocked) ``` ``` -------------------------------- ### Emitted variables format (stdout) Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Output format for the emitted shell assignments. Each line is `KEY='value'` with single quotes and escaped embedded quotes. `driver/build.sh` consumes this via `eval "$(…)"`. The variables include CFG1, LMR, FB_BYTES, UNLOCK_LABEL, SKIP_GEOMETRY_REWRITE, PROFILE_STOCK_MIB, PROFILE_UNLOCKED_MIB, and CONSTANTS_UNLOCK_COUNT. ```text CFG1= LMR= FB_BYTES= UNLOCK_LABEL= SKIP_GEOMETRY_REWRITE=0|1 # 1 when profile.geometry_rewrite is false PROFILE_STOCK_MIB= PROFILE_UNLOCKED_MIB= CONSTANTS_UNLOCK_COUNT= # len(unlocks) ``` -------------------------------- ### remove.sh full signature Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/remove-cli.md Full signature of the remove.sh script. Requires root and the --yes or -y argument. The literal usage line is at remove.sh:31. ```bash #!/bin/bash set -euo pipefail Usage: sudo ./remove.sh --yes ``` -------------------------------- ### Error handling for missing register in patch Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/tools-read-constants.md Shows the error message when a register is removed from a patch but still declared in constants.yaml. ```bash python3 tools/read-constants.py common/constants.yaml driver/patches driver/build.sh 8gb # error: common/constants.yaml does not match the patches: # unlock ecc: feature_override_ecc addr 0x0082380c not found in ecc-enable.patch # [exit 1] ``` -------------------------------- ### Remove with -y alias Source: https://github.com/amoghmunikote/cmpunlocker/blob/master/_autodocs/api-reference/remove-cli.md The -y alias is accepted as an alternative to --yes for confirming removal. ```bash sudo ./remove.sh -y ```