summaryrefslogtreecommitdiffstats
path: root/tools/guest-diag/phys_claim_cycle.sh
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 07:22:09 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 07:22:09 -0400
commitaeb9e292925d8942a53f258416dea5de4218ec43 (patch)
treef98fc9a66b99d522ccd93b59cd671708691caab6 /tools/guest-diag/phys_claim_cycle.sh
parent64d13b26509e77e9384284586deb20d8903cfafc (diff)
downloadopen-iov-aeb9e292925d8942a53f258416dea5de4218ec43.tar.gz
open-iov-aeb9e292925d8942a53f258416dea5de4218ec43.zip
gsp-phys: read-only FWSEC dry-run mode; match the 6-byte BIT token decode
Diffstat (limited to 'tools/guest-diag/phys_claim_cycle.sh')
-rwxr-xr-xtools/guest-diag/phys_claim_cycle.sh26
1 files changed, 24 insertions, 2 deletions
diff --git a/tools/guest-diag/phys_claim_cycle.sh b/tools/guest-diag/phys_claim_cycle.sh
index 7103fec..4ecd1fa 100755
--- a/tools/guest-diag/phys_claim_cycle.sh
+++ b/tools/guest-diag/phys_claim_cycle.sh
@@ -18,13 +18,17 @@
# plan ready. The harness itself never retries an aborted cycle.
#
# Usage: phys_claim_cycle.sh --yes [--hold SECONDS] [--cycles N] [--layout]
-# [--ko PATH] [--no-restore]
+# [--dryrun] [--ko PATH] [--no-restore]
#
# --yes required: acknowledge the host-freeze hazard
# --hold S seconds to keep the GPU claimed (default 30)
# --cycles N cycles to run, each only if the previous was green (default 1)
# --layout also pass gsp_phys_layout=1 (rung 3b); "stage 3b complete"
# then becomes an expected (but non-fatal) pattern
+# --dryrun also pass gsp_phys_fwsec_dryrun=1 (implies --layout): run the
+# 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
# --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)
@@ -48,6 +52,7 @@ USE_YES=0
HOLD=30
CYCLES=1
LAYOUT=0
+DRYRUN=0
NO_RESTORE=0
KO="$REPO_ROOT/kernel/open-iov-vfio.ko"
@@ -71,6 +76,7 @@ while [ $# -gt 0 ]; do
--hold) HOLD="${2:-}"; shift ;;
--cycles) CYCLES="${2:-}"; shift ;;
--layout) LAYOUT=1 ;;
+ --dryrun) DRYRUN=1; LAYOUT=1 ;;
--ko) KO="${2:-}"; shift ;;
--no-restore) NO_RESTORE=1 ;;
-h|--help) usage; exit 0 ;;
@@ -265,9 +271,11 @@ for n in $(seq 1 "$CYCLES"); do
LAYOUT_ARG=""
[ "$LAYOUT" -eq 1 ] && LAYOUT_ARG="gsp_phys_layout=1"
+ DRYRUN_ARG=""
+ [ "$DRYRUN" -eq 1 ] && DRYRUN_ARG="gsp_phys_fwsec_dryrun=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; }; then
+ gsp_phys_gpu=1 gsp_phys_hazard_ack=1 $LAYOUT_ARG $DRYRUN_ARG; }; then
save_dmesg "$DLOG"
echo "ABORT: cycle $n: stop-persistenced && insmod failed" >&2
exit 2
@@ -297,6 +305,14 @@ for n in $(seq 1 "$CYCLES"); do
if [ "$LAYOUT" -eq 1 ]; then
OK_STAGE3B=0; grep -q "stage 3b complete" "$DLOG" && OK_STAGE3B=1
fi
+ OK_DRYRUN=1
+ if [ "$DRYRUN" -eq 1 ]; then
+ OK_DRYRUN=0
+ if grep -q "gsp-phys-fwsec-dryrun:" "$DLOG" && \
+ grep -q "stage 3c dry-run complete" "$DLOG"; then
+ OK_DRYRUN=1
+ fi
+ fi
if [ "$NR_LOCKS" -eq 0 ] && [ "$OK_CLAIM" -eq 0 ]; then
echo "ABORT: cycle $n: no locks and no claim took effect" >&2
@@ -317,6 +333,9 @@ for n in $(seq 1 "$CYCLES"); do
if [ "$LAYOUT" -eq 1 ] && [ "$OK_STAGE3B" -ne 1 ]; then
warn "cycle $n: gsp_phys_layout=1 but no 'stage 3b complete' line"
fi
+ 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
IN_RAIL_BEFORE="$(in_window_rail_count "$DLOG")"
OUT_RAIL_BEFORE="$(( $(rail_count "$DLOG") - IN_RAIL_BEFORE ))"
@@ -404,6 +423,9 @@ for n in $(seq 1 "$CYCLES"); do
if [ "$OK_STAGE3B" -ne 1 ]; then
ALL_GREEN=0
fi
+ if [ "$OK_DRYRUN" -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)"