diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-01 07:27:47 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-01 07:27:47 -0400 |
| commit | 9bf53de2719784b62fa99cb0d954841f672b433e (patch) | |
| tree | 6dcae72aedbf7b60bb0bff5d56859b60669b5746 /tools/guest-diag | |
| parent | 9bbb199e574e9a219b144bc99ee02464139cb07a (diff) | |
| download | open-iov-9bf53de2719784b62fa99cb0d954841f672b433e.tar.gz open-iov-9bf53de2719784b62fa99cb0d954841f672b433e.zip | |
guest-diag: add --fwsec to the supervised claim harness (stage-3c write run)
Diffstat (limited to 'tools/guest-diag')
| -rwxr-xr-x | tools/guest-diag/phys_claim_cycle.sh | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/tools/guest-diag/phys_claim_cycle.sh b/tools/guest-diag/phys_claim_cycle.sh index 4ecd1fa..898aa15 100755 --- a/tools/guest-diag/phys_claim_cycle.sh +++ b/tools/guest-diag/phys_claim_cycle.sh @@ -18,7 +18,7 @@ # plan ready. The harness itself never retries an aborted cycle. # # Usage: phys_claim_cycle.sh --yes [--hold SECONDS] [--cycles N] [--layout] -# [--dryrun] [--ko PATH] [--no-restore] +# [--dryrun] [--fwsec] [--ko PATH] [--no-restore] # # --yes required: acknowledge the host-freeze hazard # --hold S seconds to keep the GPU claimed (default 30) @@ -29,6 +29,11 @@ # READ-ONLY stage-3c validation (VBIOS/BIT/FWSEC parse and the # staging/placement plan, no device writes); expects the # "gsp-phys-fwsec-dryrun:" and "stage 3c dry-run complete" lines +# --fwsec also pass gsp_phys_fwsec=1 (implies --layout): run the REAL +# stage-3c write sequence (GSP falcon reset, WPR2 carve, FWSEC); +# expects "stage 3c complete" and, on release, the WPR2-down +# teardown line; a failed teardown keeps the locks and refuses +# the nvidia rebind (the cycle goes red; do not retry) # --ko PATH module to insmod (default kernel/open-iov-vfio.ko) # --no-restore do not restore power/control=auto or restart persistenced # at the end of each cycle (leaves the D0 hold in place) @@ -53,6 +58,7 @@ HOLD=30 CYCLES=1 LAYOUT=0 DRYRUN=0 +FWSEC=0 NO_RESTORE=0 KO="$REPO_ROOT/kernel/open-iov-vfio.ko" @@ -77,6 +83,7 @@ while [ $# -gt 0 ]; do --cycles) CYCLES="${2:-}"; shift ;; --layout) LAYOUT=1 ;; --dryrun) DRYRUN=1; LAYOUT=1 ;; + --fwsec) FWSEC=1; LAYOUT=1 ;; --ko) KO="${2:-}"; shift ;; --no-restore) NO_RESTORE=1 ;; -h|--help) usage; exit 0 ;; @@ -87,6 +94,10 @@ done case "$HOLD" in ''|*[!0-9]*) echo "--hold must be a non-negative integer" >&2; exit 1 ;; esac case "$CYCLES" in ''|*[!0-9]*|0) echo "--cycles must be a positive integer" >&2; exit 1 ;; esac +if [ "$DRYRUN" -eq 1 ] && [ "$FWSEC" -eq 1 ]; then + echo "--dryrun and --fwsec are mutually exclusive" >&2 + exit 1 +fi if [ "$HOLD" -lt 30 ]; then echo "WARN: --hold $HOLD is below the verified 30 s minimum" >&2 fi @@ -273,9 +284,11 @@ for n in $(seq 1 "$CYCLES"); do [ "$LAYOUT" -eq 1 ] && LAYOUT_ARG="gsp_phys_layout=1" DRYRUN_ARG="" [ "$DRYRUN" -eq 1 ] && DRYRUN_ARG="gsp_phys_fwsec_dryrun=1" + FWSEC_ARG="" + [ "$FWSEC" -eq 1 ] && FWSEC_ARG="gsp_phys_fwsec=1" # One command: stop persistenced and insmod with the D0 pre-lock in place. if ! { sudo systemctl stop nvidia-persistenced && sudo insmod "$KO" \ - gsp_phys_gpu=1 gsp_phys_hazard_ack=1 $LAYOUT_ARG $DRYRUN_ARG; }; then + gsp_phys_gpu=1 gsp_phys_hazard_ack=1 $LAYOUT_ARG $DRYRUN_ARG $FWSEC_ARG; }; then save_dmesg "$DLOG" echo "ABORT: cycle $n: stop-persistenced && insmod failed" >&2 exit 2 @@ -313,6 +326,11 @@ for n in $(seq 1 "$CYCLES"); do OK_DRYRUN=1 fi fi + OK_FWSEC=1 + if [ "$FWSEC" -eq 1 ]; then + OK_FWSEC=0 + grep -q "stage 3c complete" "$DLOG" && OK_FWSEC=1 + fi if [ "$NR_LOCKS" -eq 0 ] && [ "$OK_CLAIM" -eq 0 ]; then echo "ABORT: cycle $n: no locks and no claim took effect" >&2 @@ -336,6 +354,9 @@ for n in $(seq 1 "$CYCLES"); do if [ "$DRYRUN" -eq 1 ] && [ "$OK_DRYRUN" -ne 1 ]; then warn "cycle $n: gsp_phys_fwsec_dryrun=1 but the read-only dry-run did not complete (missing 'gsp-phys-fwsec-dryrun:'/'stage 3c dry-run complete')" fi + if [ "$FWSEC" -eq 1 ] && [ "$OK_FWSEC" -ne 1 ]; then + warn "cycle $n: gsp_phys_fwsec=1 but 'stage 3c complete' is missing (FWSEC did not report success)" + fi IN_RAIL_BEFORE="$(in_window_rail_count "$DLOG")" OUT_RAIL_BEFORE="$(( $(rail_count "$DLOG") - IN_RAIL_BEFORE ))" @@ -376,6 +397,11 @@ for n in $(seq 1 "$CYCLES"); do OK_REBIND=0; grep -q "rebound to nvidia (rc=1)" "$DLOG" && OK_REBIND=1 OK_BEFORE=0; grep -q "board check before rebind.*id=10de:1ed3" "$DLOG" && OK_BEFORE=1 + OK_TEARDOWN=1 + if [ "$FWSEC" -eq 1 ]; then + OK_TEARDOWN=0 + grep -q "teardown complete: WPR2 down" "$DLOG" && OK_TEARDOWN=1 + fi NR_RELEASED="$(grep -c "power domain released" "$DLOG" 2>/dev/null || true)" if [ "$OK_REBIND" -ne 1 ] || [ "$NR_RELEASED" -ne 5 ]; then ALL_GREEN=0 @@ -387,6 +413,10 @@ for n in $(seq 1 "$CYCLES"); do warn "cycle $n: missing 'board check before rebind id=10de:1ed3' line" ALL_GREEN=0 fi + if [ "$FWSEC" -eq 1 ] && [ "$OK_TEARDOWN" -ne 1 ]; then + warn "cycle $n: gsp_phys_fwsec=1 but no 'teardown complete: WPR2 down' on release (WPR2 may still be up; do not retry)" + ALL_GREEN=0 + fi if [ "$NO_RESTORE" -eq 0 ]; then set_power_control "$GPU_BDF" auto || warn "cycle $n: failed to restore GPU power/control=auto" @@ -426,6 +456,9 @@ for n in $(seq 1 "$CYCLES"); do if [ "$OK_DRYRUN" -ne 1 ]; then ALL_GREEN=0 fi + if [ "$OK_FWSEC" -ne 1 ]; then + ALL_GREEN=0 + fi if [ "$ALL_GREEN" -eq 1 ] && [ "$IN_RAIL" -eq 0 ] && [ "$HEALTH_RED" -eq 0 ]; then log "cycle $n: GREEN (locks=$NR_LOCKS, released=$NR_RELEASED, in-window rail=0, outside rail=$OUT_RAIL, hold=${HOLD}s)" |
