From a06d4b13cf209c2ce74a79a5565787e2edcbf0d8 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Mon, 16 Nov 2026 19:39:57 -0500 Subject: vgsp: eng89r - revert to the interior CALL write; carry its data word through hold/save --- kernel/gsp_phys_booter.c | 37 +++++++++++----- kernel/gsp_sema_service.c | 111 ++++++++++++++++++++++++++++++---------------- 2 files changed, 100 insertions(+), 48 deletions(-) diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 4918731..36ccbe1 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19165,17 +19165,22 @@ static bool gsp_phys_gr_mme_window_has_draw_ia(const u32 *win, u32 n) r + 1u + cnt <= n) span = 1u + cnt; /* - * eng89p: only the RUN HEADER's own method selects a CALL. - * The client's DRAW_IAB call is a distinct header - * (0xa00a0e44: op=5 ONE_INCR, cnt=10, m0=0x3910). Matching - * interior words of a wide op=1/3 run produced the c997-c1001 - * false positive (a 4353-word state run with m0=0x804 whose - * interior offset happens to be 0x3910), so a real CALL never - * reached the held-call path. + * eng89r: the DRAW CALL is an interior method of the wide + * op=1/3 run (m0 + 4*k), not a run header. c1000's header + * (off=58, m0=0x804, op=1, cnt=4352) carries 0x3910 at + * k=(0x3910-0x804)/4 with the macro data/address in the + * following word. Only count it when that data word exists + * (k + 1 < span), so a bare method mention is not a CALL. */ - if (((h & 0xfffu) << 2) == 0x3800u + 34u * 8u) - return true; - (void)k; + for (k = 0; k < span; k++) { + u32 m = ((h & 0xfffu) << 2) + 4u * k; + + if (k && op != 1u && op != 3u) + break; + if (m == 0x3800u + 34u * 8u && + k + 1u < span && r + k + 1u < n) + return true; + } r += span; } return false; @@ -19455,8 +19460,20 @@ static void gsp_phys_gr_mme_call_census(const struct gsp_phys_gr_submit *req, char abuf[12 * 10 + 1]; u32 ai, alen = min_t(u32, span - 1u, 12u), apos = 0; + u32 data = 0; slot34 = 1; + /* + * eng89r: the CALL is an interior method + * (m0 + 4*k) of a wide op=1/3 run; the word + * after the 0x3910 write is the macro + * data/address the client calls. `at` is + * the window word of the write. + */ + if (k + 1u < span) + data = req->stream[r + k + 1u]; + pr_info("vgsp-gr: MME-CALL-ARGS slot=34 data=0x%x at=%u\n", + data, r + k); for (ai = 0; ai < alen; ai++) apos += scnprintf(abuf + apos, sizeof(abuf) - apos, diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index d1ecfb1..ad99397 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -11924,6 +11924,8 @@ static u32 svc_gl_draw_scan_pos; static u64 svc_gl_mismatch_seen[16]; static u32 svc_gl_mismatch_pos; static u32 svc_gl_flush_log; +/* eng89r: bounded DRAW-WRITE receipts per push (reset on a new push). */ +static u32 svc_gl_draw_write_log; static bool svc_gl_draw_scan_new_push(u64 push_va) { @@ -11934,6 +11936,7 @@ static bool svc_gl_draw_scan_new_push(u64 push_va) return false; svc_gl_draw_scan_seen[svc_gl_draw_scan_pos++ % ARRAY_SIZE(svc_gl_draw_scan_seen)] = push_va; + svc_gl_draw_write_log = 0; return true; } @@ -11970,13 +11973,23 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word, span = 1u + cnt; runs++; /* - * eng89p: header-only match. The DRAW_IAB call is its own - * run header (0xa00a0e44: op=5, cnt=10, m0=0x3910); an - * interior word of a wide op=1/3 state run (m0=0x804, - * span=4353) also lands on 0x3910 and produced the - * c997-c1001 false positive that starved the real call. + * eng89r: the DRAW CALL is an interior method WRITE of the + * wide op=1/3 incrementing run, not a run header. c1000: + * header off=58, m0=0x804, op=1, cnt=4352 -> method 0x3910 + * at window word 58 + (0x3910 - 0x804)/4; the word after it + * (k + 1 < span) is the macro data/address. Walk every + * method the run reaches (m0 + 4*k), as pre-eng89p did; the + * containing run is returned as the slice (at = r) so the + * chunker never splits it. */ - if (m0 == 0x3910u || m0 == 0x3914u) { + for (k = 0; k < span; k++) { + u32 m; + + if (k && !incr) + break; + m = m0 + 4u * k; + if (m != 0x3910u && m != 0x3914u) + continue; if (!found) { *at = r; *span_out = span; @@ -11986,10 +11999,19 @@ static u32 svc_gl_draw_walk(const u32 *win, u32 n, u32 base_word, svc_gl_draw_scan_log++; pr_info("sema-gl: DRAW-HIT h=0x%x push=0x%llx off=%u m=0x%x op=%u cnt=%u span=%u\n", ch->h_object, push_va, - base_word + r, m0, op, cnt, span); + base_word + r, m, op, cnt, span); + } + /* eng89r: the write word and its data word, bounded + * 16 per push. `at`/`run` are window words. */ + if (log_it && svc_gl_draw_write_log < 16u && + k + 1u < span) { + svc_gl_draw_write_log++; + pr_info("sema-gl: DRAW-WRITE h=0x%x push=0x%llx m=0x%x data=0x%x at=%u run=%u run_m0=0x%x op=%u cnt=%u\n", + ch->h_object, push_va, m, + win[r + k + 1u], r + k, r, m0, + op, cnt); } } - (void)k; r += span; } *runs_out = runs; @@ -12045,10 +12067,11 @@ static void svc_gl_draw_scan(struct svc_channel *ch, const u8 *buf, u32 len, * svc_gl_stream_chunks(), i.e. after admission, so a draw-bearing window * that admission refused was never scanned - the blind spot this receipt * removes. Walk the window (then the whole push as the found_outside - * fallback) with the corrected header-only grammar, one receipt per push, - * and return whether the header is inside [start_off, at_off). Reuses the - * shared push ring, so the later svc_gl_draw_scan() does not duplicate the - * receipt while still computing the draw slice. + * fallback) with the interior-method grammar (eng89r), one receipt per + * push, and return whether the run carrying the write is inside + * [start_off, at_off). Reuses the shared push ring, so the later + * svc_gl_draw_scan() does not duplicate the receipt while still computing + * the draw slice. */ static bool svc_gl_draw_scan_pre(struct svc_channel *ch, const u8 *buf, u32 len, u32 start_off, u32 at_off, @@ -12341,10 +12364,14 @@ static bool svc_gl_chunk_has_draw_ia(const u32 *win, u32 n) if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= n) span = 1u + cnt; - /* eng89p: header-only (see svc_gl_draw_walk). */ - if (m0 == 0x3910u || m0 == 0x3914u) - return true; - (void)k; + /* eng89r: interior methods again (see svc_gl_draw_walk). */ + for (k = 0; k < span; k++) { + if (k && !incr) + break; + if (m0 + 4u * k == 0x3910u || + m0 + 4u * k == 0x3914u) + return true; + } r += span; } return false; @@ -12710,12 +12737,13 @@ static bool svc_gl_win_has_draw_legacy(const u8 *buf, u32 len) } /* - * eng89q: header-only admission marker. Only a run header may carry the - * draw CALL: op=5 header 0xa00a0e44 (m0=0x3910, DRAW_IAB/CALL_MME_MACRO - * 34) or its CALL_MME_DATA sibling 0x3914, exactly the rule DRAW-SCAN and - * svc_gl_chunk_has_draw_ia() use (eng89p). Interior data words are - * skipped with the run's own 1+cnt span, so a wide state run can no longer - * admit a 14k-word non-draw window on an interior alias. + * eng89r: interior-method admission marker. The DRAW CALL is a method + * WRITE to 0x3910 (CALL_MME_MACRO 34) / 0x3914 (CALL_MME_DATA 34) that + * the client encodes as an interior method of a wide op=1/3 incrementing + * run (c1000: header off=58, m0=0x804, op=1, cnt=4352 -> 0x3910 at + * r + (0x3910 - 0x804)/4). Walk every method the run reaches + * (m0 + 4*k, k> 29) & 7u; u32 cnt = (h >> 16) & 0x1fffu; - u32 span = 1u; + u32 span = 1u, k; u32 m0 = (h & 0xfffu) << 2; + bool incr = (op == 0u || op == 1u || op == 3u); if ((op <= 3u || op == 5u) && cnt && r + 1u + cnt <= n) span = 1u + cnt; - if (m0 == 0x3910u || m0 == 0x3914u) - return true; + for (k = 0; k < span; k++) { + if (k && !incr) + break; + if (m0 + 4u * k == 0x3910u || + m0 + 4u * k == 0x3914u) + return true; + } r += span; } return false; @@ -13980,13 +14014,13 @@ static void svc_gl_flush(struct nv_vgpu_device *vgpu, * to the beef family so no other client's capture changes lane. */ /* - * eng89q: observe EVERY trusted 3D window before admission. eng89p - * only scanned inside svc_gl_stream_chunks(), so a draw-bearing + * eng89q/eng89r: observe EVERY trusted 3D window before admission. + * eng89p only scanned inside svc_gl_stream_chunks(), so a draw-bearing * window that admission refused was never scanned. marker is the - * legacy byte-coverage result, admitted the new header-only result; - * the pre-scan distinguishes found=0 (absent) from found_outside=1 - * (present elsewhere in the same push), and its in-window result - * powers the header-DRAW override below. + * legacy byte-coverage result, admitted the interior-method result + * (eng89r); the pre-scan distinguishes found=0 (absent) from + * found_outside=1 (present elsewhere in the same push), and its + * in-window result powers the DRAW-SCAN override below. */ gl_win3d = trusted && (op_src[0] == 's' || op_src[0] == 'h' || @@ -14015,13 +14049,14 @@ static void svc_gl_flush(struct nv_vgpu_device *vgpu, } } /* - * eng89q: header-only admission. Refuse an interior-alias marker, - * but admit a window the header-only marker still rejects when the - * pre-admission census found the CALL header INSIDE this window and - * the persisted colour-target bind is live. Beef/stream3d lane - * only, behind the existing sema_gl_win_rt_persist and - * sema_gl_draw_synth knobs; the raw push/window geometry must still - * hold or the override would admit a window nothing can launch. + * eng89r: admission is the interior-method marker again. The + * pre-scan override remains as a belt-and-braces path for a window + * whose interior write the whole-push marker did not see, provided + * the census found the CALL run INSIDE this window and the persisted + * colour-target bind is live. Beef/stream3d lane only, behind the + * existing sema_gl_win_rt_persist and sema_gl_draw_synth knobs; the + * raw push/window geometry must still hold or the override would + * admit a window nothing can launch. */ if (op_src[0] == 'd' && (ch->h_object & 0xfffff000u) == 0xbeef0000u) { -- cgit v1.2.3