diff options
Diffstat (limited to 'kernel/gsp_phys_booter.c')
| -rw-r--r-- | kernel/gsp_phys_booter.c | 78 |
1 files changed, 57 insertions, 21 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); } } |
