summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 17:55:38 -0500
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-11-16 17:55:38 -0500
commitebacf2207e7c9413280bca991d10656737c3df96 (patch)
tree3894e4c97ea247e957483deff27e63c82d5699cd /kernel/gsp_phys_booter.c
parent1ae572c9543ab9b4e5fe910e7714ca54afe3c686 (diff)
downloadopen-iov-ebacf2207e7c9413280bca991d10656737c3df96.tar.gz
open-iov-ebacf2207e7c9413280bca991d10656737c3df96.zip
vgsp: eng89n - keep the pack latch across channel recycle; forward every chunk of an admitted window
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 25d0c35..751f680 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -22800,9 +22800,22 @@ static void gsp_phys_gr_ctx_wipe_latches(void)
* IRAM program in it) survives. sema_gl_mme_keep_done_across_recycle=1
* keeps the completion record + packed cursor across the re-register and
* still clears the per-incarnation latch/release state (see below).
+ *
+ * eng89n: the recycle does not wipe IRAM, so a COMPLETE pack (pack_done_gen
+ * != 0 and equal to the emission latch's prelude_gen) must also keep the
+ * emission latch itself - clearing prelude_gen here made every per-fire
+ * re-register re-earn residency and the completing client window re-emit
+ * instead of running its CALLs. Keep prelude_gen/prelude_h and the
+ * pending/live witnesses for the complete case; a genuine context wipe
+ * (WEDGE-RECOVER/CWD-CLEAR/ctx_wipe_latches, iram-gate failure, generation
+ * rewind) clears them explicitly. One bounded receipt per boot.
*/
void gsp_phys_gr_mme_chan_ctx_reset(u32 h)
{
+ bool keep_latch = false;
+ u32 pack_done_gen, prelude_gen;
+ static bool latch_keep_logged;
+
if (!(READ_ONCE(gsp_phys_rmcall_gr_mme_pack_keep_gen) &&
READ_ONCE(gsp_phys_rmcall_gr_mme_golden_force)))
return;
@@ -22817,6 +22830,11 @@ void gsp_phys_gr_mme_chan_ctx_reset(u32 h)
return;
gsp_phys_gr_mme_carry_cancel("chan-ctx-reset");
/*
+ * The per-incarnation release state is always cancelled: a new
+ * incarnation must not fire a saved-window release the old one armed.
+ */
+ gsp_phys_gr_mme_release_cancel("chan-ctx-reset");
+ /*
* eng43: sema_gl_mme_keep_done_across_recycle=1 - the re-register
* recycles the client handle but leaves the GR engine context (and
* the MME IRAM program loaded into it) untouched; c579 showed the
@@ -22824,13 +22842,10 @@ void gsp_phys_gr_mme_chan_ctx_reset(u32 h)
* post-completion REARM could never fire. Keep the completion
* record and the packed cursor; a genuine context wipe clears them
* on its own path (WEDGE-RECOVER/CWD-CLEAR, park recovery, the
- * iram-gate failure, the non-keep_gen generation rewind). The
- * per-incarnation latch/release state below is always cleared - the
- * new incarnation must re-earn residency through the REARM clause.
+ * iram-gate failure, the non-keep_gen generation rewind).
* Default 0 = legacy (identical to the pre-knob behaviour).
*/
if (!READ_ONCE(gsp_phys_rmcall_gr_mme_keep_done_across_recycle)) {
- gsp_phys_gr_mme_release_cancel("chan-ctx-reset");
WRITE_ONCE(gsp_phys_gr_mme_pack_off, 0);
WRITE_ONCE(gsp_phys_gr_mme_pack_sa, false);
WRITE_ONCE(gsp_phys_gr_mme_pack_load_h, 0);
@@ -22838,11 +22853,29 @@ void gsp_phys_gr_mme_chan_ctx_reset(u32 h)
WRITE_ONCE(gsp_phys_gr_mme_pack_done_h, 0);
WRITE_ONCE(gsp_phys_gr_mme_pack_done_gen, 0);
WRITE_ONCE(gsp_phys_gr_mme_pack_done_ch, 0);
+ } else {
+ /*
+ * eng89n: a complete pack keeps the emission latch across
+ * the recycle - the IRAM image is still resident and the
+ * new incarnation must run its calls, not re-emit them.
+ */
+ pack_done_gen = READ_ONCE(gsp_phys_gr_mme_pack_done_gen);
+ prelude_gen = READ_ONCE(gsp_phys_gr_mme_prelude_gen);
+ if (pack_done_gen && pack_done_gen == prelude_gen) {
+ keep_latch = true;
+ if (!latch_keep_logged) {
+ latch_keep_logged = true;
+ pr_info("vgsp-gr: MME-LATCH-KEEP gen=%u h=0x%x (pack complete; keep done across recycle)\n",
+ pack_done_gen, h);
+ }
+ }
+ }
+ if (!keep_latch) {
+ WRITE_ONCE(gsp_phys_gr_mme_prelude_gen, 0);
+ WRITE_ONCE(gsp_phys_gr_mme_pre_emit_off, 0);
+ WRITE_ONCE(gsp_phys_gr_mme_pending_gen, 0);
+ WRITE_ONCE(gsp_phys_gr_mme_live_gen, 0);
}
- WRITE_ONCE(gsp_phys_gr_mme_prelude_gen, 0);
- WRITE_ONCE(gsp_phys_gr_mme_pre_emit_off, 0);
- WRITE_ONCE(gsp_phys_gr_mme_pending_gen, 0);
- WRITE_ONCE(gsp_phys_gr_mme_live_gen, 0);
WRITE_ONCE(gsp_phys_gr_mme_release_gen, 0);
WRITE_ONCE(gsp_phys_gr_mme_release_h, 0);
WRITE_ONCE(gsp_phys_gr_mme_window_hold_gen, 0);