summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_sema_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_sema_service.c')
-rw-r--r--kernel/gsp_sema_service.c52
1 files changed, 50 insertions, 2 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 8cc7aaa..4b3c24c 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -9116,7 +9116,7 @@ static struct svc_fwd_cand svc_fwd_cand;
* method-aligned svc_gl_stream_chunks() split (<=448-word chunks, six
* per frame) can run. Must stay equal to GSP_PHYS_GR_RAW_WORDS.
*/
-#define SVC_GR_PUSH_WORDS 4096
+#define SVC_GR_PUSH_WORDS 16384
#define SVC_GR_QMD_WORD_NONE 0xffffffffu
/* svc_gr_cand.rel_flags bits (decoded from qmd[24] and qmd[4]). */
#define SVC_GR_REL_REDUCTION 0x1u
@@ -9250,7 +9250,7 @@ struct svc_gr_cand_rec {
* evict its own later chunks (or the X channel's pending candidate) before
* the pump drained them.
*/
-#define SVC_GR_CAND_RING 8
+#define SVC_GR_CAND_RING 32
static struct svc_gr_cand_rec svc_gr_cand_ring[SVC_GR_CAND_RING];
static u32 svc_gr_cand_pos;
#define svc_gr_cand (svc_gr_cand_ring[svc_gr_cand_pos])
@@ -12105,6 +12105,27 @@ module_param_named(sema_gl_win_rt0_admit, svc_gl_rt0_class_admit, bool, 0644);
MODULE_PARM_DESC(sema_gl_win_rt0_admit,
"Admit a beef draw-synth window to the verbatim replay lane when its FIRST colour-target write is a usable surface-class bind even if the last-write heuristic refuses it (default 1)");
+/*
+ * eng89i: method-header plausibility for window-start alignment. The
+ * direct-GL draw push's section opener can point at a data word (c949-c951:
+ * start=0x78 where w0=0x3f800000 parses as op=1 cnt=0xf80 and swallows the
+ * window as data; the real BEGIN run starts at 0xe8). A real method header
+ * uses op 1/3/4/5 with a plausible count and method address.
+ */
+static bool svc_gl_hdr_plausible(const u8 *p, u32 rem)
+{
+ u32 w, op, cnt, m;
+
+ if (!p || rem < 4u)
+ return false;
+ memcpy(&w, p, 4);
+ op = (w >> 29) & 7u;
+ cnt = (w >> 16) & 0xfffu;
+ m = (w & 0x1fffu) << 2;
+ return (op == 1u || op == 3u || op == 4u || op == 5u) &&
+ cnt <= 0x400u && m <= 0x3ffcu;
+}
+
static bool svc_gl_window_rt_first_valid(const u8 *buf, u32 len, u32 start_off,
u32 at_off)
{
@@ -23161,6 +23182,33 @@ static void svc_decode_stream(struct nv_vgpu_device *vgpu, const u8 *buf,
u32 keep_pay = svc_gl.rel_payload;
u32 wstart = gl_win_start ? gl_win_start : off;
+ /*
+ * eng89i: snap a data-led start to the first plausible
+ * method header within 0x400 bytes. Without this the
+ * first replay chunk parses data as methods and the
+ * lane poisons (c949-c951).
+ */
+ if (gl_win_start &&
+ !svc_gl_hdr_plausible(buf + wstart, len - wstart)) {
+ u32 scan;
+
+ for (scan = wstart + 4u;
+ scan + 4u <= len && scan <= wstart + 0x400u;
+ scan += 4u) {
+ if (svc_gl_hdr_plausible(buf + scan,
+ len - scan)) {
+ if (svc_gl_np_log < 64) {
+ svc_gl_np_log++;
+ pr_info("sema-gl: WIN-START-SNAP h=0x%x push=0x%llx old=0x%x new=0x%x\n",
+ ch->h_object,
+ push_va,
+ wstart, scan);
+ }
+ wstart = scan;
+ break;
+ }
+ }
+ }
memset(&svc_gl, 0, sizeof(svc_gl));
svc_gl.seen = true;
svc_gl.subch = subch;