summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-06 20:09:42 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-06 20:09:42 -0500
commit88e0b15326a7bacb6c02f351b26a4b28a7933ad8 (patch)
tree3701b1176742ece74f41d7db229a68bed1cb8aaa /kernel/gsp_phys_booter.c
parent630a8a9fbadc4e6be2f21b162071157ccfc12664 (diff)
downloadopen-iov-88e0b15326a7bacb6c02f351b26a4b28a7933ad8.tar.gz
open-iov-88e0b15326a7bacb6c02f351b26a4b28a7933ad8.zip
vgsp-gl: synthesized GS SPH image + map variants for the SPH18 gate
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c93
1 files changed, 91 insertions, 2 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 1dedf7c..fdd8e88 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -18610,6 +18610,53 @@ module_param_named(sema_gl_sph_stage_disable,
gsp_phys_rmcall_gr_sph_stage_disable, uint, 0644);
MODULE_PARM_DESC(sema_gl_sph_stage_disable,
"Per-stage synth-bind disable mask (bit j = synth slot j: 0=VSA,1=VSB,2=TCS,3=TES,4=GS,5=PS): emit the client's SET_PIPELINE_SHADER disable record for that stage and skip its synthesized bind (default 0; legacy bytes)");
+
+/*
+ * SESSION 155 CONT 11: the last DS latch bit in the r1562 replay is SPH18
+ * (GS check2, attribute map). r1562 proved the DS validates the GS stage
+ * even when the driver's own disable record (0x2100 <- 0x40) leaves it
+ * unbound: SPH18 latched with stage4 START=0. The client has no geometry
+ * program, so no GS SPH exists anywhere in its push. This knob binds a
+ * synthesized header-only GEOMETRY SPH (128 B, pass-through maps) to
+ * stage 4 while keeping SET_PIPELINE_SHADER(4) ENABLE=0, so the DS has a
+ * valid operand at SPH_INFO_STAGE4_START but the engine never executes
+ * it. The image is authored by the sema service at family+0x780 (same 4K
+ * page as the bound VTG/TCS/PS images) and the address pair below is
+ * relocated by the same window pass. Default 0 = legacy bytes.
+ */
+static bool gsp_phys_rmcall_gr_sph_gs_img;
+module_param_named(sema_gl_sph_gs_img, gsp_phys_rmcall_gr_sph_gs_img,
+ bool, 0644);
+MODULE_PARM_DESC(sema_gl_sph_gs_img,
+ "Bind a synthesized header-only GEOMETRY SPH to stage 4 with ENABLE=0 (family+0x780; satisfies the SPH18 GS attribute-map check; default 0)");
+
+bool gsp_phys_rmcall_gr_sph_gs_img_value(void)
+{
+ return READ_ONCE(gsp_phys_rmcall_gr_sph_gs_img);
+}
+
+/*
+ * SESSION 155 CONT 12: the synthesized GS SPH's attribute-map variant.
+ * The r1564 run proved the DS fetches the image (stage4 START nonzero)
+ * yet SPH18 persists and the VTG-class check2 bits return, so the map
+ * CONTENT is the discriminator:
+ * 0 = pass-through (IMAP = previous OMAP = POSITION+COLOR;
+ * OMAP = PS IMAP superset = POSITION+COLOR)
+ * 1 = all IMAP/OMAP zero (the mesh-dummy contract)
+ * 2 = PS-exact (IMAP = POSITION.W; OMAP = POSITION.XYZW)
+ * 3 = IMAP POSITION+COLOR, OMAP POSITION.XYZW only
+ * A/B live: the sema service reads this per capture.
+ */
+static u32 gsp_phys_rmcall_gr_sph_gs_maps;
+module_param_named(sema_gl_sph_gs_maps, gsp_phys_rmcall_gr_sph_gs_maps,
+ uint, 0644);
+MODULE_PARM_DESC(sema_gl_sph_gs_maps,
+ "Synth GS SPH attribute-map variant: 0=pass-through(POS+COLOR both), 1=zero maps, 2=PS-exact(POS.W/POS.XYZW), 3=IMAP POS+COLOR / OMAP POS.XYZW (default 0)");
+
+u32 gsp_phys_rmcall_gr_sph_gs_maps_value(void)
+{
+ return READ_ONCE(gsp_phys_rmcall_gr_sph_gs_maps);
+}
static bool gsp_phys_gr_mme_pairs_emitted; /* launch emitted a pair run */
static u32 gsp_phys_gr_mme_pairs_gen; /* gen whose pairs retired OK */
static u32 gsp_phys_gr_mme_launch_gen; /* last built launch's gen */
@@ -29659,6 +29706,15 @@ gr_page_unmapped:
(sph_bind_all || (sph_bind_mask & 0x01u));
bool emit_j4 = !(stage_disable_mask & 0x10u) &&
(sph_bind_all || (sph_bind_mask & 0x10u));
+ /*
+ * SESSION 155 CONT 11: synthesized GS image bind
+ * (see the sema_gl_sph_gs_img comment). Independent
+ * of the j4 slot mask: it replaces the disable-only
+ * GS state with a disabled stage that still has a
+ * valid SPH operand.
+ */
+ bool emit_gsimg =
+ READ_ONCE(gsp_phys_rmcall_gr_sph_gs_img);
/*
* SESSION 155 CONT 9: the prelude is prepended ahead of
@@ -29861,7 +29917,8 @@ gr_page_unmapped:
(emit_j0 ? (bind_binding ? 8u : 7u) : 0u) +
(emit_j2 ? (bind_binding ? 8u : 7u) : 0u) +
(emit_j4 ? (bind_binding ? 8u : 7u) : 0u) +
- (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) <= 96u) {
+ (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) +
+ (emit_gsimg ? 9u : 0u) <= 96u) {
/*
* SESSION 155 CONT 9: pair_safe emits each
* synthesized stage's SET_PIPELINE_SHADER
@@ -30053,8 +30110,38 @@ gr_page_unmapped:
in[nfin++] = 0x1au;
in[nfin++] = 0x0u;
/*
+ * SESSION 155 CONT 11: the synthesized
+ * header-only GEOMETRY SPH (128 B at
+ * family+0x780, authored by the sema
+ * service). Bind it to stage 4 and keep the
+ * stage disabled: the DS then validates a
+ * real GS SPH (its SPH18 check2 attribute
+ * map) while the engine does not execute the
+ * header-only image. Emitted after the
+ * stage-1 pair, before the address-pair
+ * census. The pair is the only relocatable
+ * run here (nrun++ below).
+ */
+ if (emit_gsimg) {
+ u64 gva = fam + 0x780u;
+
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x2100u >> 2);
+ in[nfin++] = 0x40u;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x210cu >> 2);
+ in[nfin++] = 0x1au;
+ in[nfin++] = 0x20000000u | (2u << 16) |
+ (0x2114u >> 2);
+ in[nfin++] = (u32)(gva >> 32) & 0xffu;
+ in[nfin++] = (u32)gva & 0xfffffffcu;
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x2100u >> 2);
+ in[nfin++] = 0x40u;
+ }
+ /*
* nrun counts only the ADDRESS-bearing
- * binds above: the guard below matches it
+ * binds: the guard below matches it
* against the relocation pass's
* relocated-pair count, and the constant
* type runs can never be relocated.
@@ -30067,6 +30154,8 @@ gr_page_unmapped:
nrun++;
if (emit_j5)
nrun++;
+ if (emit_gsimg)
+ nrun++;
}
orel = gsp_phys_rmcall_gr_3d_patch_window(
in, nfin, out, &on, &odrop, req, &n_shadow,