summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/gsp_phys_booter.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 40606c9..990e33c 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -19264,6 +19264,28 @@ static u32 gsp_phys_gr_vs_scan(const struct gsp_phys_gr_submit *req,
return 0;
}
+/* 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)
+{
+ 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 == 0x600u && span >= 3u)
+ return true;
+ r += span;
+ }
+ return false;
+}
+
static u32 gsp_phys_gr_mme_release_due_ms(void)
{
u32 ms = READ_ONCE(gsp_phys_rmcall_gr_mme_pack_release_ms);
@@ -19480,7 +19502,9 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req,
/*
* Stream size (Turing binds SIZE_A/B; the
* replay has none). 1 MB covers the 24x20 B
- * payload with margin.
+ * payload with margin. Emitted for every
+ * prepend; the once-only block below also
+ * covers windows that carry the location.
*/
if (vj == 0u &&
READ_ONCE(gsp_phys_rmcall_gr_vs_autobind) >=
@@ -19495,6 +19519,23 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req,
req->h_object, req->push_va);
}
}
+ /*
+ * A window that already carries its own VS location
+ * (c814: VS0/VS1 nonzero) still lacks the Turing
+ * stream size; bind it here so the fetch is not
+ * clamped to zero.
+ */
+ if (READ_ONCE(gsp_phys_rmcall_gr_vs_autobind) >= 2u &&
+ !gsp_phys_gr_mme_window_has_vs_size(req->stream,
+ req->stream_n) &&
+ vs_n + 3u <= ARRAY_SIZE(vs_pre)) {
+ vs_pre[vs_n++] = (1u << 29) | (2u << 16) |
+ ((0x600u >> 2) & 0xfffu);
+ vs_pre[vs_n++] = 0u;
+ vs_pre[vs_n++] = 0x00100000u;
+ 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);
+ }
}
if (req->stream_n + vs_n > GSP_PHYS_GR_MME_RELEASE_WIN_MAX)
vs_n = 0;