summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_sema_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_sema_service.c')
-rw-r--r--kernel/gsp_sema_service.c111
1 files changed, 73 insertions, 38 deletions
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<span), exactly the pre-eng89p admission that admitted the
+ * real windows; eng89p's header-only gate rejected all of them.
*/
static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
{
@@ -12729,13 +12757,19 @@ static bool svc_gl_win_has_draw(const u8 *buf, u32 len)
u32 h = win[r];
u32 op = (h >> 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) {