Skip to content

Commit 1460bb1

Browse files
committed
drm/xe: Force write completion of MI_STORE_DATA_IMM
With Force write completion unset there is no guarantees of when the write will be globally visible what is not the behavior wanted. Fixes: 9c57bc0 ("drm/xe/lnl: Drop force_probe requirement") Signed-off-by: José Roberto de Souza <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5637797 commit 1460bb1

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

drivers/gpu/drm/xe/instructions/xe_mi_commands.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
#define MI_TOPOLOGY_FILTER __MI_INSTR(0xD)
3434
#define MI_FORCE_WAKEUP __MI_INSTR(0x1D)
3535

36-
#define MI_STORE_DATA_IMM __MI_INSTR(0x20)
37-
#define MI_SDI_GGTT REG_BIT(22)
38-
#define MI_SDI_LEN_DW GENMASK(9, 0)
39-
#define MI_SDI_NUM_DW(x) REG_FIELD_PREP(MI_SDI_LEN_DW, (x) + 3 - 2)
40-
#define MI_SDI_NUM_QW(x) (REG_FIELD_PREP(MI_SDI_LEN_DW, 2 * (x) + 3 - 2) | \
41-
REG_BIT(21))
36+
#define MI_STORE_DATA_IMM __MI_INSTR(0x20)
37+
#define MI_SDI_GGTT REG_BIT(22)
38+
#define MI_FORCE_WRITE_COMPLETION_CHECK REG_BIT(10)
39+
#define MI_SDI_LEN_DW GENMASK(9, 0)
40+
#define MI_SDI_NUM_DW(x) REG_FIELD_PREP(MI_SDI_LEN_DW, (x) + 3 - 2)
41+
#define MI_SDI_NUM_QW(x) (REG_FIELD_PREP(MI_SDI_LEN_DW, 2 * (x) + 3 - 2) | \
42+
REG_BIT(21))
4243

4344
#define MI_LOAD_REGISTER_IMM __MI_INSTR(0x22)
4445
#define MI_LRI_LRM_CS_MMIO REG_BIT(19)

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ static void emit_pte(struct xe_migrate *m,
581581
while (ptes) {
582582
u32 chunk = min(MAX_PTE_PER_SDI, ptes);
583583

584-
bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_NUM_QW(chunk);
584+
bb->cs[bb->len++] = MI_STORE_DATA_IMM |
585+
MI_FORCE_WRITE_COMPLETION_CHECK |
586+
MI_SDI_NUM_QW(chunk);
585587
bb->cs[bb->len++] = ofs;
586588
bb->cs[bb->len++] = 0;
587589

@@ -1223,7 +1225,9 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,
12231225
if (!(bb->len & 1))
12241226
bb->cs[bb->len++] = MI_NOOP;
12251227

1226-
bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_NUM_QW(chunk);
1228+
bb->cs[bb->len++] = MI_STORE_DATA_IMM |
1229+
MI_FORCE_WRITE_COMPLETION_CHECK |
1230+
MI_SDI_NUM_QW(chunk);
12271231
bb->cs[bb->len++] = lower_32_bits(addr);
12281232
bb->cs[bb->len++] = upper_32_bits(addr);
12291233
if (pt_op->bind)
@@ -1388,7 +1392,8 @@ __xe_migrate_update_pgtables(struct xe_migrate *m,
13881392
u32 idx = 0;
13891393

13901394
bb->cs[bb->len++] = MI_STORE_DATA_IMM |
1391-
MI_SDI_NUM_QW(chunk);
1395+
MI_FORCE_WRITE_COMPLETION_CHECK |
1396+
MI_SDI_NUM_QW(chunk);
13921397
bb->cs[bb->len++] = ofs;
13931398
bb->cs[bb->len++] = 0; /* upper_32_bits */
13941399

drivers/gpu/drm/xe/xe_oa.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ static void xe_oa_store_flex(struct xe_oa_stream *stream, struct xe_lrc *lrc,
690690
u32 offset = xe_bo_ggtt_addr(lrc->bo);
691691

692692
do {
693-
bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_GGTT | MI_SDI_NUM_DW(1);
693+
bb->cs[bb->len++] = MI_STORE_DATA_IMM | MI_SDI_GGTT |
694+
MI_FORCE_WRITE_COMPLETION_CHECK |
695+
MI_SDI_NUM_DW(1);
694696
bb->cs[bb->len++] = offset + flex->offset * sizeof(u32);
695697
bb->cs[bb->len++] = 0;
696698
bb->cs[bb->len++] = flex->value;

drivers/gpu/drm/xe/xe_ring_ops.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ static int emit_user_interrupt(u32 *dw, int i)
7272

7373
static int emit_store_imm_ggtt(u32 addr, u32 value, u32 *dw, int i)
7474
{
75-
dw[i++] = MI_STORE_DATA_IMM | MI_SDI_GGTT | MI_SDI_NUM_DW(1);
75+
dw[i++] = MI_STORE_DATA_IMM | MI_SDI_GGTT |
76+
MI_FORCE_WRITE_COMPLETION_CHECK | MI_SDI_NUM_DW(1);
7677
dw[i++] = addr;
7778
dw[i++] = 0;
7879
dw[i++] = value;
@@ -162,7 +163,8 @@ static int emit_pipe_invalidate(u32 mask_flags, bool invalidate_tlb, u32 *dw,
162163
static int emit_store_imm_ppgtt_posted(u64 addr, u64 value,
163164
u32 *dw, int i)
164165
{
165-
dw[i++] = MI_STORE_DATA_IMM | MI_SDI_NUM_QW(1);
166+
dw[i++] = MI_STORE_DATA_IMM | MI_FORCE_WRITE_COMPLETION_CHECK |
167+
MI_SDI_NUM_QW(1);
166168
dw[i++] = lower_32_bits(addr);
167169
dw[i++] = upper_32_bits(addr);
168170
dw[i++] = lower_32_bits(value);

0 commit comments

Comments
 (0)