LRC debugfs and general instruction tweaks
Subsystems (2)
cover LRC debugfs and general instruction tweaks
During device probe, workarounds that target registers in an engine's LRC image are applied and then a snapshot of the context image is saved as the "default LRC" which is later copied as the starting point for all new contexts. Internally the engine state is encoded as a batchbuffer that the hardware can execute on context switch to restore the relevant registers and other state information.
"LRC workarounds" are those which target registers that are part of the an engine's LRC; the driver programs the registers with the desired updates before triggering creation of the default LRC snapshot, thus ensuring that the necessary settings are inherited by all new contexts that get created.
There's an upcoming workaround that will require the driver to emit not only updates to specific registers at driver init, but also some non-register state (e.g., 3DSTATE_* instructions) before snapshotting the default LRC. This is also expected to become necessary for non-workaround initialization on future platforms as well.
Before we start making these updates to the initial engine state and default LRC, it's helpful to be able to see exactly what's inside the context image. The changes here add some debugfs entries that dump each engine type's default LRC with some basic instruction header decoding. E.g.,
$ sudo cat /sys/kernel/debug/dri/0/gt0/default_lrc_ccs
MI_NOOP (1 dwords)
MI_LOAD_REGISTER_IMM: 15 regs
- 0x1a244 = 0xffff0048
- 0x1a034 = 0x000000f8
- 0x1a030 = 0x000000f8
- 0x1a038 = 0x00fc0000
- 0x1a03c = 0x00003001
- 0x1a168 = 0x00000000
- 0x1a140 = 0x00400004
- 0x1a110 = 0x00000000
- 0x1a1c0 = 0x00000000
- 0x1a1c4 = 0x00000000
- 0x1a1c8 = 0x00000000
- 0x1a180 = 0x00000080
- 0x1a2b4 = 0x00000000
- 0x1a120 = 0x00000000
- 0x1a124 = 0x00000000
MI_NOOP (1 dwords)
MI_LOAD_REGISTER_IMM: 9 regs
<...snip...>
MI_NOOP (6 dwords)
PIPELINE_SELECT (1 dwords)
STATE_BASE_ADDRESS (22 dwords)
STATE_SIP (3 dwords)
STATE_COMPUTE_MODE (2 dwords)
3DSTATE_BINDING_TABLE_POOL_ALLOC (4 dwords)
3DSTATE_CHROMA_KEY (4 dwords)
3DSTATE_CHROMA_KEY (4 dwords)
3DSTATE_BTD (6 dwords)
MI_NOOP (114 dwords)
MI_BATCH_BUFFER_ENDA few other changes are made to the general way GPU instructions are defined in the Xe driver to make the definitions more consistent and easier to re-use in the new dumping logic.
Matt Roper (6):
drm/xe: Make MI_FLUSH_DW immediate size more explicit drm/xe: Separate number of registers from MI_LRI opcode drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM drm/xe: Extract MI_* instructions to their own header drm/xe/debugfs: Add dump of default LRCs' MI instructions drm/xe/debugfs: Include GFXPIPE commands in LRC dump
.../drm/xe/instructions/xe_gfxpipe_commands.h | 107 ++++++++++ .../gpu/drm/xe/instructions/xe_inst_defs.h | 32 +++ .../gpu/drm/xe/instructions/xe_mi_commands.h | 61 ++++++ drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 33 ---- drivers/gpu/drm/xe/xe_bb.c | 1 + drivers/gpu/drm/xe/xe_execlist.c | 1 + drivers/gpu/drm/xe/xe_gt.c | 3 +- drivers/gpu/drm/xe/xe_gt_debugfs.c | 41 ++++ drivers/gpu/drm/xe/xe_lrc.c | 187 +++++++++++++++++- drivers/gpu/drm/xe/xe_lrc.h | 5 + drivers/gpu/drm/xe/xe_migrate.c | 10 +- drivers/gpu/drm/xe/xe_ring_ops.c | 21 +- 12 files changed, 450 insertions(+), 52 deletions(-) create mode 100644 drivers/gpu/drm/xe/instructions/xe_gfxpipe_commands.h create mode 100644 drivers/gpu/drm/xe/instructions/xe_inst_defs.h create mode 100644 drivers/gpu/drm/xe/instructions/xe_mi_commands.h
Signature · 1 line
2.41.0
PATCH 1/6 drm/xe: Make MI_FLUSH_DW immediate size more explicit
Despite its name, MI_FLUSH_DW instruction can write an immediate value of either dword size or qword size, depending on the 'length' field of the instruction. Since "length" excludes the first two dwords of the instruction, a value of 2 in the length field implies a dword write and a value of 3 implies a qword write. Even in cases where the flush instruction's post-sync operation is set to "no write" we're still expected to size the overall instruction as if we were doing a dword or qword write (i.e., a length of 1 shouldn't be used on modern platforms).
Rather than baking a size of "1" into the #define and then adding another unexplained "+ 1" at all the spots where the definition gets used, lets just create MI_FLUSH_IMM_DW and MI_FLUSH_IMM_QW definitions that should be OR'd into the instruction header to make it more explicit what behavior we're requesting.
Bspec: 60229
--- drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 5 ++++- drivers/gpu/drm/xe/xe_ring_ops.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +4 -1
@@ -30,12 +30,15 @@#define MI_LRI_MMIO_REMAP_EN REG_BIT(17)#define MI_LRI_FORCE_POSTED (1<<12) -#define MI_FLUSH_DW MI_INSTR(0x26, 1) +#define MI_FLUSH_DW MI_INSTR(0x26, 0)#define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)#define MI_FLUSH_DW_CCS (1<<16)#define MI_FLUSH_DW_OP_STOREDW (1<<14)#define MI_FLUSH_DW_USE_GTT (1<<2) +#define MI_FLUSH_LENGTH GENMASK(5, 0) +#define MI_FLUSH_IMM_DW REG_FIELD_PREP(MI_FLUSH_LENGTH, 2) +#define MI_FLUSH_IMM_QW REG_FIELD_PREP(MI_FLUSH_LENGTH, 3)#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 1)
drivers/gpu/drm/xe/xe_ring_ops.c +5 -5
@@ -80,7 +80,7 @@ static int emit_store_imm_ggtt(u32 addr, u32 value, u32 *dw, int i)static int emit_flush_imm_ggtt (u32 addr,u32 value,bool invalidate_tlb,u32 *dw,int i) { - dw[i++] = (MI_FLUSH_DW +1 ) |MI_FLUSH_DW_OP_STOREDW | + dw[i++] =MI_FLUSH_DW |MI_FLUSH_DW_OP_STOREDW |MI_FLUSH_IMM_DW | (invalidate_tlb ?MI_INVALIDATE_TLB :0 ); dw[i++] = addr |MI_FLUSH_DW_USE_GTT ; dw[i++] =0 ;
@@ -100,9 +100,9 @@ static int emit_bb_start(u64 batch_addr, u32 ppgtt_flag, u32 *dw, int i)static int emit_flush_invalidate (u32 flag,u32 *dw,int i) { - dw[i] =MI_FLUSH_DW +1 ; + dw[i] =MI_FLUSH_DW ; dw[i] |= flag; - dw[i++] |=MI_INVALIDATE_TLB |MI_FLUSH_DW_OP_STOREDW | + dw[i++] |=MI_INVALIDATE_TLB |MI_FLUSH_DW_OP_STOREDW |MI_FLUSH_IMM_DW |MI_FLUSH_DW_STORE_INDEX ; dw[i++] =LRC_PPHWSP_SCRATCH_ADDR |MI_FLUSH_DW_USE_GTT ;
@@ -365,8 +365,8 @@ static void emit_migration_job_gen12(struct xe_sched_job *job, i =emit_bb_start (job->batch_addr[1 ],BIT (8 ), dw, i); - dw[i++] = (MI_FLUSH_DW |MI_INVALIDATE_TLB | job->migrate_flush_flags | -MI_FLUSH_DW_OP_STOREDW ) +1 ; + dw[i++] =MI_FLUSH_DW |MI_INVALIDATE_TLB | job->migrate_flush_flags | +MI_FLUSH_DW_OP_STOREDW |MI_FLUSH_IMM_DW ; dw[i++] =xe_lrc_seqno_ggtt_addr (lrc) |MI_FLUSH_DW_USE_GTT ; dw[i++] =0 ; dw[i++] = seqno;/* value */
Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 1/6] drm/xe: Make MI_FLUSH_DW immediate size more explicit
Quoted 57 lines · Matt Roper
Despite its name,
MI_FLUSH_DWinstruction can write an immediate value of either dword size or qword size, depending on the 'length' field of the instruction. Since "length" excludes the first two dwords of the instruction, a value of 2 in the length field implies a dword write and a value of 3 implies a qword write. Even in cases where the flush instruction's post-sync operation is set to "no write" we're still expected to size the overall instruction as if we were doing a dword or qword write (i.e., a length of 1 shouldn't be used on modern platforms).Rather than baking a size of "1" into the #define and then adding another unexplained "+ 1" at all the spots where the definition gets used, lets just create
MI_FLUSH_IMM_DWandMI_FLUSH_IMM_QWdefinitions that should be OR'd into the instruction header to make it more explicit what behavior we're requesting.Bspec: 60229
Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/regs/xe_gpu_commands.h| 5 ++++-drivers/gpu/drm/xe/xe_ring_ops.c| 10 +++++-----2 files changed, 9 insertions(+), 6 deletions(-)drivers/gpu/drm/xe/regs/xe_gpu_commands.h +4
-1@@ -30,12 +30,15 @@#define MI_LRI_MMIO_REMAP_EN REG_BIT(17)#define MI_LRI_FORCE_POSTED (1<<12) -#define MI_FLUSH_DW MI_INSTR(0x26, 1) +#define MI_FLUSH_DW MI_INSTR(0x26, 0)#define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)#define MI_FLUSH_DW_CCS (1<<16)#define MI_FLUSH_DW_OP_STOREDW (1<<14)#define MI_FLUSH_DW_USE_GTT (1<<2) +#define MI_FLUSH_LENGTH GENMASK(5, 0) +#define MI_FLUSH_IMM_DW REG_FIELD_PREP(MI_FLUSH_LENGTH, 2) +#define MI_FLUSH_IMM_QW REG_FIELD_PREP(MI_FLUSH_LENGTH, 3)#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 1)drivers/gpu/drm/xe/xe_ring_ops.c +1
-1@@ -80,7 +80,7 @@ static int emit_store_imm_ggtt(u32 addr, u32 value, u32 *dw, int i)static int emit_flush_imm_ggtt (u32 addr,u32 value,bool invalidate_tlb,u32 *dw,int i) { - dw[i++] = (MI_FLUSH_DW +1 ) |MI_FLUSH_DW_OP_STOREDW | + dw[i++] =MI_FLUSH_DW |MI_FLUSH_DW_OP_STOREDW |MI_FLUSH_IMM_DW | (invalidate_tlb ?MI_INVALIDATE_TLB :0 ); dw[i++] = addr |MI_FLUSH_DW_USE_GTT ; dw[i++] =0 ;
drivers/gpu/drm/xe/xe_ring_ops.c static int emit_bb_start(u64 batch_addr, u32 ppgtt_flag, u32 *dw, int i) · line 105
Quoted 8 lines
drivers/gpu/drm/xe/xe_ring_ops.c +2
-2@@ -100,9 +100,9 @@ static int emit_bb_start(u64 batch_addr, u32 ppgtt_flag, u32 *dw, int i)static int emit_flush_invalidate (u32 flag,u32 *dw,int i) { - dw[i] =MI_FLUSH_DW +1 ; + dw[i] =MI_FLUSH_DW ; dw[i] |= flag; - dw[i++] |= MI_INVALIDATE_TLB | MI_FLUSH_DW_OP_STOREDW | + dw[i++] |= MI_INVALIDATE_TLB | MI_FLUSH_DW_OP_STOREDW | MI_FLUSH_IMM_DW |
I don't understand the logic/convention you used to add the MI_FLUSH_IMM_DW here rather than a couple lines above or as the last item to account for the bit position.
Anyway, it seems correct.
Lucas De Marchi
Quoted 17 lines
drivers/gpu/drm/xe/xe_ring_ops.c +2
-2MI_FLUSH_DW_STORE_INDEX ; dw[i++] =LRC_PPHWSP_SCRATCH_ADDR |MI_FLUSH_DW_USE_GTT ;@@ -365,8 +365,8 @@ static void emit_migration_job_gen12(struct xe_sched_job *job, i =emit_bb_start (job->batch_addr[1 ],BIT (8 ), dw, i); - dw[i++] = (MI_FLUSH_DW |MI_INVALIDATE_TLB | job->migrate_flush_flags | -MI_FLUSH_DW_OP_STOREDW ) +1 ; + dw[i++] =MI_FLUSH_DW |MI_INVALIDATE_TLB | job->migrate_flush_flags | +MI_FLUSH_DW_OP_STOREDW |MI_FLUSH_IMM_DW ; dw[i++] =xe_lrc_seqno_ggtt_addr (lrc) |MI_FLUSH_DW_USE_GTT ; dw[i++] =0 ; dw[i++] = seqno;/* value */ Signature · 1 line
2.41.0
PATCH 2/6 drm/xe: Separate number of registers from MI_LRI opcode
In reply to Matt RoperKeeping the number of registers to be loaded as a separate macro from the instruction opcode will simplify some upcoming LRC parsing code.
--- drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 4 +++- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +3 -1
@@ -25,9 +25,11 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0) -#define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*(x)-1) +#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)#define MI_LRI_LRM_CS_MMIO REG_BIT(19)#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) +#define MI_LRI_LENGTH GENMASK(5, 0) +#define MI_LRI_NUM_REGS (x) REG_FIELD_PREP(MI_LRI_LENGTH, 2 * (x) - 1)#define MI_LRI_FORCE_POSTED (1<<12)#define MI_FLUSH_DW MI_INSTR(0x26, 0)
drivers/gpu/drm/xe/xe_gt.c +1 -1
@@ -145,7 +145,7 @@ static int emit_wa_job(struct xe_gt *gt, struct xe_exec_queue *q)if (count) {xe_gt_dbg (gt,"LRC WA %s save-restore batch\n" , sr->name); - bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM (count); + bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);xa_for_each (&sr->xa, idx, entry) {struct xe_reg reg = entry->reg;
drivers/gpu/drm/xe/xe_lrc.c +1 -1
@@ -111,7 +111,7 @@ static void set_offsets(u32 *regs, flags = *data >>6 ; data++; - *regs =MI_LOAD_REGISTER_IMM (count); + *regs =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);if (flags &POSTED ) *regs |=MI_LRI_FORCE_POSTED ; *regs |=MI_LRI_LRM_CS_MMIO ;
drivers/gpu/drm/xe/xe_ring_ops.c +1 -1
@@ -50,7 +50,7 @@ static u32 preparser_disable(bool state)static int emit_aux_table_inv (struct xe_gt *gt,struct xe_reg reg,u32 *dw,int i) { - dw[i++] =MI_LOAD_REGISTER_IMM (1 ) |MI_LRI_MMIO_REMAP_EN ; + dw[i++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (1 ) |MI_LRI_MMIO_REMAP_EN ; dw[i++] = reg.addr + gt->mmio.adj_offset; dw[i++] =AUX_INV ; dw[i++] =MI_NOOP ;
Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 2/6] drm/xe: Separate number of registers from MI_LRI opcode
Quoted 16 lines · Matt Roper
Keeping the number of registers to be loaded as a separate macro from the instruction opcode will simplify some upcoming LRC parsing code.
Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 4 +++- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-0
drivers/gpu/drm/xe/regs/xe_gpu_commands.h line 28
Quoted 5 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +1
-1@@ -25,9 +25,11 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0) -#define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*(x)-1) +#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)
since we are going to have a churn in the codebase due to this, maybe it's worth going ahead and doing a s/LOAD_REGISTER_IMMEDIATE/LRI/ so all the macros follow the same pattern?
Lucas De Marchi
Quoted 49 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +2
-0#define MI_LRI_LRM_CS_MMIO REG_BIT(19)#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) +#define MI_LRI_LENGTH GENMASK(5, 0) +#define MI_LRI_NUM_REGS (x) REG_FIELD_PREP(MI_LRI_LENGTH, 2 * (x) - 1)#define MI_LRI_FORCE_POSTED (1<<12)#define MI_FLUSH_DW MI_INSTR(0x26, 0)drivers/gpu/drm/xe/xe_gt.c +1
-1@@ -145,7 +145,7 @@ static int emit_wa_job(struct xe_gt *gt, struct xe_exec_queue *q)if (count) {xe_gt_dbg (gt,"LRC WA %s save-restore batch\n" , sr->name); - bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM (count); + bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);xa_for_each (&sr->xa, idx, entry) {struct xe_reg reg = entry->reg;drivers/gpu/drm/xe/xe_lrc.c +1
-1@@ -111,7 +111,7 @@ static void set_offsets(u32 *regs, flags = *data >>6 ; data++; - *regs =MI_LOAD_REGISTER_IMM (count); + *regs =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);if (flags &POSTED ) *regs |=MI_LRI_FORCE_POSTED ; *regs |=MI_LRI_LRM_CS_MMIO ;drivers/gpu/drm/xe/xe_ring_ops.c +1
-1@@ -50,7 +50,7 @@ static u32 preparser_disable(bool state)static int emit_aux_table_inv (struct xe_gt *gt,struct xe_reg reg,u32 *dw,int i) { - dw[i++] =MI_LOAD_REGISTER_IMM (1 ) |MI_LRI_MMIO_REMAP_EN ; + dw[i++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (1 ) |MI_LRI_MMIO_REMAP_EN ; dw[i++] = reg.addr + gt->mmio.adj_offset; dw[i++] =AUX_INV ; dw[i++] =MI_NOOP ;Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 2/6] drm/xe: Separate number of registers from MI_LRI opcode
Quoted 20 lines · Lucas De Marchi
Quoted 19 lines · Matt Roper
Keeping the number of registers to be loaded as a separate macro from the instruction opcode will simplify some upcoming LRC parsing code.
Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 4 +++- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-0@@ -25,9 +25,11 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0)
Quoted 6 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h line 28
Quoted 2 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +1
-1-#define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*(x)-1) +#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)since we are going to have a churn in the codebase due to this, maybe it's worth going ahead and doing a s/LOAD_REGISTER_IMMEDIATE/LRI/ so all the macros follow the same pattern?
You mean so that the instruction macro matches the field macro names? I thought about that before but was uncertain whether it was worth switching the instruction macro names away from the official name given in the bspec. If we do that for LOAD_REGISTER_IMM, we should probably do the same for all of the various LOAD and STORE instructions for consistency (although I guess MI_STORE_DATA_IMM is the only one we use at the moment). I don't have a strong feeling either way; what do you think?
Matt
Quoted 54 lines
Reviewed-by Lucas De Marchi <[email protected]>Lucas De Marchi
Quoted 49 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +2
-0#define MI_LRI_LRM_CS_MMIO REG_BIT(19)#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) +#define MI_LRI_LENGTH GENMASK(5, 0) +#define MI_LRI_NUM_REGS (x) REG_FIELD_PREP(MI_LRI_LENGTH, 2 * (x) - 1)#define MI_LRI_FORCE_POSTED (1<<12)#define MI_FLUSH_DW MI_INSTR(0x26, 0)drivers/gpu/drm/xe/xe_gt.c +1
-1@@ -145,7 +145,7 @@ static int emit_wa_job(struct xe_gt *gt, struct xe_exec_queue *q)if (count) {xe_gt_dbg (gt,"LRC WA %s save-restore batch\n" , sr->name); - bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM (count); + bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);xa_for_each (&sr->xa, idx, entry) {struct xe_reg reg = entry->reg;drivers/gpu/drm/xe/xe_lrc.c +1
-1@@ -111,7 +111,7 @@ static void set_offsets(u32 *regs, flags = *data >>6 ; data++; - *regs =MI_LOAD_REGISTER_IMM (count); + *regs =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);if (flags &POSTED ) *regs |=MI_LRI_FORCE_POSTED ; *regs |=MI_LRI_LRM_CS_MMIO ;drivers/gpu/drm/xe/xe_ring_ops.c +1
-1@@ -50,7 +50,7 @@ static u32 preparser_disable(bool state)static int emit_aux_table_inv (struct xe_gt *gt,struct xe_reg reg,u32 *dw,int i) { - dw[i++] =MI_LOAD_REGISTER_IMM (1 ) |MI_LRI_MMIO_REMAP_EN ; + dw[i++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (1 ) |MI_LRI_MMIO_REMAP_EN ; dw[i++] = reg.addr + gt->mmio.adj_offset; dw[i++] =AUX_INV ; dw[i++] =MI_NOOP ;Signature · 1 line
2.41.0
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 2/6] drm/xe: Separate number of registers from MI_LRI opcode
Quoted 28 lines · Matt Roper
Quoted 20 lines · Lucas De Marchi
Quoted 19 lines · Matt Roper
Keeping the number of registers to be loaded as a separate macro from the instruction opcode will simplify some upcoming LRC parsing code.
Signed-off-by Matt Roper <[email protected]>---
drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 4 +++- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-0@@ -25,9 +25,11 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0)Quoted 6 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h line 28
Quoted 2 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +1
-1-#define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*(x)-1) +#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)since we are going to have a churn in the codebase due to this, maybe it's worth going ahead and doing a s/LOAD_REGISTER_IMMEDIATE/LRI/ so all the macros follow the same pattern?
Quoted 8 lines
You mean so that the instruction macro matches the field macro names? I thought about that before but was uncertain whether it was worth switching the instruction macro names away from the official name given in the bspec. If we do that for
LOAD_REGISTER_IMM, we should probably do the same for all of the various LOAD and STORE instructions for consistency (although I guessMI_STORE_DATA_IMMis the only one we use at the moment). I don't have a strong feeling either way; what do you think?
Thinking that you are printing to debugfs with #cmd, then that would be user visible and deviating from the bspec. Doing the other way around and always using the long version would make the code harder to read.
So.. meh, let's keep it as is.
Lucas De Marchi
Quoted 64 lines
Matt
Quoted 54 lines
Reviewed-by Lucas De Marchi <[email protected]>Lucas De Marchi
Quoted 49 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +2
-0#define MI_LRI_LRM_CS_MMIO REG_BIT(19)#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) +#define MI_LRI_LENGTH GENMASK(5, 0) +#define MI_LRI_NUM_REGS (x) REG_FIELD_PREP(MI_LRI_LENGTH, 2 * (x) - 1)#define MI_LRI_FORCE_POSTED (1<<12)#define MI_FLUSH_DW MI_INSTR(0x26, 0)drivers/gpu/drm/xe/xe_gt.c +1
-1@@ -145,7 +145,7 @@ static int emit_wa_job(struct xe_gt *gt, struct xe_exec_queue *q)if (count) {xe_gt_dbg (gt,"LRC WA %s save-restore batch\n" , sr->name); - bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM (count); + bb->cs[bb->len++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);xa_for_each (&sr->xa, idx, entry) {struct xe_reg reg = entry->reg;drivers/gpu/drm/xe/xe_lrc.c +1
-1@@ -111,7 +111,7 @@ static void set_offsets(u32 *regs, flags = *data >>6 ; data++; - *regs =MI_LOAD_REGISTER_IMM (count); + *regs =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (count);if (flags &POSTED ) *regs |=MI_LRI_FORCE_POSTED ; *regs |=MI_LRI_LRM_CS_MMIO ;drivers/gpu/drm/xe/xe_ring_ops.c +1
-2@@ -50,7 +50,7 @@ static u32 preparser_disable(bool state)static int emit_aux_table_inv (struct xe_gt *gt,struct xe_reg reg,u32 *dw,int i) { - dw[i++] =MI_LOAD_REGISTER_IMM (1 ) |MI_LRI_MMIO_REMAP_EN ; + dw[i++] =MI_LOAD_REGISTER_IMM |MI_LRI_NUM_REGS (1 ) |MI_LRI_MMIO_REMAP_EN ; dw[i++] = reg.addr + gt->mmio.adj_offset; dw[i++] =AUX_INV ; dw[i++] =MI_NOOP ; --2.41.0
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH 3/6 drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM
In reply to Matt RoperMI_STORE_DATA_IMM can store either dword values or qword values, and can store more than one value if the instruction's length field is large enough. Create explicit defines to specify the number of dwords/qwords to be stored, which will set the instruction length correctly and, if necessary, turn on the 'store qword' bit.
While we're here, also replace an open-coded version of MI_STORE_DATA_IMM with the common macros.
Bspec: 60246
--- drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 3 +++ drivers/gpu/drm/xe/xe_migrate.c | 9 +++------ drivers/gpu/drm/xe/xe_ring_ops.c | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +3 -0
@@ -24,6 +24,9 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0) +#define MI_SDI_GGTT REG_BIT(22) +#define MI_SDI_NUM_DW (x) ((x) + 1) +#define MI_SDI_NUM_QW (x) (REG_BIT(21) | (2 * (x) + 1))#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)#define MI_LRI_LRM_CS_MMIO REG_BIT(19)
drivers/gpu/drm/xe/xe_migrate.c +3 -6
@@ -482,8 +482,7 @@ static void emit_pte(struct xe_migrate *m,while (ptes) {u32 chunk =min (0x1ffU , ptes); - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (chunk *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (chunk); bb->cs[bb->len++] = ofs; bb->cs[bb->len++] =0 ;
@@ -1083,8 +1082,7 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,if (!(bb->len &1 )) bb->cs[bb->len++] =MI_NOOP ; - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (chunk *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (chunk); bb->cs[bb->len++] =lower_32_bits (addr); bb->cs[bb->len++] =upper_32_bits (addr); ops->populate(pt_update, tile, NULL, bb->cs + bb->len, ofs, chunk,
@@ -1290,8 +1288,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,emit_arb_clear (bb);/* Map our PT's to gtt */ - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (num_updates *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (num_updates); bb->cs[bb->len++] = ppgtt_ofs *XE_PAGE_SIZE + page_ofs; bb->cs[bb->len++] =0 ;/* upper_32_bits */
drivers/gpu/drm/xe/xe_ring_ops.c +2 -4
@@ -69,7 +69,7 @@ static int emit_user_interrupt(u32 *dw, int i)static int emit_store_imm_ggtt (u32 addr,u32 value,u32 *dw,int i) { - dw[i++] =MI_STORE_DATA_IMM |BIT (22 )/* GGTT */ |2 ; + dw[i++] =MI_STORE_DATA_IMM |MI_SDI_GGTT |MI_SDI_NUM_DW (1 ); dw[i++] = addr; dw[i++] =0 ; dw[i++] = value;
@@ -140,12 +140,10 @@ static int emit_pipe_invalidate(u32 mask_flags, bool invalidate_tlb, u32 *dw,return i; } -#define MI_STORE_QWORD_IMM_GEN8_POSTED (MI_INSTR(0x20, 3) | (1 << 21)) -static int emit_store_imm_ppgtt_posted (u64 addr,u64 value,u32 *dw,int i) { - dw[i++] =MI_STORE_QWORD_IMM_GEN8_POSTED ; + dw[i++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (1 ); dw[i++] =lower_32_bits (addr); dw[i++] =upper_32_bits (addr); dw[i++] =lower_32_bits (value);
Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 3/6] drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM
Quoted 11 lines · Matt Roper
MI_STORE_DATA_IMMcan store either dword values or qword values, and can store more than one value if the instruction's length field is large enough. Create explicit defines to specify the number of dwords/qwords to be stored, which will set the instruction length correctly and, if necessary, turn on the 'store qword' bit.While we're here, also replace an open-coded version of
MI_STORE_DATA_IMMwith the common macros.Bspec: 60246
Signed-off-by Matt Roper <[email protected]>
Lucas De Marchi
Quoted 84 lines
---
drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 3 +++ drivers/gpu/drm/xe/xe_migrate.c | 9 +++------ drivers/gpu/drm/xe/xe_ring_ops.c | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-)drivers/gpu/drm/xe/regs/xe_gpu_commands.h +3
-0@@ -24,6 +24,9 @@#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0) +#define MI_SDI_GGTT REG_BIT(22) +#define MI_SDI_NUM_DW (x) ((x) + 1) +#define MI_SDI_NUM_QW (x) (REG_BIT(21) | (2 * (x) + 1))#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0)#define MI_LRI_LRM_CS_MMIO REG_BIT(19)drivers/gpu/drm/xe/xe_migrate.c +3
-6@@ -482,8 +482,7 @@ static void emit_pte(struct xe_migrate *m,while (ptes) {u32 chunk =min (0x1ffU , ptes); - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (chunk *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (chunk); bb->cs[bb->len++] = ofs; bb->cs[bb->len++] =0 ;@@ -1083,8 +1082,7 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,if (!(bb->len &1 )) bb->cs[bb->len++] =MI_NOOP ; - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (chunk *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (chunk); bb->cs[bb->len++] =lower_32_bits (addr); bb->cs[bb->len++] =upper_32_bits (addr); ops->populate(pt_update, tile, NULL, bb->cs + bb->len, ofs, chunk,@@ -1290,8 +1288,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,emit_arb_clear (bb);/* Map our PT's to gtt */ - bb->cs[bb->len++] =MI_STORE_DATA_IMM |BIT (21 ) | - (num_updates *2 +1 ); + bb->cs[bb->len++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (num_updates); bb->cs[bb->len++] = ppgtt_ofs *XE_PAGE_SIZE + page_ofs; bb->cs[bb->len++] =0 ;/* upper_32_bits */ drivers/gpu/drm/xe/xe_ring_ops.c +2
-4@@ -69,7 +69,7 @@ static int emit_user_interrupt(u32 *dw, int i)static int emit_store_imm_ggtt (u32 addr,u32 value,u32 *dw,int i) { - dw[i++] =MI_STORE_DATA_IMM |BIT (22 )/* GGTT */ |2 ; + dw[i++] =MI_STORE_DATA_IMM |MI_SDI_GGTT |MI_SDI_NUM_DW (1 ); dw[i++] = addr; dw[i++] =0 ; dw[i++] = value;@@ -140,12 +140,10 @@ static int emit_pipe_invalidate(u32 mask_flags, bool invalidate_tlb, u32 *dw,return i; } -#define MI_STORE_QWORD_IMM_GEN8_POSTED (MI_INSTR(0x20, 3) | (1 << 21)) -static int emit_store_imm_ppgtt_posted (u64 addr,u64 value,u32 *dw,int i) { - dw[i++] =MI_STORE_QWORD_IMM_GEN8_POSTED ; + dw[i++] =MI_STORE_DATA_IMM |MI_SDI_NUM_QW (1 ); dw[i++] =lower_32_bits (addr); dw[i++] =upper_32_bits (addr); dw[i++] =lower_32_bits (value);Signature · 1 line
2.41.0
PATCH 4/6 drm/xe: Extract MI_* instructions to their own header
In reply to Matt RoperExtracting the common MI_* instructions that can be used with any engine to their own header will make it easier as we add additional engine instructions in upcoming patches.
Also, since the majority of GPU instructions (both MI and non-MI) have a "length" field in bits 7:0 of the instruction header, a common define is added for that. Instruction-specific length fields are still defined for special case instructions that have larger/smaller length fields.
--- .../gpu/drm/xe/instructions/xe_inst_defs.h | 31 ++++++++++ .../gpu/drm/xe/instructions/xe_mi_commands.h | 58 +++++++++++++++++++ drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 41 ------------- drivers/gpu/drm/xe/xe_bb.c | 1 + drivers/gpu/drm/xe/xe_execlist.c | 1 + drivers/gpu/drm/xe/xe_gt.c | 1 + drivers/gpu/drm/xe/xe_lrc.c | 1 + drivers/gpu/drm/xe/xe_migrate.c | 1 + drivers/gpu/drm/xe/xe_ring_ops.c | 3 +- 9 files changed, 96 insertions(+), 42 deletions(-) create mode 100644 drivers/gpu/drm/xe/instructions/xe_inst_defs.h create mode 100644 drivers/gpu/drm/xe/instructions/xe_mi_commands.h
drivers/gpu/drm/xe/instructions/xe_inst_defs.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ + +#ifndef _XE_INST_DEFS_H_ +#define _XE_INST_DEFS_H_ + +#include "compat-i915-headers/i915_reg_defs.h" + +/* +* The first dword of any GPU instruction is the "instruction header." Bits +* 31:29 identify the general type of the command and determine how exact +* opcodes and sub-opcodes will be encoded in the remaining bits. +*/ +#define XE_INST_CMD_TYPE GENMASK(31, 29) +#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0) + +/* +* Most (but not all) instructions have a "length" field in the instruction +* header. The value expected is the total number of dwords for the +* instruction, minus two. +* +* Some instructions have length fields longer or shorter than 8 bits, but +* those are rare. This definition can be used for the common case where +* the length field is from 7:0. +*/ +#define XE_INST_LEN_MASK GENMASK(7, 0) +#define XE_INST_NUM_DW (x) REG_FIELD_PREP(XE_INST_LEN_MASK, (x) - 2) + +#endif
drivers/gpu/drm/xe/instructions/xe_mi_commands.h new file +58 -0
58 lines not on this page · raw message
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0 -41
51 lines not on this page · raw message
drivers/gpu/drm/xe/xe_bb.c +1 -0
@@ -5,6 +5,7 @@#include "xe_bb.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "xe_device.h" #include "xe_exec_queue_types.h"
drivers/gpu/drm/xe/xe_execlist.c +1 -0
@@ -7,6 +7,7 @@#include <drm/drm_managed.h> +#include "instructions/xe_mi_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h"
drivers/gpu/drm/xe/xe_gt.c +1 -0
@@ -10,6 +10,7 @@#include <drm/drm_managed.h> #include <drm/xe_drm.h> +#include "instructions/xe_mi_commands.h" #include "regs/xe_gt_regs.h" #include "xe_assert.h" #include "xe_bb.h"
drivers/gpu/drm/xe/xe_lrc.c +1 -0
@@ -5,6 +5,7 @@#include "xe_lrc.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h"
drivers/gpu/drm/xe/xe_migrate.c +1 -0
@@ -13,6 +13,7 @@#include <drm/xe_drm.h> #include "generated/xe_wa_oob.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "tests/xe_test.h" #include "xe_assert.h"
drivers/gpu/drm/xe/xe_ring_ops.c +2 -1
@@ -6,6 +6,7 @@#include "xe_ring_ops.h" #include "generated/xe_wa_oob.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" #include "regs/xe_lrc_layout.h"
@@ -91,7 +92,7 @@ static int emit_flush_imm_ggtt(u32 addr, u32 value, bool invalidate_tlb,static int emit_bb_start (u64 batch_addr,u32 ppgtt_flag,u32 *dw,int i) { - dw[i++] =MI_BATCH_BUFFER_START | ppgtt_flag; + dw[i++] =MI_BATCH_BUFFER_START | ppgtt_flag |XE_INST_NUM_DW (3 ); dw[i++] =lower_32_bits (batch_addr); dw[i++] =upper_32_bits (batch_addr);
Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 4/6] drm/xe: Extract MI_* instructions to their own header
Quoted 30 lines · Matt Roper
Extracting the common MI_* instructions that can be used with any engine to their own header will make it easier as we add additional engine instructions in upcoming patches.
Also, since the majority of GPU instructions (both MI and non-MI) have a "length" field in bits 7:0 of the instruction header, a common define is added for that. Instruction-specific length fields are still defined for special case instructions that have larger/smaller length fields.
Signed-off-by Matt Roper <[email protected]>---
.../gpu/drm/xe/instructions/xe_inst_defs.h | 31 ++++++++++ .../gpu/drm/xe/instructions/xe_mi_commands.h | 58 +++++++++++++++++++ drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 41 ------------- drivers/gpu/drm/xe/xe_bb.c | 1 + drivers/gpu/drm/xe/xe_execlist.c | 1 + drivers/gpu/drm/xe/xe_gt.c | 1 + drivers/gpu/drm/xe/xe_lrc.c | 1 + drivers/gpu/drm/xe/xe_migrate.c | 1 + drivers/gpu/drm/xe/xe_ring_ops.c | 3 +- 9 files changed, 96 insertions(+), 42 deletions(-)create mode 100644
drivers/gpu/drm/xe/instructions/xe_inst_defs.hcreate mode 100644drivers/gpu/drm/xe/instructions/xe_mi_commands.hdrivers/gpu/drm/xe/instructions/xe_inst_defs.h new file +0
-0
drivers/gpu/drm/xe/instructions/xe_inst_defs.h line 9
Quoted 9 lines
drivers/gpu/drm/xe/instructions/xe_inst_defs.h new file +9
-0@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ + +#ifndef _XE_INST_DEFS_H_ +#define _XE_INST_DEFS_H_ + +#include "compat-i915-headers/i915_reg_defs.h"
I think we want this to be xe/xe_reg_defs.h. Eventually I want to get rid of the i915 dependency... I have a patch series for that from a few months ago that I need to follow up on.
drivers/gpu/drm/xe/instructions/xe_inst_defs.h line 17
Quoted 8 lines
drivers/gpu/drm/xe/instructions/xe_inst_defs.h new file +8
-0+ +/* +* The first dword of any GPU instruction is the "instruction header." Bits +* 31:29 identify the general type of the command and determine how exact +* opcodes and sub-opcodes will be encoded in the remaining bits. +*/ +#define XE_INST_CMD_TYPE GENMASK(31, 29) +#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0)
maybe because I got used to MI_INSTR(), but I think instr is a better short name for "instruction"
Quoted 116 lines
drivers/gpu/drm/xe/instructions/xe_inst_defs.h new file +14
-0+ +/* +* Most (but not all) instructions have a "length" field in the instruction +* header. The value expected is the total number of dwords for the +* instruction, minus two. +* +* Some instructions have length fields longer or shorter than 8 bits, but +* those are rare. This definition can be used for the common case where +* the length field is from 7:0. +*/ +#define XE_INST_LEN_MASK GENMASK(7, 0) +#define XE_INST_NUM_DW (x) REG_FIELD_PREP(XE_INST_LEN_MASK, (x) - 2) + +#endif drivers/gpu/drm/xe/instructions/xe_mi_commands.h new file +58
-0@@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ + +#ifndef _XE_MI_COMMANDS_H_ +#define _XE_MI_COMMANDS_H_ + +#include "instructions/xe_inst_defs.h" + +/* +* MI (Memory Interface) commands are supported by all GT engines. They +* provide general memory operations and command streamer control. MI commands +* have a command type of 0x0 (MI_COMMAND) in bits 31:29 of the instruction +* header dword and a specific MI opcode in bits 28:23. +*/ + +#define MI_OPCODE REG_GENMASK(28, 23) +#define MI_SUBOPCODE REG_GENMASK(22, 17)/* used with MI_EXPANSION */ + +#define __MI_INST (opcode) \ + (XE_INST_MI | REG_FIELD_PREP(MI_OPCODE, opcode)) + +#define MI_NOOP __MI_INST(0x0) +#define MI_USER_INTERRUPT __MI_INST(0x2) +#define MI_ARB_CHECK __MI_INST(0x5) + +#define MI_ARB_ON_OFF __MI_INST(0x8) +#define MI_ARB_ENABLE REG_BIT(0) +#define MI_ARB_DISABLE 0x0 + +#define MI_BATCH_BUFFER_END __MI_INST(0xA) +#define MI_STORE_DATA_IMM __MI_INST(0x20) +#define MI_SDI_GGTT REG_BIT(22) +#define MI_SDI_LEN_DW GENMASK(9, 0) +#define MI_SDI_NUM_DW (x) REG_FIELD_PREP(MI_SDI_LEN_DW, (x) + 3 - 2) +#define MI_SDI_NUM_QW (x) (REG_FIELD_PREP(MI_SDI_LEN_DW, 2 * (x) + 3 - 2) | \ + REG_BIT(21)) + +#define MI_LOAD_REGISTER_IMM __MI_INST(0x22) +#define MI_LRI_LRM_CS_MMIO REG_BIT(19) +#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) +#define MI_LRI_NUM_REGS (x) XE_INST_NUM_DW(2 * (x) + 1) +#define MI_LRI_FORCE_POSTED REG_BIT(12) + +#define MI_FLUSH_DW __MI_INST(0x26) +#define MI_FLUSH_DW_STORE_INDEX REG_BIT(21) +#define MI_INVALIDATE_TLB REG_BIT(18) +#define MI_FLUSH_DW_CCS REG_BIT(16) +#define MI_FLUSH_DW_OP_STOREDW REG_BIT(14) +#define MI_FLUSH_DW_LEN_DW REG_GENMASK(5, 0) +#define MI_FLUSH_IMM_DW REG_FIELD_PREP(MI_FLUSH_DW_LEN_DW, 4 - 2) +#define MI_FLUSH_IMM_QW REG_FIELD_PREP(MI_FLUSH_DW_LEN_DW, 5 - 2) +#define MI_FLUSH_DW_USE_GTT REG_BIT(2) + +#define MI_BATCH_BUFFER_START __MI_INST(0x31) + +#endif drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-30@@ -8,45 +8,6 @@#include "regs/xe_reg_defs.h" -#define INSTR_CLIENT_SHIFT 29 -#define INSTR_MI_CLIENT 0x0 -#define __INSTR (client) ((client) << INSTR_CLIENT_SHIFT) - -#define MI_INSTR (opcode, flags) \ - (__INSTR(INSTR_MI_CLIENT) | (opcode) << 23 | (flags)) - -#define MI_NOOP MI_INSTR(0, 0) -#define MI_USER_INTERRUPT MI_INSTR(0x02, 0) - -#define MI_ARB_ON_OFF MI_INSTR(0x08, 0) -#define MI_ARB_ENABLE (1<<0) -#define MI_ARB_DISABLE (0<<0) - -#define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0) -#define MI_STORE_DATA_IMM MI_INSTR(0x20, 0) -#define MI_SDI_GGTT REG_BIT(22) -#define MI_SDI_NUM_DW (x) ((x) + 1) -#define MI_SDI_NUM_QW (x) (REG_BIT(21) | (2 * (x) + 1)) - -#define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 0) -#define MI_LRI_LRM_CS_MMIO REG_BIT(19) -#define MI_LRI_MMIO_REMAP_EN REG_BIT(17) -#define MI_LRI_LENGTH GENMASK(5, 0) -#define MI_LRI_NUM_REGS (x) REG_FIELD_PREP(MI_LRI_LENGTH, 2 * (x) - 1) -#define MI_LRI_FORCE_POSTED (1<<12) - -#define MI_FLUSH_DW MI_INSTR(0x26, 0) -#define MI_FLUSH_DW_STORE_INDEX (1<<21) -#define MI_INVALIDATE_TLB (1<<18)
drivers/gpu/drm/xe/regs/xe_gpu_commands.h line 11
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-9-#define MI_FLUSH_DW_CCS (1<<16) -#define MI_FLUSH_DW_OP_STOREDW (1<<14) -#define MI_FLUSH_DW_USE_GTT (1<<2) -#define MI_FLUSH_LENGTH GENMASK(5, 0) -#define MI_FLUSH_IMM_DW REG_FIELD_PREP(MI_FLUSH_LENGTH, 2) -#define MI_FLUSH_IMM_QW REG_FIELD_PREP(MI_FLUSH_LENGTH, 3) - -#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 1) -#define XY_CTRL_SURF_COPY_BLT ((2 << 29) | (0x48 << 22) | 3)
are you planning to finish the move of other instructions out of xe/regs? It doesn't need to be in this patch, but it'd be better to have a follow up patch with the move.
Lucas De Marchi
Quoted 93 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h +0
-2#define SRC_ACCESS_TYPE_SHIFT 21#define DST_ACCESS_TYPE_SHIFT 20@@ -106,6 +67,4 @@#define PIPE_CONTROL_STALL_AT_SCOREBOARD (1<<1)#define PIPE_CONTROL_DEPTH_CACHE_FLUSH (1<<0) -#define MI_ARB_CHECK MI_INSTR(0x05, 0) -#endif drivers/gpu/drm/xe/xe_bb.c +1
-0@@ -5,6 +5,7 @@#include "xe_bb.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "xe_device.h" #include "xe_exec_queue_types.h" drivers/gpu/drm/xe/xe_execlist.c +1
-0@@ -7,6 +7,7 @@#include <drm/drm_managed.h> +#include "instructions/xe_mi_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" drivers/gpu/drm/xe/xe_gt.c +1
-0@@ -10,6 +10,7 @@#include <drm/drm_managed.h> #include <drm/xe_drm.h> +#include "instructions/xe_mi_commands.h" #include "regs/xe_gt_regs.h" #include "xe_assert.h" #include "xe_bb.h" drivers/gpu/drm/xe/xe_lrc.c +1
-0@@ -5,6 +5,7 @@#include "xe_lrc.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" drivers/gpu/drm/xe/xe_migrate.c +1
-0@@ -13,6 +13,7 @@#include <drm/xe_drm.h> #include "generated/xe_wa_oob.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "tests/xe_test.h" #include "xe_assert.h" drivers/gpu/drm/xe/xe_ring_ops.c +2
-1@@ -6,6 +6,7 @@#include "xe_ring_ops.h" #include "generated/xe_wa_oob.h" +#include "instructions/xe_mi_commands.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" #include "regs/xe_lrc_layout.h" @@ -91,7 +92,7 @@ static int emit_flush_imm_ggtt(u32 addr, u32 value, bool invalidate_tlb,static int emit_bb_start (u64 batch_addr,u32 ppgtt_flag,u32 *dw,int i) { - dw[i++] =MI_BATCH_BUFFER_START | ppgtt_flag; + dw[i++] =MI_BATCH_BUFFER_START | ppgtt_flag |XE_INST_NUM_DW (3 ); dw[i++] =lower_32_bits (batch_addr); dw[i++] =upper_32_bits (batch_addr);Signature · 1 line
2.41.0
PATCH 5/6 drm/xe/debugfs: Add dump of default LRCs' MI instructions
In reply to Matt RoperFor non-RCS engines, nearly all of the LRC state is composed of MI instructions (specifically MI_LOAD_REGISTER_IMM). Providing a dump interface allows us to verify that the context image layout matches what's documented in the bspec, and also allows us to check whether LRC workarounds are being properly captured by the default state we record at startup.
For now, the non-MI instructions found in the RCS and CCS engines will dump as "unknown;" parsing of those will be added in a follow-up patch.
Bspec: 64993
--- .../gpu/drm/xe/instructions/xe_inst_defs.h | 1 + .../gpu/drm/xe/instructions/xe_mi_commands.h | 3 + drivers/gpu/drm/xe/xe_gt_debugfs.c | 41 +++++++++ drivers/gpu/drm/xe/xe_lrc.c | 84 +++++++++++++++++++ drivers/gpu/drm/xe/xe_lrc.h | 5 ++ 5 files changed, 134 insertions(+)
drivers/gpu/drm/xe/instructions/xe_inst_defs.h +1 -0
@@ -15,6 +15,7 @@*/ #define XE_INST_CMD_TYPE GENMASK(31, 29)#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0) +#define XE_INST_GFXPIPE REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x3)/* * Most (but not all) instructions have a "length" field in the instruction
drivers/gpu/drm/xe/instructions/xe_mi_commands.h +3 -0
@@ -30,6 +30,9 @@#define MI_ARB_DISABLE 0x0#define MI_BATCH_BUFFER_END __MI_INST(0xA) +#define MI_TOPOLOGY_FILTER __MI_INST(0xD) +#define MI_FORCE_WAKEUP __MI_INST(0x1D) +#define MI_STORE_DATA_IMM __MI_INST(0x20)#define MI_SDI_GGTT REG_BIT(22)#define MI_SDI_LEN_DW GENMASK(9, 0)
drivers/gpu/drm/xe/xe_gt_debugfs.c +41 -0
59 lines not on this page · raw message
drivers/gpu/drm/xe/xe_lrc.c +84 -0
93 lines not on this page · raw message
drivers/gpu/drm/xe/xe_lrc.h +5 -0
@@ -7,6 +7,7 @@#include "xe_lrc_types.h" +struct drm_printer ;struct xe_device ;struct xe_exec_queue ;enum xe_engine_class ;
@@ -47,4 +48,8 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);size_t xe_lrc_skip_size (struct xe_device *xe); +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class ); +#endif
Signature · 1 line
2.41.0
Matthew Brost
maintainerRe: [Intel-xe] [PATCH 5/6] drm/xe/debugfs: Add dump of default LRCs' MI instructions
Quoted 134 lines · Matt Roper
For non-RCS engines, nearly all of the LRC state is composed of MI instructions (specifically
MI_LOAD_REGISTER_IMM). Providing a dump interface allows us to verify that the context image layout matches what's documented in the bspec, and also allows us to check whether LRC workarounds are being properly captured by the default state we record at startup.For now, the non-MI instructions found in the RCS and CCS engines will dump as "unknown;" parsing of those will be added in a follow-up patch.
Bspec: 64993
Signed-off-by Matt Roper <[email protected]>--- .../gpu/drm/xe/instructions/xe_inst_defs.h | 1 + .../gpu/drm/xe/instructions/xe_mi_commands.h | 3 + drivers/gpu/drm/xe/xe_gt_debugfs.c | 41 +++++++++ drivers/gpu/drm/xe/xe_lrc.c | 84 +++++++++++++++++++ drivers/gpu/drm/xe/xe_lrc.h | 5 ++ 5 files changed, 134 insertions(+)drivers/gpu/drm/xe/instructions/xe_inst_defs.h +1
-0@@ -15,6 +15,7 @@*/ #define XE_INST_CMD_TYPE GENMASK(31, 29)#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0) +#define XE_INST_GFXPIPE REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x3)/* * Most (but not all) instructions have a "length" field in the instruction drivers/gpu/drm/xe/instructions/xe_mi_commands.h +3
-0@@ -30,6 +30,9 @@#define MI_ARB_DISABLE 0x0#define MI_BATCH_BUFFER_END __MI_INST(0xA) +#define MI_TOPOLOGY_FILTER __MI_INST(0xD) +#define MI_FORCE_WAKEUP __MI_INST(0x1D) +#define MI_STORE_DATA_IMM __MI_INST(0x20)#define MI_SDI_GGTT REG_BIT(22)#define MI_SDI_LEN_DW GENMASK(9, 0)drivers/gpu/drm/xe/xe_gt_debugfs.c +41
-0@@ -15,6 +15,7 @@#include "xe_gt_mcr.h" #include "xe_gt_topology.h" #include "xe_hw_engine.h" +#include "xe_lrc.h" #include "xe_macros.h" #include "xe_pat.h" #include "xe_reg_sr.h" @@ -149,6 +150,41 @@ static int pat(struct seq_file *m, void *data)return 0 ; } +static int rcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_RENDER ); +return 0 ; +} + +static int ccs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COMPUTE ); +return 0 ; +} + +static int bcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COPY ); +return 0 ; +} + +static int vcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_DECODE ); +return 0 ; +} + +static int vecs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_ENHANCE ); +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },@@ -159,6 +195,11 @@ static const struct drm_info_list debugfs_list[] = { {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, {"pat", pat, 0}, + {"default_lrc_rcs", rcs_default_lrc}, + {"default_lrc_ccs", ccs_default_lrc}, + {"default_lrc_bcs", bcs_default_lrc}, + {"default_lrc_vcs", vcs_default_lrc}, + {"default_lrc_vecs", vecs_default_lrc}, };void xe_gt_debugfs_register (struct xe_gt *gt)drivers/gpu/drm/xe/xe_lrc.c +7
-0@@ -6,6 +6,7 @@#include "xe_lrc.h" #include "instructions/xe_mi_commands.h" +#include "instructions/xe_gfxpipe_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" @@ -903,3 +904,86 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) {return __xe_lrc_parallel_map (lrc); } + +static int instr_dw (u32 cmd_header) +{ +/* Most instructions have the # of dwords (minus 2) in 7:0 */ +return REG_FIELD_GET (XE_INST_LEN_MASK , cmd_header) +2 ; +}
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 922
Quoted 10 lines
drivers/gpu/drm/xe/xe_lrc.c +10
-0+ +static int dump_mi_command (struct drm_printer *p, +struct xe_gt *gt, +u32 *dw, +int remaining_dw) +{ +u32 numdw =instr_dw (*dw); +u32 opcode =REG_FIELD_GET (MI_OPCODE , *dw); + +switch (*dw &MI_OPCODE ) {
Drive by comment, 'switch (opcode)'.
Matt
Quoted 91 lines
drivers/gpu/drm/xe/xe_lrc.c +67
-0+case MI_NOOP : +int num_noop =1 ; +while (num_noop < remaining_dw && + (*(++dw) ®_GENMASK (31 ,23 )) ==MI_NOOP ) + num_noop++; +drm_printf (p,"MI_NOOP (%d dwords)\n" , num_noop); +return num_noop; + +case MI_LOAD_REGISTER_IMM : +drm_printf (p,"MI_LOAD_REGISTER_IMM: %d regs\n" , (numdw -1 ) /2 ); +for (int i =1 ; i < numdw; i +=2 ) +drm_printf (p," - %#6x = %#010x\n" , dw[i], dw[i +1 ]); +return numdw; + +case MI_TOPOLOGY_FILTER : +drm_printf (p,"MI_TOPOLOGY_FILTER\n" ); +return 1 ; + +case MI_FORCE_WAKEUP : +drm_printf (p,"MI_FORCE_WAKEUP\n" ); +return numdw; + +case MI_BATCH_BUFFER_END : +drm_printf (p,"MI_BATCH_BUFFER_END\n" ); +return 0 ; + +default : +drm_printf (p,"unknown MI opcode %#x, likely %d dwords\n" , + opcode, numdw); +return numdw; + } +} + +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class hwe_class) +{ +u32 *dw; +int remaining_dw, num_dw; + +if (!gt->default_lrc[hwe_class]) { +drm_printf (p,"No default LRC for class %d\n" , hwe_class); +return ; + } + +/* First page of LRC is a ppHWSP */ + dw = gt->default_lrc[hwe_class] +LRC_PPHWSP_SIZE ; + remaining_dw = (xe_lrc_size (gt_to_xe (gt), hwe_class) -LRC_PPHWSP_SIZE ) /4 ; + +while (remaining_dw) { +if ((*dw &XE_INST_CMD_TYPE ) ==XE_INST_MI ) { + num_dw =dump_mi_command (p, gt, dw, remaining_dw); + }else { + num_dw =min (instr_dw (*dw), remaining_dw); +drm_printf (p,"Unknown instr <%#x> of type %#x, likely %d dwords\n" , + *dw,REG_FIELD_GET (XE_INST_CMD_TYPE , *dw), + num_dw); + } + +/* 0 is returned on MI_BATCH_BUFFER_END */ +if (num_dw ==0 ) +break ; + + dw += num_dw; + remaining_dw -= num_dw; + } +}drivers/gpu/drm/xe/xe_lrc.h +5
-0@@ -7,6 +7,7 @@#include "xe_lrc_types.h" +struct drm_printer ;struct xe_device ;struct xe_exec_queue ;enum xe_engine_class ;@@ -47,4 +48,8 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);size_t xe_lrc_skip_size (struct xe_device *xe); +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class ); +#endif Signature · 1 line
2.41.0
Re: [Intel-xe] [PATCH 5/6] drm/xe/debugfs: Add dump of default LRCs' MI instructions
Quoted 139 lines · Matthew Brost
Quoted 138 lines · Matt Roper
For non-RCS engines, nearly all of the LRC state is composed of MI instructions (specifically
MI_LOAD_REGISTER_IMM). Providing a dump interface allows us to verify that the context image layout matches what's documented in the bspec, and also allows us to check whether LRC workarounds are being properly captured by the default state we record at startup.For now, the non-MI instructions found in the RCS and CCS engines will dump as "unknown;" parsing of those will be added in a follow-up patch.
Bspec: 64993
Signed-off-by Matt Roper <[email protected]>--- .../gpu/drm/xe/instructions/xe_inst_defs.h | 1 + .../gpu/drm/xe/instructions/xe_mi_commands.h | 3 + drivers/gpu/drm/xe/xe_gt_debugfs.c | 41 +++++++++ drivers/gpu/drm/xe/xe_lrc.c | 84 +++++++++++++++++++ drivers/gpu/drm/xe/xe_lrc.h | 5 ++ 5 files changed, 134 insertions(+)drivers/gpu/drm/xe/instructions/xe_inst_defs.h +1
-0@@ -15,6 +15,7 @@*/ #define XE_INST_CMD_TYPE GENMASK(31, 29)#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0) +#define XE_INST_GFXPIPE REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x3)/* * Most (but not all) instructions have a "length" field in the instruction drivers/gpu/drm/xe/instructions/xe_mi_commands.h +3
-0@@ -30,6 +30,9 @@#define MI_ARB_DISABLE 0x0#define MI_BATCH_BUFFER_END __MI_INST(0xA) +#define MI_TOPOLOGY_FILTER __MI_INST(0xD) +#define MI_FORCE_WAKEUP __MI_INST(0x1D) +#define MI_STORE_DATA_IMM __MI_INST(0x20)#define MI_SDI_GGTT REG_BIT(22)#define MI_SDI_LEN_DW GENMASK(9, 0)drivers/gpu/drm/xe/xe_gt_debugfs.c +41
-0@@ -15,6 +15,7 @@#include "xe_gt_mcr.h" #include "xe_gt_topology.h" #include "xe_hw_engine.h" +#include "xe_lrc.h" #include "xe_macros.h" #include "xe_pat.h" #include "xe_reg_sr.h" @@ -149,6 +150,41 @@ static int pat(struct seq_file *m, void *data)return 0 ; } +static int rcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_RENDER ); +return 0 ; +} + +static int ccs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COMPUTE ); +return 0 ; +} + +static int bcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COPY ); +return 0 ; +} + +static int vcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_DECODE ); +return 0 ; +} + +static int vecs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_ENHANCE ); +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },@@ -159,6 +195,11 @@ static const struct drm_info_list debugfs_list[] = { {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, {"pat", pat, 0}, + {"default_lrc_rcs", rcs_default_lrc}, + {"default_lrc_ccs", ccs_default_lrc}, + {"default_lrc_bcs", bcs_default_lrc}, + {"default_lrc_vcs", vcs_default_lrc}, + {"default_lrc_vecs", vecs_default_lrc}, };void xe_gt_debugfs_register (struct xe_gt *gt)drivers/gpu/drm/xe/xe_lrc.c +11
-0@@ -6,6 +6,7 @@#include "xe_lrc.h" #include "instructions/xe_mi_commands.h" +#include "instructions/xe_gfxpipe_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" @@ -903,3 +904,86 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) {return __xe_lrc_parallel_map (lrc); } + +static int instr_dw (u32 cmd_header) +{ +/* Most instructions have the # of dwords (minus 2) in 7:0 */ +return REG_FIELD_GET (XE_INST_LEN_MASK , cmd_header) +2 ; +} + +static int dump_mi_command(struct drm_printer *p, + struct xe_gt *gt, + u32 *dw,
Quoted 8 lines
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 922
Quoted 6 lines
drivers/gpu/drm/xe/xe_lrc.c +6
-0+ int remaining_dw) +{ +u32 numdw =instr_dw (*dw); +u32 opcode =REG_FIELD_GET (MI_OPCODE , *dw); + +switch (*dw &MI_OPCODE ) {Drive by comment, 'switch (opcode)'.
That will change the meaning a bit. Right now the case statements are matching against the shifted opcodes values that are also used elsewhere in the driver (e.g., MI_LOAD_REGISTER_IMM = (0x22 << 23), whereas local 'opcode' only holds the unshifted opcode (i.e., 0x22).
Matt
Quoted 94 lines
Matt
Quoted 91 lines
drivers/gpu/drm/xe/xe_lrc.c +67
-0+case MI_NOOP : +int num_noop =1 ; +while (num_noop < remaining_dw && + (*(++dw) ®_GENMASK (31 ,23 )) ==MI_NOOP ) + num_noop++; +drm_printf (p,"MI_NOOP (%d dwords)\n" , num_noop); +return num_noop; + +case MI_LOAD_REGISTER_IMM : +drm_printf (p,"MI_LOAD_REGISTER_IMM: %d regs\n" , (numdw -1 ) /2 ); +for (int i =1 ; i < numdw; i +=2 ) +drm_printf (p," - %#6x = %#010x\n" , dw[i], dw[i +1 ]); +return numdw; + +case MI_TOPOLOGY_FILTER : +drm_printf (p,"MI_TOPOLOGY_FILTER\n" ); +return 1 ; + +case MI_FORCE_WAKEUP : +drm_printf (p,"MI_FORCE_WAKEUP\n" ); +return numdw; + +case MI_BATCH_BUFFER_END : +drm_printf (p,"MI_BATCH_BUFFER_END\n" ); +return 0 ; + +default : +drm_printf (p,"unknown MI opcode %#x, likely %d dwords\n" , + opcode, numdw); +return numdw; + } +} + +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class hwe_class) +{ +u32 *dw; +int remaining_dw, num_dw; + +if (!gt->default_lrc[hwe_class]) { +drm_printf (p,"No default LRC for class %d\n" , hwe_class); +return ; + } + +/* First page of LRC is a ppHWSP */ + dw = gt->default_lrc[hwe_class] +LRC_PPHWSP_SIZE ; + remaining_dw = (xe_lrc_size (gt_to_xe (gt), hwe_class) -LRC_PPHWSP_SIZE ) /4 ; + +while (remaining_dw) { +if ((*dw &XE_INST_CMD_TYPE ) ==XE_INST_MI ) { + num_dw =dump_mi_command (p, gt, dw, remaining_dw); + }else { + num_dw =min (instr_dw (*dw), remaining_dw); +drm_printf (p,"Unknown instr <%#x> of type %#x, likely %d dwords\n" , + *dw,REG_FIELD_GET (XE_INST_CMD_TYPE , *dw), + num_dw); + } + +/* 0 is returned on MI_BATCH_BUFFER_END */ +if (num_dw ==0 ) +break ; + + dw += num_dw; + remaining_dw -= num_dw; + } +}drivers/gpu/drm/xe/xe_lrc.h +5
-0@@ -7,6 +7,7 @@#include "xe_lrc_types.h" +struct drm_printer ;struct xe_device ;struct xe_exec_queue ;enum xe_engine_class ;@@ -47,4 +48,8 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);size_t xe_lrc_skip_size (struct xe_device *xe); +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class ); +#endif Signature · 1 line
2.41.0
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH 5/6] drm/xe/debugfs: Add dump of default LRCs' MI instructions
In reply to Matt RoperQuoted 132 lines · Matt Roper
For non-RCS engines, nearly all of the LRC state is composed of MI instructions (specifically
MI_LOAD_REGISTER_IMM). Providing a dump interface allows us to verify that the context image layout matches what's documented in the bspec, and also allows us to check whether LRC workarounds are being properly captured by the default state we record at startup.For now, the non-MI instructions found in the RCS and CCS engines will dump as "unknown;" parsing of those will be added in a follow-up patch.
Bspec: 64993
Signed-off-by Matt Roper <[email protected]>---
.../gpu/drm/xe/instructions/xe_inst_defs.h | 1 + .../gpu/drm/xe/instructions/xe_mi_commands.h | 3 + drivers/gpu/drm/xe/xe_gt_debugfs.c | 41 +++++++++ drivers/gpu/drm/xe/xe_lrc.c | 84 +++++++++++++++++++ drivers/gpu/drm/xe/xe_lrc.h | 5 ++ 5 files changed, 134 insertions(+)drivers/gpu/drm/xe/instructions/xe_inst_defs.h +1
-0@@ -15,6 +15,7 @@*/ #define XE_INST_CMD_TYPE GENMASK(31, 29)#define XE_INST_MI REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x0) +#define XE_INST_GFXPIPE REG_FIELD_PREP(XE_INST_CMD_TYPE, 0x3)/* * Most (but not all) instructions have a "length" field in the instruction drivers/gpu/drm/xe/instructions/xe_mi_commands.h +3
-0@@ -30,6 +30,9 @@#define MI_ARB_DISABLE 0x0#define MI_BATCH_BUFFER_END __MI_INST(0xA) +#define MI_TOPOLOGY_FILTER __MI_INST(0xD) +#define MI_FORCE_WAKEUP __MI_INST(0x1D) +#define MI_STORE_DATA_IMM __MI_INST(0x20)#define MI_SDI_GGTT REG_BIT(22)#define MI_SDI_LEN_DW GENMASK(9, 0)drivers/gpu/drm/xe/xe_gt_debugfs.c +41
-0@@ -15,6 +15,7 @@#include "xe_gt_mcr.h" #include "xe_gt_topology.h" #include "xe_hw_engine.h" +#include "xe_lrc.h" #include "xe_macros.h" #include "xe_pat.h" #include "xe_reg_sr.h" @@ -149,6 +150,41 @@ static int pat(struct seq_file *m, void *data)return 0 ; } +static int rcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_RENDER ); +return 0 ; +} + +static int ccs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COMPUTE ); +return 0 ; +} + +static int bcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_COPY ); +return 0 ; +} + +static int vcs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_DECODE ); +return 0 ; +} + +static int vecs_default_lrc (struct seq_file *m,void *data) { +struct drm_printer p =drm_seq_file_printer (m); + +xe_lrc_dump_default (&p,node_to_gt (m->private),XE_ENGINE_CLASS_VIDEO_ENHANCE ); +return 0 ; +} +static const struct drm_info_list debugfs_list[] = { {"hw_engines" , hw_engines,0 }, {"force_reset" , force_reset,0 },@@ -159,6 +195,11 @@ static const struct drm_info_list debugfs_list[] = { {"register-save-restore", register_save_restore, 0}, {"workarounds", workarounds, 0}, {"pat", pat, 0}, + {"default_lrc_rcs", rcs_default_lrc}, + {"default_lrc_ccs", ccs_default_lrc}, + {"default_lrc_bcs", bcs_default_lrc}, + {"default_lrc_vcs", vcs_default_lrc}, + {"default_lrc_vecs", vecs_default_lrc}, };void xe_gt_debugfs_register (struct xe_gt *gt)drivers/gpu/drm/xe/xe_lrc.c +5
-0@@ -6,6 +6,7 @@#include "xe_lrc.h" #include "instructions/xe_mi_commands.h" +#include "instructions/xe_gfxpipe_commands.h" #include "regs/xe_engine_regs.h" #include "regs/xe_gpu_commands.h" #include "regs/xe_gt_regs.h" @@ -903,3 +904,86 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) {return __xe_lrc_parallel_map (lrc); } + +static int instr_dw (u32 cmd_header) +{ +/* Most instructions have the # of dwords (minus 2) in 7:0 */
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 920
Quoted 10 lines
drivers/gpu/drm/xe/xe_lrc.c +10
-0+return REG_FIELD_GET (XE_INST_LEN_MASK , cmd_header) +2 ; +} + +static int dump_mi_command (struct drm_printer *p, +struct xe_gt *gt, +u32 *dw, +int remaining_dw) +{ +u32 numdw =instr_dw (*dw); +u32 opcode =REG_FIELD_GET (MI_OPCODE , *dw);
missing a warning and return if numdw > remaining_dw so we avoid reading random memory.
Quoted 21 lines
drivers/gpu/drm/xe/xe_lrc.c +21
-0+ +switch (*dw &MI_OPCODE ) { +case MI_NOOP : +int num_noop =1 ; +while (num_noop < remaining_dw && + (*(++dw) ®_GENMASK (31 ,23 )) ==MI_NOOP ) + num_noop++; +drm_printf (p,"MI_NOOP (%d dwords)\n" , num_noop); +return num_noop; + +case MI_LOAD_REGISTER_IMM : +drm_printf (p,"MI_LOAD_REGISTER_IMM: %d regs\n" , (numdw -1 ) /2 ); +for (int i =1 ; i < numdw; i +=2 ) +drm_printf (p," - %#6x = %#010x\n" , dw[i], dw[i +1 ]); +return numdw; + +case MI_TOPOLOGY_FILTER : +drm_printf (p,"MI_TOPOLOGY_FILTER\n" ); +return 1 ; + +case MI_FORCE_WAKEUP :
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 951
Quoted 10 lines
drivers/gpu/drm/xe/xe_lrc.c +10
-0+drm_printf (p,"MI_FORCE_WAKEUP\n" ); +return numdw; + +case MI_BATCH_BUFFER_END : +drm_printf (p,"MI_BATCH_BUFFER_END\n" ); +return 0 ; + +default : +drm_printf (p,"unknown MI opcode %#x, likely %d dwords\n" , + opcode, numdw);
thinking that if in addition to the decoding of the dw, we shouldn't always print the dw itself and have the decoding as a # comment Something like...
0x0000000 # MI_NOOP (1 dwords)0x8800007 # MI_LOAD_REGISTER_IMM (15 regs)
- 0x1a244 = 0xffff0048
- 0x1a034 = 0x000000f8
...
That way we always have the raw data. Just a suggestion, up to you.
Quoted 7 lines
drivers/gpu/drm/xe/xe_lrc.c +7
-0+return numdw; + } +} + +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class hwe_class)
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 968
Quoted 10 lines
drivers/gpu/drm/xe/xe_lrc.c +10
-0+{ +u32 *dw; +int remaining_dw, num_dw; + +if (!gt->default_lrc[hwe_class]) { +drm_printf (p,"No default LRC for class %d\n" , hwe_class); +return ; + } + +/* First page of LRC is a ppHWSP */
since LRC_PPHWSP_SIZE is abstract here and may not always be one page, maybe make the comment as "Skip the beginning of LRC since it contains the ppHWSP".
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 972
Quoted 4 lines
drivers/gpu/drm/xe/xe_lrc.c +4
-0+ dw = gt->default_lrc[hwe_class] +LRC_PPHWSP_SIZE ; + remaining_dw = (xe_lrc_size (gt_to_xe (gt), hwe_class) -LRC_PPHWSP_SIZE ) /4 ; + +while (remaining_dw) {
maybe make this:
while (remaining_dw > 0) {drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 984
Quoted 12 lines
drivers/gpu/drm/xe/xe_lrc.c +12
-0+if ((*dw &XE_INST_CMD_TYPE ) ==XE_INST_MI ) { + num_dw =dump_mi_command (p, gt, dw, remaining_dw); + }else { + num_dw =min (instr_dw (*dw), remaining_dw); +drm_printf (p,"Unknown instr <%#x> of type %#x, likely %d dwords\n" , + *dw,REG_FIELD_GET (XE_INST_CMD_TYPE , *dw), + num_dw); + } + +/* 0 is returned on MI_BATCH_BUFFER_END */ +if (num_dw ==0 ) +break ;
maybe make MI_BATCH_BUFFER_END return remaining_dw so it "consumes the remainder of the buffer"? Then you can remove this check
drivers/gpu/drm/xe/xe_lrc.c struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc) · line 987
Quoted 3 lines
drivers/gpu/drm/xe/xe_lrc.c +3
-0+ + dw += num_dw; + remaining_dw -= num_dw;
suggestion to make the while condition be > 0 so we avoid wraparounds.
Lucas De Marchi
Quoted 26 lines
drivers/gpu/drm/xe/xe_lrc.c +2
-0+ } +}drivers/gpu/drm/xe/xe_lrc.h +5
-0@@ -7,6 +7,7 @@#include "xe_lrc_types.h" +struct drm_printer ;struct xe_device ;struct xe_exec_queue ;enum xe_engine_class ;@@ -47,4 +48,8 @@ struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);size_t xe_lrc_skip_size (struct xe_device *xe); +void xe_lrc_dump_default (struct drm_printer *p, +struct xe_gt *gt, +enum xe_engine_class ); +#endif Signature · 1 line
2.41.0
PATCH 6/6 drm/xe/debugfs: Include GFXPIPE commands in LRC dump
In reply to Matt RoperRCS and CCS engines include several non-register gfxpipe commands in their LRC images. Include these in the dump output so that we can see exactly what's inside the context snapshot.
--- .../drm/xe/instructions/xe_gfxpipe_commands.h | 107 ++++++++++++++++++ drivers/gpu/drm/xe/xe_lrc.c | 99 ++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 drivers/gpu/drm/xe/instructions/xe_gfxpipe_commands.h
drivers/gpu/drm/xe/instructions/xe_gfxpipe_commands.h new file +107 -0
@@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ + +#ifndef _XE_GFXPIPE_COMMANDS_H_ +#define _XE_GFXPIPE_COMMANDS_H_ + +#include "instructions/xe_inst_defs.h" + +#define GFXPIPE_PIPELINE REG_GENMASK(28, 27) +#define PIPELINE_COMMON REG_FIELD_PREP(GFXPIPE_PIPELINE, 0x0) +#define PIPELINE_SINGLE_DW REG_FIELD_PREP(GFXPIPE_PIPELINE, 0x1) +#define PIPELINE_COMPUTE REG_FIELD_PREP(GFXPIPE_PIPELINE, 0x2) +#define PIPELINE_3D REG_FIELD_PREP(GFXPIPE_PIPELINE, 0x3) + +#define GFXPIPE_OPCODE REG_GENMASK(26, 24) +#define GFXPIPE_SUBOPCODE REG_GENMASK(23, 16) + +#define GFXPIPE_MATCH_MASK (XE_INST_CMD_TYPE | \ + GFXPIPE_PIPELINE | \ + GFXPIPE_OPCODE | \ + GFXPIPE_SUBOPCODE) + +#define GFXPIPE_COMMON_CMD (opcode, subopcode) \ + (XE_INST_GFXPIPE | PIPELINE_COMMON | \ + REG_FIELD_PREP(GFXPIPE_OPCODE, opcode) | \ + REG_FIELD_PREP(GFXPIPE_SUBOPCODE, subopcode)) + +#define GFXPIPE_SINGLE_DW_CMD (opcode, subopcode) \ + (XE_INST_GFXPIPE | PIPELINE_SINGLE_DW | \ + REG_FIELD_PREP(GFXPIPE_OPCODE, opcode) | \ + REG_FIELD_PREP(GFXPIPE_SUBOPCODE, subopcode)) + +#define GFXPIPE_3D_CMD (opcode, subopcode) \ + (XE_INST_GFXPIPE | PIPELINE_3D | \ + REG_FIELD_PREP(GFXPIPE_OPCODE, opcode) | \ + REG_FIELD_PREP(GFXPIPE_SUBOPCODE, subopcode)) + +#define GFXPIPE_COMPUTE_CMD (opcode, subopcode) \ + (XE_INST_GFXPIPE | PIPELINE_COMPUTE | \ + REG_FIELD_PREP(GFXPIPE_OPCODE, opcode) | \ + REG_FIELD_PREP(GFXPIPE_SUBOPCODE, subopcode)) + + +#define STATE_BASE_ADDRESS GFXPIPE_COMMON_CMD(0x1, 0x1) +#define STATE_SIP GFXPIPE_COMMON_CMD(0x1, 0x2) +#define GPGPU_CSR_BASE_ADDRESS GFXPIPE_COMMON_CMD(0x1, 0x4) +#define STATE_COMPUTE_MODE GFXPIPE_COMMON_CMD(0x1, 0x5) +#define CMD_3DSTATE_BTD GFXPIPE_COMMON_CMD(0x1, 0x6) + +#define CMD_3DSTATE_VF_STATISTICS GFXPIPE_SINGLE_DW_CMD(0x0, 0xB) + +#define PIPELINE_SELECT GFXPIPE_SINGLE_DW_CMD(0x1, 0x4) + +#define CMD_3DSTATE_CLEAR_PARAMS GFXPIPE_3D_CMD(0x0, 0x4) +#define CMD_3DSTATE_DEPTH_BUFFER GFXPIPE_3D_CMD(0x0, 0x5) +#define CMD_3DSTATE_STENCIL_BUFFER GFXPIPE_3D_CMD(0x0, 0x6) +#define CMD_3DSTATE_HIER_DEPTH_BUFFER GFXPIPE_3D_CMD(0x0, 0x7) +#define CMD_3DSTATE_VERTEX_BUFFERS GFXPIPE_3D_CMD(0x0, 0x8) +#define CMD_3DSTATE_INDEX_BUFFER GFXPIPE_3D_CMD(0x0, 0xA) +#define CMD_3DSTATE_VF GFXPIPE_3D_CMD(0x0, 0xC) +#define CMD_3DSTATE_CC_STATE_POINTERS GFXPIPE_3D_CMD(0x0, 0xE) +#define CMD_3DSTATE_WM GFXPIPE_3D_CMD(0x0, 0x14) +#define CMD_3DSTATE_SAMPLE_MASK GFXPIPE_3D_CMD(0x0, 0x18) +#define CMD_3DSTATE_SBE GFXPIPE_3D_CMD(0x0, 0x1F) +#define CMD_3DSTATE_PS GFXPIPE_3D_CMD(0x0, 0x20) +#define CMD_3DSTATE_CPS_POINTERS GFXPIPE_3D_CMD(0x0, 0x22) +#define CMD_3DSTATE_VIEWPORT_STATE_POINTERS_CC GFXPIPE_3D_CMD(0x0, 0x23) +#define CMD_3DSTATE_BLEND_STATE_POINTERS GFXPIPE_3D_CMD(0x0, 0x24) +#define CMD_3DSTATE_BINDING_TABLE_POINTERS_PS GFXPIPE_3D_CMD(0x0, 0x2A) +#define CMD_3DSTATE_SAMPLER_STATE_POINTERS_PS GFXPIPE_3D_CMD(0x0, 0x2F) +#define CMD_3DSTATE_VF_INSTANCING GFXPIPE_3D_CMD(0x0, 0x49) +#define CMD_3DSTATE_VF_TOPOLOGY GFXPIPE_3D_CMD(0x0, 0x4B) +#define CMD_3DSTATE_WM_CHROMAKEY GFXPIPE_3D_CMD(0x0, 0x4C) +#define CMD_3DSTATE_PS_BLEND GFXPIPE_3D_CMD(0x0, 0x4D) +#define CMD_3DSTATE_WM_DEPTH_STENCIL GFXPIPE_3D_CMD(0x0, 0x4E) +#define CMD_3DSTATE_PS_EXTRA GFXPIPE_3D_CMD(0x0, 0x4F) +#define CMD_3DSTATE_SBE_SWIZ GFXPIPE_3D_CMD(0x0, 0x51) +#define CMD_3DSTATE_VFG GFXPIPE_3D_CMD(0x0, 0x57) +#define CMD_3DSTATE_AMFS GFXPIPE_3D_CMD(0x0, 0x6F) +#define CMD_3DSTATE_DEPTH_BOUNDS GFXPIPE_3D_CMD(0x0, 0x71) +#define CMD_3DSTATE_CONSTANT_TS_POINTER GFXPIPE_3D_CMD(0x0, 0x73) +#define CMD_3DSTATE_MESH_DISTRIB GFXPIPE_3D_CMD(0x0, 0x78) +#define CMD_3DSTATE_SBE_MESH GFXPIPE_3D_CMD(0x0, 0x82) +#define CMD_3DSTATE_CPSIZE_CONTROL_BUFFER GFXPIPE_3D_CMD(0x0, 0x83) + +#define CMD_3DSTATE_CHROMA_KEY GFXPIPE_3D_CMD(0x1, 0x4) +#define CMD_3DSTATE_POLY_STIPPLE_OFFSET GFXPIPE_3D_CMD(0x1, 0x6) +#define CMD_3DSTATE_POLY_STIPPLE_PATTERN GFXPIPE_3D_CMD(0x1, 0x7) +#define CMD_3DSTATE_LINE_STIPPLE GFXPIPE_3D_CMD(0x1, 0x8) +#define CMD_3DSTATE_AA_LINE_PARAMETERS GFXPIPE_3D_CMD(0x1, 0xA) +#define CMD_3DSTATE_PUSH_CONSTANT_ALLOC_VS GFXPIPE_3D_CMD(0x1, 0x12) +#define CMD_3DSTATE_PUSH_CONSTANT_ALLOC_HS GFXPIPE_3D_CMD(0x1, 0x13) +#define CMD_3DSTATE_PUSH_CONSTANT_ALLOC_DS GFXPIPE_3D_CMD(0x1, 0x14) +#define CMD_3DSTATE_PUSH_CONSTANT_ALLOC_GS GFXPIPE_3D_CMD(0x1, 0x15) +#define CMD_3DSTATE_PUSH_CONSTANT_ALLOC_PS GFXPIPE_3D_CMD(0x1, 0x16) +#define CMD_3DSTATE_SO_DECL_LIST GFXPIPE_3D_CMD(0x1, 0x17) +#define CMD_3DSTATE_SO_DECL_LIST_DW_LEN REG_GENMASK(8, 0) +#define CMD_3DSTATE_BINDING_TABLE_POOL_ALLOC GFXPIPE_3D_CMD(0x1, 0x19) +#define CMD_3DSTATE_SAMPLE_PATTERN GFXPIPE_3D_CMD(0x1, 0x1C) +#define CMD_3DSTATE_3D_MODE GFXPIPE_3D_CMD(0x1, 0x1E) +#define CMD_3DSTATE_SUBSLICE_HASH_TABLE GFXPIPE_3D_CMD(0x1, 0x1F) +#define CMD_3DSTATE_SLICE_TABLE_STATE_POINTERS GFXPIPE_3D_CMD(0x1, 0x20) +#define CMD_3DSTATE_PTBR_TILE_PASS_INFO GFXPIPE_3D_CMD(0x1, 0x22) + +#endif
drivers/gpu/drm/xe/xe_lrc.c +99 -0
117 lines not on this page · raw message
Signature · 1 line
2.41.0
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for LRC debugfs and general instruction tweaks
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: LRC debugfs and general instruction tweaks
URL : https://patchwork.freedesktop.org/series/125008/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 6c0d1e36f drm/xe/dg2: Remove one PCI ID
=== git am output follows ===
Applying: drm/xe: Make MI_FLUSH_DW immediate size more explicit
Applying: drm/xe: Separate number of registers from MI_LRI opcode
Applying: drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM
Applying: drm/xe: Extract MI_* instructions to their own header
Applying: drm/xe/debugfs: Add dump of default LRCs' MI instructions
Applying: drm/xe/debugfs: Include GFXPIPE commands in LRC dump
Patchwork
CI[Intel-xe] ✓ CI.Patch_applied: success for LRC debugfs and general instruction tweaks (rev2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: LRC debugfs and general instruction tweaks (rev2)
URL : https://patchwork.freedesktop.org/series/125008/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 6c0d1e36f drm/xe/dg2: Remove one PCI ID
=== git am output follows ===
Applying: drm/xe: Make MI_FLUSH_DW immediate size more explicit
Applying: drm/xe: Separate number of registers from MI_LRI opcode
Applying: drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM
Applying: drm/xe: Extract MI_* instructions to their own header
Applying: drm/xe/debugfs: Add dump of default LRCs' MI instructions
Applying: drm/xe/debugfs: Include GFXPIPE commands in LRC dump
Patchwork
CI[Intel-xe] ✗ CI.checkpatch: warning for LRC debugfs and general instruction tweaks (rev2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: LRC debugfs and general instruction tweaks (rev2)
URL : https://patchwork.freedesktop.org/series/125008/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 63c2b6b160bca2df6efc7bc4cea6f442097d7854
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 35af4701f7ef446c98a98f03777a732e1a9fbc5c
Author: Matt Roper <[email protected]> Date: Wed Oct 11 16:10:04 2023 -0700
drm/xe/debugfs: Include GFXPIPE commands in LRC dump
RCS and CCS engines include several non-register gfxpipe commands in their LRC images. Include these in the dump output so that we can see exactly what's inside the context snapshot.
+ /mt/dim checkpatch 6c0d1e36f310682297a5b07336b0883afc77f66e drm-intel43834bf0e drm/xe: Make MI_FLUSH_DW immediate size more explicitb20eeb3a8 drm/xe: Separate number of registers from MI_LRI opcodec2a553548 drm/xe: Clarify number of dwords/qwords stored by MI_STORE_DATA_IMM d11b497f1 drm/xe: Extract MI_* instructions to their own header
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:18: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #18:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 190 lines checked70f54e2b8 drm/xe/debugfs: Add dump of default LRCs' MI instructions
-:61: ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #61: FILE: drivers/gpu/drm/xe/xe_gt_debugfs.c:153:
+static int rcs_default_lrc(struct seq_file *m, void *data) {
-:68: ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #68: FILE: drivers/gpu/drm/xe/xe_gt_debugfs.c:160:
+static int ccs_default_lrc(struct seq_file *m, void *data) {
-:75: ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #75: FILE: drivers/gpu/drm/xe/xe_gt_debugfs.c:167:
+static int bcs_default_lrc(struct seq_file *m, void *data) {
-:82: ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #82: FILE: drivers/gpu/drm/xe/xe_gt_debugfs.c:174:
+static int vcs_default_lrc(struct seq_file *m, void *data) {
-:89: ERROR:OPEN_BRACE: open brace '{' following function definitions go on the next line #89: FILE: drivers/gpu/drm/xe/xe_gt_debugfs.c:181:
+static int vecs_default_lrc(struct seq_file *m, void *data) {
-:145: WARNING:LINE_SPACING: Missing a blank line after declarations #145: FILE: drivers/gpu/drm/xe/xe_lrc.c:925:
+ int num_noop = 1;
+ while (num_noop < remaining_dw &&
total: 5 errors, 1 warnings, 0 checks, 183 lines checked35af4701f drm/xe/debugfs: Include GFXPIPE commands in LRC dump
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:13: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #13:
new file mode 100644
-:62: CHECK:LINE_SPACING: Please don't use multiple blank lines #62: FILE: drivers/gpu/drm/xe/instructions/xe_gfxpipe_commands.h:45:
+
+
-:160: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' #160: FILE: drivers/gpu/drm/xe/xe_lrc.c:976:
+ switch (*dw & GFXPIPE_MATCH_MASK) {
+
-:161: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided #161: FILE: drivers/gpu/drm/xe/xe_lrc.c:977:
+#define MATCH(cmd) \
+ case cmd: \
+ drm_printf(p, #cmd " (%d dwords)\n", numdw); \
+ return numdw
total: 0 errors, 2 warnings, 2 checks, 224 lines checked
Patchwork
CI[Intel-xe] ✗ CI.KUnit: failure for LRC debugfs and general instruction tweaks (rev2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: LRC debugfs and general instruction tweaks (rev2)
URL : https://patchwork.freedesktop.org/series/125008/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../drivers/gpu/drm/xe/xe_lrc.c: In function ‘dump_mi_command’:../drivers/gpu/drm/xe/xe_lrc.c:933:3: error: a label can only be part of a statement and a declaration is not a statement
933 | int num_noop = 1;
| ^~~make[7]: *** [../scripts/Makefile.build:243: drivers/gpu/drm/xe/xe_lrc.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:480: drivers/gpu/drm/xe] Error 2 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:480: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:480: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:480: drivers] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:1913: .] Error 2
make[1]: *** [/kernel/Makefile:234: __sub-make] Error 2
make: *** [Makefile:234: __sub-make] Error 2
[19:29:57] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [19:30:01] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel