summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_sema_service.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 14:14:26 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 14:14:26 -0500
commit9731649e1284d544be111b381b8b77a45d209f2d (patch)
treefb56af67dfddc312007e037d54be7a07f739b921 /kernel/gsp_sema_service.c
parent60b1bf75002eb33dc46f7c2354d0c6f3d39aec99 (diff)
downloadopen-iov-9731649e1284d544be111b381b8b77a45d209f2d.tar.gz
open-iov-9731649e1284d544be111b381b8b77a45d209f2d.zip
vgsp: eng89i - 16384-word raw window, 32-slot candidate ring, start snap
c946-c951 admitted the big 14865-word draw window but refused it at raw_ok=0: the raw[] capture kept only the last 4096 words of a 14895-word push. Raise GSP_PHYS_GR_RAW_WORDS/SVC_GR_PUSH_WORDS to 16384 (64 KB static each; the IR pack stays 4096 and its maxa bound unchanged) and the candidate ring 8 -> 32 so a three-chunk window is not truncated. Add WIN-START-SNAP: c949-c951 admitted start=0x78 where w0=0x3f800000 parses as op=1 count=0xf80 (data, not a method header; the real BEGIN run is at 0xe8). If the start word is not a plausible method header, scan forward up to 0x400 bytes for the first plausible one and replay from there; bounded receipt names old/new. c949 was the first boot with guest surface stores from the engine (GUEST-WIT 601/2030 pages, va=0x120400000, post=0xff000000); the beef big-window replay is now the remaining gate.
Diffstat (limited to 'kernel/gsp_sema_service.c')
-rw-r--r--kernel/gsp_sema_service.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 8cc7aaa..4b3c24c 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -9116,7 +9116,7 @@ static struct svc_fwd_cand svc_fwd_cand;
* method-aligned svc_gl_stream_chunks() split (<=448-word chunks, six
* per frame) can run. Must stay equal to GSP_PHYS_GR_RAW_WORDS.
*/
-#define SVC_GR_PUSH_WORDS 4096
+#define SVC_GR_PUSH_WORDS 16384
#define SVC_GR_QMD_WORD_NONE 0xffffffffu
/* svc_gr_cand.rel_flags bits (decoded from qmd[24] and qmd[4]). */
#define SVC_GR_REL_REDUCTION 0x1u
@@ -9250,7 +9250,7 @@ struct svc_gr_cand_rec {
* evict its own later chunks (or the X channel's pending candidate) before
* the pump drained them.
*/
-#define SVC_GR_CAND_RING 8
+#define SVC_GR_CAND_RING 32
static struct svc_gr_cand_rec svc_gr_cand_ring[SVC_GR_CAND_RING];
static u32 svc_gr_cand_pos;
#define svc_gr_cand (svc_gr_cand_ring[svc_gr_cand_pos])
@@ -12105,6 +12105,27 @@ module_param_named(sema_gl_win_rt0_admit, svc_gl_rt0_class_admit, bool, 0644);
MODULE_PARM_DESC(sema_gl_win_rt0_admit,
"Admit a beef draw-synth window to the verbatim replay lane when its FIRST colour-target write is a usable surface-class bind even if the last-write heuristic refuses it (default 1)");
+/*
+ * eng89i: method-header plausibility for window-start alignment. The
+ * direct-GL draw push's section opener can point at a data word (c949-c951:
+ * start=0x78 where w0=0x3f800000 parses as op=1 cnt=0xf80 and swallows the
+ * window as data; the real BEGIN run starts at 0xe8). A real method header
+ * uses op 1/3/4/5 with a plausible count and method address.
+ */
+static bool svc_gl_hdr_plausible(const u8 *p, u32 rem)
+{
+ u32 w, op, cnt, m;
+
+ if (!p || rem < 4u)
+ return false;
+ memcpy(&w, p, 4);
+ op = (w >> 29) & 7u;
+ cnt = (w >> 16) & 0xfffu;
+ m = (w & 0x1fffu) << 2;
+ return (op == 1u || op == 3u || op == 4u || op == 5u) &&
+ cnt <= 0x400u && m <= 0x3ffcu;
+}
+
static bool svc_gl_window_rt_first_valid(const u8 *buf, u32 len, u32 start_off,
u32 at_off)
{
@@ -23161,6 +23182,33 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf,
u32 keep_pay = svc_gl.rel_payload;
u32 wstart = gl_win_start ? gl_win_start : off;
+ /*
+ * eng89i: snap a data-led start to the first plausible
+ * method header within 0x400 bytes. Without this the
+ * first replay chunk parses data as methods and the
+ * lane poisons (c949-c951).
+ */
+ if (gl_win_start &&
+ !svc_gl_hdr_plausible(buf + wstart, len - wstart)) {
+ u32 scan;
+
+ for (scan = wstart + 4u;
+ scan + 4u <= len && scan <= wstart + 0x400u;
+ scan += 4u) {
+ if (svc_gl_hdr_plausible(buf + scan,
+ len - scan)) {
+ if (svc_gl_np_log < 64) {
+ svc_gl_np_log++;
+ pr_info("sema-gl: WIN-START-SNAP h=0x%x push=0x%llx old=0x%x new=0x%x\n",
+ ch->h_object,
+ push_va,
+ wstart, scan);
+ }
+ wstart = scan;
+ break;
+ }
+ }
+ }
memset(&svc_gl, 0, sizeof(svc_gl));
svc_gl.seen = true;
svc_gl.subch = subch;