diff options
| -rw-r--r-- | kernel/gsp_phys_booter.c | 78 | ||||
| -rw-r--r-- | kernel/gsp_sema_service.c | 29 | ||||
| -rw-r--r-- | kernel/gsp_sema_service.h | 2 |
3 files changed, 79 insertions, 30 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 54716e7..a102e04 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -19527,9 +19527,10 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, { static u32 vs_scan_n; - u64 scan_va = 0, slot2_va = 0; - u32 scan_off = 0, vcall[3]; + u64 scan_va = 0, slot2_va = 0, slot2_end = 0; + u32 scan_off = 0, vcall[5]; bool scan_ok = false, have_call = false; + bool vs_size_added = false; if (READ_ONCE(gsp_phys_rmcall_gr_vs_autobind) && vs_scan_n < 4u) { @@ -19546,9 +19547,17 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, * as the base (the patch relocates it like any * 0x1c00 pair). */ - if (gsp_sema_gl_vs_call(vcall) && vcall[2] && - !(vcall[2] & 3u) && vcall[2] >= 0x1000u) { - slot2_va = (u64)vcall[2]; + /* + * Payload = [stream, end_hi, end_lo, base_hi, base_lo] + * (the existing 0x3810 MME-VSTREAM patch knows this + * shape). The BASE is vcall[4]; the END is vcall[2]. + */ + if (gsp_sema_gl_vs_call(vcall) && !vcall[1] && + !vcall[3] && vcall[4] && !(vcall[4] & 3u) && + vcall[4] >= 0x1000u) { + slot2_va = (u64)vcall[4]; + slot2_end = (u64)vcall[2] > slot2_va ? + (u64)vcall[2] : 0; have_call = true; } for (vj = 0; vj < 8u; vj++) { @@ -19579,8 +19588,12 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, vs_pre[vs_n++] = vfmt; vs_pre[vs_n++] = (u32)(vva >> 32) & 0xffu; vs_pre[vs_n++] = (u32)vva & 0xfffffffcULL; - pr_info("vgsp-gr: MME-VS-BIND synth j=%u base=0x%llx fmt=0x%x src=%s h=0x%x push=0x%llx\n", - vj, (unsigned long long)vva, vfmt, + pr_info("vgsp-gr: MME-VS-BIND synth j=%u base=0x%llx end=0x%llx fmt=0x%x src=%s h=0x%x push=0x%llx\n", + vj, (unsigned long long)vva, + (vj == 0u && have_call && + vva == slot2_va) ? + (unsigned long long)slot2_end : 0ULL, + vfmt, (vj == 0u && have_call && vva == slot2_va) ? "slot2" : (vj == 0u && scan_ok && @@ -19639,14 +19652,20 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, if (vj == 0u && READ_ONCE(gsp_phys_rmcall_gr_vs_autobind) >= 2u && vs_n + 3u <= ARRAY_SIZE(vs_pre)) { + u32 sz = (have_call && slot2_end && + slot2_end > slot2_va) ? + (u32)(slot2_end - slot2_va) : + 0x00100000u; + 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 h=0x%x push=0x%llx\n", - req->h_object, req->push_va); + vs_pre[vs_n++] = sz; + vs_size_added = true; + pr_info("vgsp-gr: MME-VS-SIZE synth j=0 size=0x%x h=0x%x push=0x%llx\n", + sz, req->h_object, req->push_va); } } /* @@ -19655,16 +19674,22 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, * stream size; bind it here so the fetch is not * clamped to zero. */ - if (READ_ONCE(gsp_phys_rmcall_gr_vs_autobind) >= 2u && + if (!vs_size_added && + 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)) { + u32 sz2 = (have_call && slot2_end && + slot2_end > slot2_va) ? + (u32)(slot2_end - slot2_va) : + 0x00100000u; + 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); + vs_pre[vs_n++] = sz2; + pr_info("vgsp-gr: MME-VS-SIZE synth j=0 size=0x%x (window has VS) h=0x%x push=0x%llx\n", + sz2, req->h_object, req->push_va); } /* * eng77: the client's VERTEX_STREAM_TURING macro @@ -19674,21 +19699,32 @@ static void gsp_phys_gr_mme_release_save(const struct gsp_phys_gr_submit *req, * captured call before the DRAW_IAB. */ { - u32 vcall[3]; + u32 vcall[5]; - 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)) { + /* + * eng83: replay the FULL 5-word + * [stream, end_hi, end_lo, base_hi, base_lo] + * even when the window carries its own + * 0x3810 call - the slot-34 reorder moves + * the DRAW_IAB ahead of it. The 0x3810 + * MME-VSTREAM patch maps [base,end] into + * one contiguous shadow line. + */ + if (gsp_sema_gl_vs_call(vcall) && + !vcall[1] && !vcall[3] && + vs_n + 6u <= ARRAY_SIZE(vs_pre)) { vs_pre[vs_n++] = (5u << 29) | - (3u << 16) | + (5u << 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", + vs_pre[vs_n++] = vcall[3]; + vs_pre[vs_n++] = vcall[4]; + pr_info("vgsp-gr: MME-VS-CALL synth 0x3810 payload=%08x,%08x,%08x,%08x,%08x h=0x%x push=0x%llx\n", vcall[0], vcall[1], vcall[2], + vcall[3], vcall[4], req->h_object, req->push_va); } } diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index aeddb7f..4cd2eca 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -9808,7 +9808,7 @@ static u32 svc_gl_vs_log; * 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 u32 svc_gl_vs_call[5]; static u8 svc_gl_vs_call_ok; static u32 svc_gl_vs_call_log; @@ -9819,6 +9819,8 @@ bool gsp_sema_gl_vs_call(u32 out[3]) 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]); + out[3] = READ_ONCE(svc_gl_vs_call[3]); + out[4] = READ_ONCE(svc_gl_vs_call[4]); return true; } @@ -10971,11 +10973,16 @@ static void svc_gl_field(u32 addr, u32 count, const u8 *data, u32 dlen) if (addr == 0x3810u) { u32 k; - for (k = 1; k < count && k < 4u; k++) { + /* + * [stream, end_hi, end_lo, base_hi, base_lo]: collect the + * 32-bit end/base words (v[2], v[4]) - the base page carries + * the vertex payload. + */ + for (k = 2; k < count && k < 5u; k++) { u32 w = v[k]; if (w >= 0x100000u && w < 0x1000000000ULL && - !(w & 3u)) + !(w & 3u) && (k == 2u || k == 4u)) svc_gl_add_ptr((u64)w); } return; @@ -18362,7 +18369,7 @@ static void svc_mme_census(const u8 *buf, u32 len, u64 push_va, u32 h_object) (addr >= 0x1c00u && addr <= 0x1cf8u) || (addr >= 0x3400u && addr <= 0x34fcu) || (addr >= 0x3800u && addr <= 0x39fcu)) { - u32 v0 = 0, v1 = 0, v2 = 0; + u32 v0 = 0, v1 = 0, v2 = 0, v3 = 0, v4 = 0; if (off + 8 <= len) memcpy(&v0, buf + off + 4, 4); @@ -18370,23 +18377,29 @@ 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); + if (off + 20 <= len) + memcpy(&v3, buf + off + 16, 4); + if (off + 24 <= len) + memcpy(&v4, buf + off + 20, 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) { + if (addr == 0x3810u && off + 24 <= len) { bool changed = !READ_ONCE(svc_gl_vs_call_ok) || - READ_ONCE(svc_gl_vs_call[2]) != v2; + READ_ONCE(svc_gl_vs_call[4]) != v4; 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[3], v3); + WRITE_ONCE(svc_gl_vs_call[4], v4); 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); + pr_info("sema-gl: VS-CALL 0x3810 payload=%08x,%08x,%08x,%08x,%08x\n", + v0, v1, v2, v3, v4); } } lc += scnprintf(line + lc, sizeof(line) - lc, diff --git a/kernel/gsp_sema_service.h b/kernel/gsp_sema_service.h index 4a739da..c74d46d 100644 --- a/kernel/gsp_sema_service.h +++ b/kernel/gsp_sema_service.h @@ -629,7 +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]); +bool gsp_sema_gl_vs_call(u32 out[5]); /* * Golden SA completion (sema_gl_mme_sa_golden_fill): set the host-side |
