summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 01:14:56 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 01:14:56 -0500
commit70e4e560b55e7155e6103601f078945c1d13c615 (patch)
treeeb387670ccfb729161b8557acbdbf1a7aa8c58a8 /kernel
parent9d925787218af080316a81c85da4ea91884ecb21 (diff)
downloadopen-iov-70e4e560b55e7155e6103601f078945c1d13c615.tar.gz
open-iov-70e4e560b55e7155e6103601f078945c1d13c615.zip
vgsp: eng77 - capture and replay the client's VERTEX_STREAM_TURING CALL(2)
The beef 728-byte push carries CALL_MME_MACRO(2) (method 0x3810, golden slot 2 = VERTEX_STREAM_TURING) with payload [0,0,0x0450e100]: the Mesa mme_tu104_sim of golden slot 2 with those args emits SET_VERTEX_STREAM_A_LOCATION 0x1c04<-0, 0x1c08<-0, and the Turing size pair 0x600<-0, 0x604<-<the VA> - the VTG stream state the per-frame DRAW window slices omit. The census (eng76, 0x100..0x1ff) finds it at 0x148 of the 728 push; the 247-word window carries the relocated call at 0x2e0 (d2=0x1e22100), the 151-word DRAW window does not. - service: sticky svc_gl_vs_call[3] from every 0x3810 run (VS-CALL receipt), getter gsp_sema_gl_vs_call(). - booter release_save: when the window has no 0x3810 run, prepend the captured ONE_INCR run (0x3810<-payload) ahead of the DRAW window; the normal patch relocates the VA payload (sema_gl_mme_reloc). - vs_pre buffer 12->24 words. Census range stays 0x100..0x1ff (eng76).
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_phys_booter.c50
-rw-r--r--kernel/gsp_sema_service.c39
-rw-r--r--kernel/gsp_sema_service.h1
3 files changed, 89 insertions, 1 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 10fe9c3..3a8bb55 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -19295,6 +19295,28 @@ static u32 gsp_phys_gr_vs_scan(const struct gsp_phys_gr_submit *req,
return 0;
}
+/* Does the window carry the VERTEX_STREAM_TURING CALL(2) run (0x3810)? */
+static bool gsp_phys_gr_mme_window_has_call2(const u32 *win, u32 n)
+{
+ u32 r = 0;
+
+ while (r < n) {
+ u32 h = win[r];
+ u32 op = (h >> 29) & 7u;
+ u32 cnt = (h >> 16) & 0x1fffu;
+ u32 span = 1u;
+ u32 m0 = (h & 0xfffu) << 2;
+
+ if ((op == 1u || op == 3u || op == 5u) && cnt &&
+ r + 1u + cnt <= n)
+ span = 1u + cnt;
+ if (m0 == 0x3810u)
+ return true;
+ r += span;
+ }
+ return false;
+}
+
/* Does the window already carry the Turing stream-size run (0x600)? */
static bool gsp_phys_gr_mme_window_has_vs_size(const u32 *win, u32 n)
{
@@ -19425,7 +19447,7 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req,
bool draw_ia, keep = false;
const char *prefer = NULL;
u32 old_h = 0, old_win = 0;
- u32 vs_pre[12];
+ u32 vs_pre[24];
u32 vs_n = 0;
static u32 prefer_log;
@@ -19567,6 +19589,32 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req,
pr_info("vgsp-gr: MME-VS-SIZE synth j=0 size=0x100000 (window has VS) h=0x%x push=0x%llx\n",
req->h_object, req->push_va);
}
+ /*
+ * eng77: the client's VERTEX_STREAM_TURING macro
+ * (CALL_MME_MACRO(2) = 0x3810) payload carries the
+ * VTG stream size/base (the 0x0450e100-family VA).
+ * The DRAW-window slices omit it; replay the last
+ * captured call before the DRAW_IAB.
+ */
+ {
+ u32 vcall[3];
+
+ if (!gsp_phys_gr_mme_window_has_call2(
+ req->stream, req->stream_n) &&
+ gsp_sema_gl_vs_call(vcall) &&
+ vs_n + 4u <= ARRAY_SIZE(vs_pre)) {
+ vs_pre[vs_n++] = (5u << 29) |
+ (3u << 16) |
+ ((0x3810u >> 2) &
+ 0xfffu);
+ vs_pre[vs_n++] = vcall[0];
+ vs_pre[vs_n++] = vcall[1];
+ vs_pre[vs_n++] = vcall[2];
+ pr_info("vgsp-gr: MME-VS-CALL synth 0x3810 payload=%08x,%08x,%08x h=0x%x push=0x%llx\n",
+ vcall[0], vcall[1], vcall[2],
+ req->h_object, req->push_va);
+ }
+ }
}
if (req->stream_n + vs_n > GSP_PHYS_GR_MME_RELEASE_WIN_MAX)
vs_n = 0;
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 2b49d24..499247d 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -9801,6 +9801,26 @@ static u8 svc_gl_shader_type[32] = {
static u64 svc_gl_vs_base[8];
static u8 svc_gl_vs_hi[8]; /* LOCATION_A upper byte per stream */
static u32 svc_gl_vs_log;
+/*
+ * eng77: the client's VERTEX_STREAM_TURING macro call (CALL_MME_MACRO(2)
+ * = 0x3810) whose payload carries the VTG vertex-stream state (the
+ * 0x0450e100-family VA). The per-frame DRAW window slices exclude this
+ * call; capture the last observed payload (3 words) so the booter can
+ * replay it before the DRAW_IAB. The census scans every beef push.
+ */
+static u32 svc_gl_vs_call[3];
+static u8 svc_gl_vs_call_ok;
+static u32 svc_gl_vs_call_log;
+
+bool gsp_sema_gl_vs_call(u32 out[3])
+{
+ if (!out || !READ_ONCE(svc_gl_vs_call_ok))
+ return false;
+ out[0] = READ_ONCE(svc_gl_vs_call[0]);
+ out[1] = READ_ONCE(svc_gl_vs_call[1]);
+ out[2] = READ_ONCE(svc_gl_vs_call[2]);
+ return true;
+}
u64 gsp_sema_gl_vs_base(u32 j)
{
@@ -18329,6 +18349,25 @@ static void svc_mme_census(const u8 *buf, u32 len, u64 push_va, u32 h_object)
memcpy(&v1, buf + off + 8, 4);
if (off + 16 <= len)
memcpy(&v2, buf + off + 12, 4);
+ /*
+ * eng77: remember the VERTEX_STREAM_TURING
+ * CALL_MME_MACRO(2) payload (the VTG stream state
+ * the DRAW window slices omit).
+ */
+ if (addr == 0x3810u && off + 16 <= len) {
+ bool changed = !READ_ONCE(svc_gl_vs_call_ok) ||
+ READ_ONCE(svc_gl_vs_call[2]) != v2;
+
+ WRITE_ONCE(svc_gl_vs_call[0], v0);
+ WRITE_ONCE(svc_gl_vs_call[1], v1);
+ WRITE_ONCE(svc_gl_vs_call[2], v2);
+ WRITE_ONCE(svc_gl_vs_call_ok, 1);
+ if (changed && svc_gl_vs_call_log < 8u) {
+ svc_gl_vs_call_log++;
+ pr_info("sema-gl: VS-CALL 0x3810 payload=%08x,%08x,%08x\n",
+ v0, v1, v2);
+ }
+ }
lc += scnprintf(line + lc, sizeof(line) - lc,
"%s0x%x@0x%x(%08x,%08x,%08x)",
nhit ? "," : "", addr, off, v0, v1, v2);
diff --git a/kernel/gsp_sema_service.h b/kernel/gsp_sema_service.h
index 926f81e..4a739da 100644
--- a/kernel/gsp_sema_service.h
+++ b/kernel/gsp_sema_service.h
@@ -629,6 +629,7 @@ bool gsp_sema_gr_surf_recs(u64 *va, u32 *n);
*/
u64 gsp_sema_mme_sa_get(u32 *entries, u32 n);
u64 gsp_sema_gl_vs_base(u32 j);
+bool gsp_sema_gl_vs_call(u32 out[3]);
/*
* Golden SA completion (sema_gl_mme_sa_golden_fill): set the host-side