Skip to content

Commit c9dfd66

Browse files
author
Lucas De Marchi
committed
drm/xe/lrc: Allow INDIRECT_CTX for more engine classes
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>
1 parent 39ac06f commit c9dfd66

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

drivers/gpu/drm/xe/regs/xe_lrc_layout.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,4 @@
4040
#define INDIRECT_CTX_RING_START_UDW (0x08 + 1)
4141
#define INDIRECT_CTX_RING_CTL (0x0a + 1)
4242

43-
#define CTX_INDIRECT_CTX_OFFSET_MASK REG_GENMASK(15, 6)
44-
#define CTX_INDIRECT_CTX_OFFSET_DEFAULT REG_FIELD_PREP(CTX_INDIRECT_CTX_OFFSET_MASK, 0xd)
45-
4643
#endif

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,11 @@ static int setup_wa_bb(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
12811281
static int
12821282
setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
12831283
{
1284-
static struct bo_setup rcs_funcs[] = {
1284+
static const struct bo_setup rcs_funcs[] = {
12851285
{ .setup = setup_timestamp_wa },
12861286
};
1287+
static const struct bo_setup xcs_funcs[] = {
1288+
};
12871289
struct bo_setup_state state = {
12881290
.lrc = lrc,
12891291
.hwe = hwe,
@@ -1300,6 +1302,9 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
13001302
hwe->class == XE_ENGINE_CLASS_COMPUTE) {
13011303
state.funcs = rcs_funcs;
13021304
state.num_funcs = ARRAY_SIZE(rcs_funcs);
1305+
} else {
1306+
state.funcs = xcs_funcs;
1307+
state.num_funcs = ARRAY_SIZE(xcs_funcs);
13031308
}
13041309

13051310
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)
13261331
finish_bo(&state);
13271332
kfree(state.buffer);
13281333

1334+
/*
1335+
* Enable INDIRECT_CTX leaving INDIRECT_CTX_OFFSET at its default: it
1336+
* varies per engine class, but the default is good enough
1337+
*/
13291338
xe_lrc_write_ctx_reg(lrc,
13301339
CTX_CS_INDIRECT_CTX,
13311340
(xe_bo_ggtt_addr(lrc->bo) + state.offset) |
13321341
/* Size in CLs. */
13331342
(state.written * sizeof(u32) / 64));
1334-
xe_lrc_write_ctx_reg(lrc,
1335-
CTX_CS_INDIRECT_CTX_OFFSET,
1336-
CTX_INDIRECT_CTX_OFFSET_DEFAULT);
13371343

13381344
return 0;
13391345
}

0 commit comments

Comments
 (0)