]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe/lrc: Allow INDIRECT_CTX for more engine classes
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 16 Sep 2025 21:15:42 +0000 (14:15 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 18 Sep 2025 21:20:39 +0000 (14:20 -0700)
Currently it's only allowed for render and compute. Going forward we
want to enable it for more engine classes. Let the XE_LRC_FLAG_INDIRECT_CTX
flag (and thus gt_engine_needs_indirect_ctx()) be the deciding factor
for its availability.

While at it, add the missing const to rcs_funcs array. Since
CTX_INDIRECT_CTX_OFFSET_DEFAULT already matches the HW default and
gt_engine_needs_indirect_ctx() only ever enables it for rcs/ccs, there
is no change in behavior, it's only preparation for future use case.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250916-wa-bb-cmds-v5-5-306bddbc15da@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/regs/xe_lrc_layout.h
drivers/gpu/drm/xe/xe_lrc.c

index 1b101edb838bf5e32df52edea8ae29aebbd5f8a5..b5eff383902c5fb49e29d8b4644d5c991239427e 100644 (file)
@@ -40,7 +40,4 @@
 #define INDIRECT_CTX_RING_START_UDW    (0x08 + 1)
 #define INDIRECT_CTX_RING_CTL          (0x0a + 1)
 
-#define CTX_INDIRECT_CTX_OFFSET_MASK   REG_GENMASK(15, 6)
-#define CTX_INDIRECT_CTX_OFFSET_DEFAULT        REG_FIELD_PREP(CTX_INDIRECT_CTX_OFFSET_MASK, 0xd)
-
 #endif
index c706585611d55197a891ec436580b0a98020e31c..0ab99c210d8829adaf98c24a5efa6832cae89578 100644 (file)
@@ -1281,9 +1281,11 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
 static int
 setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
 {
-       static struct bo_setup rcs_funcs[] = {
+       static const struct bo_setup rcs_funcs[] = {
                { .setup = setup_timestamp_wa },
        };
+       static const struct bo_setup xcs_funcs[] = {
+       };
        struct bo_setup_state state = {
                .lrc = lrc,
                .hwe = hwe,
@@ -1300,6 +1302,9 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
            hwe->class == XE_ENGINE_CLASS_COMPUTE) {
                state.funcs = rcs_funcs;
                state.num_funcs = ARRAY_SIZE(rcs_funcs);
+       } else {
+               state.funcs = xcs_funcs;
+               state.num_funcs = ARRAY_SIZE(xcs_funcs);
        }
 
        if (xe_gt_WARN_ON(lrc->gt, !state.funcs))
@@ -1326,14 +1331,15 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
        finish_bo(&state);
        kfree(state.buffer);
 
+       /*
+        * Enable INDIRECT_CTX leaving INDIRECT_CTX_OFFSET at its default: it
+        * varies per engine class, but the default is good enough
+        */
        xe_lrc_write_ctx_reg(lrc,
                             CTX_CS_INDIRECT_CTX,
                             (xe_bo_ggtt_addr(lrc->bo) + state.offset) |
                             /* Size in CLs. */
                             (state.written * sizeof(u32) / 64));
-       xe_lrc_write_ctx_reg(lrc,
-                            CTX_CS_INDIRECT_CTX_OFFSET,
-                            CTX_INDIRECT_CTX_OFFSET_DEFAULT);
 
        return 0;
 }