summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_phys_booter.c82
-rw-r--r--kernel/gsp_sema_service.c73
-rw-r--r--kernel/main.c2
3 files changed, 142 insertions, 15 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 17925b6..f8208d6 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -19569,7 +19569,7 @@ static u32 gsp_phys_rmcall_gr_sph_bind_mask; /* bit j = synth slot j */
module_param_named(sema_sph_bind_mask, gsp_phys_rmcall_gr_sph_bind_mask,
uint, 0644);
MODULE_PARM_DESC(sema_sph_bind_mask,
- "Synth SPH-BIND slot mask (bit j = slot j; 0x20 = PS only) used when sema_gl_sph_bind=0");
+ "Synth SPH-BIND slot mask (bit j = slot j; 0x20 = PS only, 0x01/0x10 = VSA/GS VTG image, 0x25 = VSA+PS) used when sema_gl_sph_bind=0");
bool gsp_phys_rmcall_gr_sph_bind_value(void)
{
@@ -29575,11 +29575,11 @@ gr_page_unmapped:
if ((sph_bind_all || sph_bind_mask) &&
(req->h_object & 0xfffff000u) == 0xbeef0000u &&
req->prog_va &&
- win3d_n + 64u <= GSP_PHYS_RMCALL_GR_METHOD_WORDS) {
+ win3d_n + 96u <= GSP_PHYS_RMCALL_GR_METHOD_WORDS) {
static u32 sph_bind_log;
u64 fam = req->prog_va &
~(u64)(GSP_PHYS_PAGE_SIZE - 1);
- u32 in[64], out[64];
+ u32 in[96], out[96];
u32 nfin = 0, nrun = 0, on = 0, odrop = 0, orel;
u32 bi;
bool bind_binding =
@@ -29588,6 +29588,18 @@ gr_page_unmapped:
(sph_bind_mask & 0x04u);
bool emit_j5 = sph_bind_all ||
(sph_bind_mask & 0x20u);
+ /*
+ * SESSION 155 CONT 8: the DS flags the UNBOUND VTG-class
+ * stages (VSA/VSB/TCS/GS) in SPH bits 1/2/6/9/10/11/18.
+ * Mask bits 0x01 and 0x10 add the same synthesized
+ * per-stage record for VSA (j=0) and GS (j=4), binding
+ * the client's own VTG image (family+0x900) with the
+ * GS/VS-CULL types. Default off: bits 0/4 were unused.
+ */
+ bool emit_j0 = sph_bind_all ||
+ (sph_bind_mask & 0x01u);
+ bool emit_j4 = sph_bind_all ||
+ (sph_bind_mask & 0x10u);
/*
* SESSION 153-CONTINUED-89 (2nd half): the client's
@@ -29702,7 +29714,7 @@ gr_page_unmapped:
u64 va = req->prog_bind_va[bi];
u32 sl = req->prog_bind_slot[bi] & 0x1fu;
- if (!va || nfin + 3u > 64u)
+ if (!va || nfin + 3u > 96u)
continue;
in[nfin++] = 0x20000000u | (2u << 16) |
((0x2014u + sl * 0x40u) >> 2);
@@ -29719,8 +29731,22 @@ gr_page_unmapped:
* `20020855 [0,04400000]`).
*/
if (nfin + 3u +
+ (emit_j0 ? (bind_binding ? 8u : 7u) : 0u) +
(emit_j2 ? (bind_binding ? 8u : 7u) : 0u) +
- (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) <= 64u) {
+ (emit_j4 ? (bind_binding ? 8u : 7u) : 0u) +
+ (emit_j5 ? (bind_binding ? 8u : 7u) : 0u) <= 96u) {
+ if (emit_j0) {
+ in[nfin++] = 0x20000000u | (2u << 16) |
+ (0x2014u >> 2);
+ in[nfin++] = (u32)((fam + 0x900u) >> 32) & 0xffu;
+ in[nfin++] = (u32)(fam + 0x900u) & 0xfffffffcu;
+ }
+ if (emit_j4) {
+ in[nfin++] = 0x20000000u | (2u << 16) |
+ (0x2114u >> 2);
+ in[nfin++] = (u32)((fam + 0x900u) >> 32) & 0xffu;
+ in[nfin++] = (u32)(fam + 0x900u) & 0xfffffffcu;
+ }
if (emit_j2) {
in[nfin++] = 0x20000000u | (2u << 16) |
(0x2094u >> 2);
@@ -29747,6 +29773,16 @@ gr_page_unmapped:
* synthesized slots with the known types
* (j=2 TESS_CONTROL -> 2, j=5 PIXEL -> 5).
*/
+ if (emit_j0) {
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x2000u >> 2);
+ in[nfin++] = 1u | (0u << 4);
+ }
+ if (emit_j4) {
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x2100u >> 2);
+ in[nfin++] = 1u | (4u << 4);
+ }
if (emit_j2) {
in[nfin++] = 0x20000000u | (1u << 16) |
(0x2080u >> 2);
@@ -29773,6 +29809,18 @@ gr_page_unmapped:
* restores the legacy CONT-90 2-word runs.
*/
if (bind_binding) {
+ if (emit_j0) {
+ in[nfin++] = 0x20000000u | (2u << 16) |
+ (0x200cu >> 2);
+ in[nfin++] = 0x1au;
+ in[nfin++] = 0x0u;
+ }
+ if (emit_j4) {
+ in[nfin++] = 0x20000000u | (2u << 16) |
+ (0x210cu >> 2);
+ in[nfin++] = 0x1au;
+ in[nfin++] = 0x0u;
+ }
if (emit_j2) {
in[nfin++] = 0x20000000u | (2u << 16) |
(0x208cu >> 2);
@@ -29786,6 +29834,16 @@ gr_page_unmapped:
in[nfin++] = 0x0u;
}
} else {
+ if (emit_j0) {
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x200cu >> 2);
+ in[nfin++] = 0x1au;
+ }
+ if (emit_j4) {
+ in[nfin++] = 0x20000000u | (1u << 16) |
+ (0x210cu >> 2);
+ in[nfin++] = 0x1au;
+ }
if (emit_j2) {
in[nfin++] = 0x20000000u | (1u << 16) |
(0x208cu >> 2);
@@ -29817,8 +29875,12 @@ gr_page_unmapped:
* relocated-pair count, and the constant
* type runs can never be relocated.
*/
+ if (emit_j0)
+ nrun++;
if (emit_j2)
nrun++;
+ if (emit_j4)
+ nrun++;
if (emit_j5)
nrun++;
}
@@ -29832,9 +29894,10 @@ gr_page_unmapped:
win3d_n += nfin;
if (sph_bind_log < 64u) {
sph_bind_log++;
- pr_info("vgsp-gr: SPH-BIND emitted fam=0x%llx win-binds=%u j2=0x%llx j5=0x%llx j1-type=0x11 rc=0x1a initblk=17 win=%u (pre=%u) h=0x%x push=0x%llx\n",
+ pr_info("vgsp-gr: SPH-BIND emitted fam=0x%llx win-binds=%u j0=0x%llx j2=0x%llx j4=0x%llx j5=0x%llx j1-type=0x11 rc=0x1a initblk=17 win=%u (pre=%u) h=0x%x push=0x%llx\n",
fam, req->n_prog_binds,
- fam + 0x200u, fam,
+ fam + 0x900u, fam + 0x200u,
+ fam + 0x900u, fam,
win3d_n, nfin,
req->h_object,
req->push_va);
@@ -29845,9 +29908,10 @@ gr_page_unmapped:
orel, nrun, on, nfin, fam,
req->h_object, req->push_va);
}
- pr_info("vgsp-gr: SPH-BIND-MASK mask=0x%x all=%u j2=%u j5=%u h=0x%x push=0x%llx\n",
+ pr_info("vgsp-gr: SPH-BIND-MASK mask=0x%x all=%u j0=%u j2=%u j4=%u j5=%u h=0x%x push=0x%llx\n",
sph_bind_mask, sph_bind_all ? 1u : 0u,
- emit_j2 ? 1u : 0u, emit_j5 ? 1u : 0u,
+ emit_j0 ? 1u : 0u, emit_j2 ? 1u : 0u,
+ emit_j4 ? 1u : 0u, emit_j5 ? 1u : 0u,
req->h_object, req->push_va);
}
/*
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 5348c95..dafbad6 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -26481,6 +26481,17 @@ unsigned gsp_sema_push_hold_ms = 2500;
*/
unsigned gsp_sema_gr_setup_hold_ms;
+/*
+ * SESSION 155 CONT 8: per-boot draw-window hold deadline for the same
+ * parameter. While it is open, an immature beef window is busy-deferred
+ * (candidate survives, pump re-offers it) instead of being software-
+ * completed by IMMATURE-SKIP, so the pump keeps walking the held setup-push
+ * entry and a late pin/upload can still mature the capture. Armed once per
+ * module load (= per boot) and bounded by the clamped param (<= 2000 ms).
+ */
+static unsigned long svc_setup_hold_wait_j;
+static bool svc_setup_hold_exp_logged;
+
static unsigned long svc_gr_ring_tried; /* ranks that got a diagnostic line */
/*
@@ -26610,14 +26621,26 @@ static void svc_gr_setup_hold_arm(struct svc_channel *ch, u64 va, u32 idx,
*/
svc_pushfail_log = 0;
svc_pinrej_log = 0;
- if (gsp_sema_gr_setup_hold_ms)
+ /*
+ * SESSION 155 CONT 8: the hold is hard-bounded at 2000 ms.
+ * Longer values (the old r1083-r1087 20 s experiment) block
+ * the whole ring behind the unreadable setup entry and derail
+ * the client; 0 still disables the hold (demand rows remain).
+ */
+ if (gsp_sema_gr_setup_hold_ms) {
+ unsigned hold_ms = min_t(unsigned,
+ READ_ONCE(gsp_sema_gr_setup_hold_ms),
+ 2000u);
+
ch->gr_setup_hold_until = jiffies +
- msecs_to_jiffies(gsp_sema_gr_setup_hold_ms);
- else
+ msecs_to_jiffies(hold_ms);
+ } else {
ch->gr_setup_hold_until = 0;
- pr_info("sema-chan: GR setup hold h=0x%x entry=%u va=0x%llx len=%u armed (demanding 4K pages; hold=%u ms; pending until the pin lands)\n",
+ }
+ pr_info("sema-chan: GR setup hold h=0x%x entry=%u va=0x%llx len=%u armed (demanding 4K pages; hold=%u ms clamped<=2000; pending until the pin lands)\n",
ch->h_object, idx, va, len,
- gsp_sema_gr_setup_hold_ms);
+ ch->gr_setup_hold_until ?
+ jiffies_to_msecs(ch->gr_setup_hold_until - jiffies) : 0u);
}
for (poff = 0; poff < len && poff < 0x40000u; poff += SEMA_PAGE_SIZE) {
svc_log_stalled_va(page + poff);
@@ -36971,6 +36994,46 @@ static bool svc_gr_request(struct nv_vgpu_device *vgpu,
(ch->h_object & 0xfffff000u) == 0xbeef0000u &&
READ_ONCE(svc_mme_prelude_flag) &&
!gsp_sema_mme_prelude_mature()) {
+ unsigned hold_ms =
+ min_t(unsigned, READ_ONCE(gsp_sema_gr_setup_hold_ms),
+ 2000u);
+
+ /*
+ * SESSION 155 CONT 8: bounded setup-push draw-window hold.
+ * Instead of immediately software-completing an immature
+ * beef window, keep the candidate pending (busy-defer, no
+ * bridge fallback) while a per-boot deadline of
+ * sema_gr_setup_hold_ms (clamped <= 2000 ms) is open. The
+ * pump re-offers the window on every pass and keeps walking
+ * the held setup-push entry, so a pin/upload that lands
+ * inside the window matures the capture and the next retry
+ * forwards the client's real window. Past the deadline the
+ * historical IMMATURE-SKIP resumes, one loud receipt.
+ */
+ if (hold_ms && !svc_setup_hold_wait_j)
+ svc_setup_hold_wait_j = jiffies +
+ msecs_to_jiffies(hold_ms);
+ if (hold_ms && time_before(jiffies, svc_setup_hold_wait_j)) {
+ clear_bit_unlock(SVC_FWD_INFLIGHT, &svc_fwd_state);
+ mutex_unlock(&svc_fwd_lock);
+ svc_gr_busy_defer = true;
+ svc.fwd_gr_refused++;
+ svc_gr_prelude_gate_defer++;
+ if (svc_gr_prelude_gate_defer <= 24 ||
+ (svc_gr_prelude_gate_defer & 0xFF) == 1)
+ pr_info("vgsp-work: SETUP-HOLD-DEFER h=0x%x push=0x%llx (MME prelude immature; holding the window for the setup pin, remaining=%u ms) n=%llu\n",
+ ch->h_object, svc_gr_cand.push_va,
+ jiffies_to_msecs(svc_setup_hold_wait_j -
+ jiffies),
+ svc_gr_prelude_gate_defer);
+ return false;
+ }
+ if (hold_ms && !svc_setup_hold_exp_logged) {
+ svc_setup_hold_exp_logged = true;
+ pr_info("vgsp-work: SETUP-HOLD-EXPIRED h=0x%x push=0x%llx (hold=%u ms elapsed, prelude still immature; resuming IMMATURE-SKIP) n=%llu\n",
+ ch->h_object, svc_gr_cand.push_va, hold_ms,
+ svc_gr_prelude_gate_defer);
+ }
clear_bit_unlock(SVC_FWD_INFLIGHT, &svc_fwd_state);
mutex_unlock(&svc_fwd_lock);
svc.fwd_gr_refused++;
diff --git a/kernel/main.c b/kernel/main.c
index 6902b48..e17840a 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -2828,7 +2828,7 @@ MODULE_PARM_DESC(sema_push_hold_ms, "CE unreadable-entry work-before-release hol
* families, so the hold only delays the ring (see gsp_sema_service.c).
*/
module_param_named(sema_gr_setup_hold_ms, gsp_sema_gr_setup_hold_ms, uint, 0644);
-MODULE_PARM_DESC(sema_gr_setup_hold_ms, "GR setup-push (MME-setup/>=12KB) pending hold in ms (default 0 = off; 20000 = aggressive, needs a resolvable demand family)");
+MODULE_PARM_DESC(sema_gr_setup_hold_ms, "GR setup-push hold in ms (default 0 = off; clamped <=2000): the unreadable 60216 B MME-setup entry stays pending and immature beef draw windows busy-defer instead of IMMATURE-SKIP until the pin/upload lands or the window expires");
/*
* Grace window (ms) an untranslatable GR entry stays pending before the pump