diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/gsp_phys_booter.c | 152 |
1 files changed, 129 insertions, 23 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 6d6e27a..6723070 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -100,6 +100,22 @@ 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 * (>= 0x10000000, < 2^47, 256-byte aligned) but match NO tracked data page @@ -23649,7 +23665,20 @@ if (gsp_phys_gr_slot_kept(j, sa_mask, } } - if (READ_ONCE(gsp_phys_rmcall_gr_mme_prelude)) { + /* + * The MME prelude/golden pack is the 3D beef client's macro + * program. Other lanes (compute 0xbfef.., X 0x1000013.., + * module 0xbeef0100 setup) never carry an MME-IR upload and + * must not have the golden body installed on their launch: + * c1030's CUDA compute channel 0xbfef0002 executed the + * synthetic mac=0xf1/pc=513 body, poisoned the MME + * (badf1201) and wedged the GR front-end, so the kernel's + * QMD never retired and the guest hung in D state. Gate the + * whole prelude/overlay/CALL-resolution machinery to the + * beef family. + */ + if (READ_ONCE(gsp_phys_rmcall_gr_mme_prelude) && + (req->h_object & 0xfffff000u) == 0xbeef0000u) { pl = gsp_sema_mme_prelude_get(&pl_n, &pl_gen); /* * eng89k: the beef client's MME upload is absent on @@ -26150,7 +26179,8 @@ if (gsp_phys_gr_slot_kept(j, sa_mask, * emitted the prelude words. Otherwise elide the one-word * op=4 run and log MME-CALL-UNMAPPED; the ladder continues. */ - if ((u32)(p - pb) > win_emit_off) { + if ((u32)(p - pb) > win_emit_off && + (req->h_object & 0xfffff000u) == 0xbeef0000u) { static u32 mme_exec_log; static u32 mme_unmap_log; u32 ew = win_emit_off, en = (u32)(p - pb); @@ -31871,27 +31901,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); + } + } } } /* |
