diff options
Diffstat (limited to 'kernel/gsp_phys_booter.c')
| -rw-r--r-- | kernel/gsp_phys_booter.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index a102e04..ea6b1ae 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -20163,6 +20163,86 @@ bool gsp_phys_gr_mme_release_fill(struct gsp_phys_gr_submit *out) sizeof(out->prog_bind_slot)); out->mme_release = true; /* No guest release/semaphore: rel_* and sem_* stay zero. */ + /* + * eng84: the held window is often saved BEFORE the client's + * VERTEX_STREAM_TURING CALL(2) is captured (the 0x3810 run + * lives in a later push); the fire happens seconds later, + * when the sticky payload exists. Re-run the state prepend + * here with the now-current payload: [0x1c00 the base] + * [0x600 end-base] [0x3810 the full 5-word call], skipping + * anything the saved window already carries. + */ + if (READ_ONCE(gsp_phys_rmcall_gr_vs_autobind)) { + u32 vcall[5], pre[24], pre_n = 0; + u32 base = 0, end = 0, sz = 0x100000u, r = 0; + bool has_pair = false, has_size = false; + bool has_call = false, have = false; + + if (gsp_sema_gl_vs_call(vcall) && !vcall[1] && + !vcall[3] && vcall[4] >= 0x1000u && + !(vcall[4] & 3u)) { + base = vcall[4]; + if (vcall[2] > base && + vcall[2] - base <= 0x1000000u) + end = vcall[2]; + if (end) + sz = end - base; + have = true; + } + while (r < s->stream_n) { + u32 h = s->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 <= s->stream_n) + span = 1u + cnt; + if (m0 == 0x1c00u && span >= 4u) + has_pair = true; + if (m0 == 0x600u && span >= 3u) + has_size = true; + if (m0 == 0x3810u) + has_call = true; + r += span; + } + if (have && !has_pair && pre_n + 4u <= + ARRAY_SIZE(pre)) { + pre[pre_n++] = (1u << 29) | (3u << 16) | + ((0x1c00u >> 2) & 0xfffu); + pre[pre_n++] = 0x1014u; + pre[pre_n++] = (base >> 32) & 0xffu; + pre[pre_n++] = base & 0xfffffffcU; + } + if (have && !has_size && pre_n + 3u <= + ARRAY_SIZE(pre)) { + pre[pre_n++] = (1u << 29) | (2u << 16) | + ((0x600u >> 2) & 0xfffu); + pre[pre_n++] = 0u; + pre[pre_n++] = sz; + } + if (have && !has_call && pre_n + 6u <= + ARRAY_SIZE(pre)) { + pre[pre_n++] = (5u << 29) | (5u << 16) | + ((0x3810u >> 2) & 0xfffu); + pre[pre_n++] = vcall[0]; + pre[pre_n++] = vcall[1]; + pre[pre_n++] = vcall[2]; + pre[pre_n++] = vcall[3]; + pre[pre_n++] = vcall[4]; + } + if (pre_n && + s->stream_n + pre_n <= + GSP_PHYS_GR_MME_RELEASE_WIN_MAX) { + memmove(s->win + pre_n, s->win, + (size_t)s->stream_n * 4u); + memcpy(s->win, pre, (size_t)pre_n * 4u); + out->stream_n = s->stream_n + pre_n; + pr_info("vgsp-gr: MME-VS-FILL base=0x%x end=0x%x size=0x%x pre=%u h=0x%x\n", + base, end, sz, pre_n, s->h_object); + } + } } spin_unlock_irqrestore(&gsp_phys_gr_mme_release_lock, flags); return ok; |
