]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Allow specifying number of extra dwords at the end of wa bb emission
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fri, 11 Jul 2025 16:01:50 +0000 (17:01 +0100)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 14 Jul 2025 15:06:55 +0000 (08:06 -0700)
Indirect context setup will need more than one.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20250711160153.49833-6-tvrtko.ursulin@igalia.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_lrc.c

index 16921605fa6d9150ddc8d3f271caf91cbc08e653..f9b8e6e94828b2d451f90c671e9bc208472b6921 100644 (file)
@@ -984,6 +984,7 @@ struct bo_setup_state {
        struct xe_lrc           *lrc;
        struct xe_hw_engine     *hwe;
        size_t                  max_size;
+       size_t                  reserve_dw;
        unsigned int            offset;
        const struct bo_setup   *funcs;
        unsigned int            num_funcs;
@@ -1017,10 +1018,10 @@ static int setup_bo(struct bo_setup_state *state)
                remain -= len;
 
                /*
-                * There should always be at least 1 additional dword for
-                * the end marker
+                * Caller has asked for at least reserve_dw to remain unused.
                 */
-               if (len < 0 || xe_gt_WARN_ON(state->lrc->gt, remain < 1))
+               if (len < 0 ||
+                   xe_gt_WARN_ON(state->lrc->gt, remain < state->reserve_dw))
                        goto fail;
 
                state->ptr += len;
@@ -1054,6 +1055,7 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
                .lrc = lrc,
                .hwe = hwe,
                .max_size = LRC_WA_BB_SIZE,
+               .reserve_dw = 1,
                .offset = __xe_lrc_wa_bb_offset(lrc),
                .funcs = funcs,
                .num_funcs = ARRAY_SIZE(funcs),