From 007d1c9d51b607d9b3e1dd4b969e4e37f843d15d Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Tue, 17 Nov 2026 08:44:36 -0500 Subject: vgsp: phys_gr_dump_push_all (per-draw MME body scan); guest video harness - gsp_phys_booter: phys_gr_dump_push_all scans every beef and 0x1000013 push for the MME IR/SA ports (0x114/0x118/0x11c/0x120) with a one-line PUSH-SCAN receipt and full-dumps upload-bearing pushes. c1030/c1035 receipts: 14895-word beef push m114=0/m11c=0; draw push 0x400f9d8 m114=0 m1b00=6 (CALL(0) 0x3800 data=0xd48 present, no macro body). - cycle-r1780: kill QEMU by exact pidfile PID (never pkill -f), refuse a foreign qemu, poll the pidfile after daemonize, virtio-vga display. - params-r1624: enable dump-all + any-channel prelude capture + draw census; fix the stale gsp_phys_gr_dump_push parameter name. - tools/guest-diag: demo-video.sh (Xvfb+XFCE desktop, nvidia-smi, GZDoom segment, honest CUDA battery) and qmp_record.py (QMP screendump). --- kernel/gsp_phys_booter.c | 134 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 21 deletions(-) (limited to 'kernel') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 6d6e27a..589bb60 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -99,6 +99,22 @@ module_param_named(phys_gr_dump_push, gsp_phys_gr_dump_push_param, bool, 0644); MODULE_PARM_DESC(phys_gr_dump_push, "Hexdump the captured raw GR push (up to GSP_PHYS_GR_RAW_WORDS dwords) to dmesg once per launch (default 0; diagnostic only)"); +/* + * phys_gr_dump_push_all: GL-gate diagnostic. The draw window itself carries + * no MME instruction upload (CONT.561), so the per-draw macro body must come + * from another push - possibly another channel (the X/2D 0x1000013 lane) or + * an earlier/later beef push the 512-word dump gate skipped. With this on, + * EVERY beef-family push and EVERY 0x1000013 push is scanned for the MME + * setup ports (0x114/0x118/0x11c/0x120/0x234/0x1b00) with a one-line + * PUSH-SCAN receipt, and any push that carries an IR/SA upload is hexdumped + * in full (bounded). Default 0 (no logging, no behaviour change). + */ +static bool gsp_phys_gr_dump_push_all_param; +module_param_named(phys_gr_dump_push_all, gsp_phys_gr_dump_push_all_param, + bool, 0644); +MODULE_PARM_DESC(phys_gr_dump_push_all, + "Scan EVERY beef push and every 0x1000013 X/2D push for MME IR/SA uploads (PUSH-SCAN) and full-dump the upload-bearing ones (default 0; diagnostic only)"); + /* * GRFIX FIX3 (relocation coverage, default 0): the QMD/bank rewrite scan * counts 8-byte words that pass the rewrite's own device-VA shape test @@ -31871,27 +31887,103 @@ int gsp_phys_backend_guest_gr_submit(const struct gsp_phys_gr_submit *req, * the DRAW CALL encodings (0xa00a0e44 ONE_INCR 0x3910, 0x3914 data * writes, BEGIN 0x1618) and counts runs/shapes in the real push. * Gated to pushes >= 512 dwords so every real client draw window is - * dumped while the tiny release/state pokes are skipped. - */ - if (READ_ONCE(gsp_phys_gr_dump_push_param) && req->raw && - req->raw_words >= 512u) { - u32 dn = req->raw_words; - u32 di; - - if (dn > GSP_PHYS_GR_RAW_WORDS) - dn = GSP_PHYS_GR_RAW_WORDS; - pr_info("vgsp-gr: PUSH-DUMP h=0x%x push=0x%llx len=%u raw_words=%u dump_words=%u (raw[0]=push base; word i at push_va+4*i)\n", - req->h_object, req->push_va, req->push_len, - req->raw_words, dn); - for (di = 0; di < dn; di += 16u) { - char db[160]; - u32 dj, dofs = 0; - - for (dj = di; dj < di + 16u && dj < dn; dj++) - dofs += scnprintf(db + dofs, sizeof(db) - dofs, - "%08x ", - get_unaligned_le32(req->raw + dj)); - pr_info("vgsp-gr: PUSH[%05u]: %s\n", di, db); + * dumped while the tiny release/state pokes are skipped. With + * phys_gr_dump_push_all every beef/X-2D push is scanned instead (and + * upload-bearing ones dumped) - the per-draw MME macro body search. + */ + { + bool beef = (req->h_object & 0xfffff000u) == 0xbeef0000u; + bool x2d = req->h_object == 0x1000013u; + bool dump_all = READ_ONCE(gsp_phys_gr_dump_push_all_param); + bool want = false, irhit = false; + u32 dn, di; + u32 m114 = 0, m118 = 0, m11c = 0, m120 = 0, m1b00 = 0; + u32 ir_off = 0, ir_mthd = 0, ir_cnt = 0; + + if (req->raw && dump_all && (beef || x2d)) { + u32 so = 0; + u32 scan_n = req->raw_words; + + if (scan_n > GSP_PHYS_GR_RAW_WORDS) + scan_n = GSP_PHYS_GR_RAW_WORDS; + /* + * Walk the canonical op/cnt grammar over the whole + * captured push. A WORD_DATA/ONE_INC run's header + * carries the method id of its first data word; the + * MME IR/SA upload families are 0x114/0x118 (code + + * pointer), 0x11c/0x120 (entry table), 0x234 and the + * 0x1b00 semaphore arms. Count each hit and remember + * the first IR-port run, which is the macro body. + */ + while (so + 1u <= scan_n) { + u32 hdr = get_unaligned_le32(req->raw + so); + u32 op = (hdr >> 29) & 7u; + u32 cnt = (hdr >> 16) & 0x1fffu; + u32 addr = (hdr & 0x1fffu) << 2; + u32 span = 1u; + + if (op == 1u || op == 3u || op == 5u) { + if (cnt && so + 1u + cnt <= scan_n) + span = 1u + cnt; + if (addr >= 0x114u && addr <= 0x120u) { + if (addr == 0x114u) m114++; + else if (addr == 0x118u) m118++; + else if (addr == 0x11cu) m11c++; + else m120++; + if (!irhit) { + irhit = true; + ir_off = so; + ir_mthd = addr; + ir_cnt = cnt; + } + } else if (addr >= 0x1b00u && + addr <= 0x1b0cu) { + m1b00++; + } + } + so += span; + } + pr_info("vgsp-gr: PUSH-SCAN h=0x%x push=0x%llx len=%u words=%u m114=%u m118=%u m11c=%u m120=%u m1b00=%u first_ir=%s@%u(m=%x,cnt=%u)\n", + req->h_object, req->push_va, req->push_len, + req->raw_words, m114, m118, m11c, m120, m1b00, + irhit ? "yes" : "no", ir_off, + ir_mthd, ir_cnt); + /* + * A beef push is always worth the full dump (the draw + * encoding question); the X/2D lane only when it + * carries the IR/SA upload (volume control). + */ + want = beef || irhit; + } + if ((READ_ONCE(gsp_phys_gr_dump_push_param) && + req->raw && req->raw_words >= 512u) || + (want && req->raw)) { + static u32 dump_all_n; + + dn = req->raw_words; + if (dn > GSP_PHYS_GR_RAW_WORDS) + dn = GSP_PHYS_GR_RAW_WORDS; + if (want && !READ_ONCE(gsp_phys_gr_dump_push_param) && + dump_all_n >= 24u) + dn = 0; /* bounded: 24 push_all full dumps */ + if (dn) { + dump_all_n++; + pr_info("vgsp-gr: PUSH-DUMP h=0x%x push=0x%llx len=%u raw_words=%u dump_words=%u (raw[0]=push base; word i at push_va+4*i)\n", + req->h_object, req->push_va, + req->push_len, req->raw_words, dn); + for (di = 0; di < dn; di += 16u) { + char db[160]; + u32 dj, dofs = 0; + + for (dj = di; dj < di + 16u && dj < dn; + dj++) + dofs += scnprintf(db + dofs, + sizeof(db) - dofs, + "%08x ", + get_unaligned_le32(req->raw + dj)); + pr_info("vgsp-gr: PUSH[%05u]: %s\n", di, db); + } + } } } /* -- cgit v1.2.3