Skip to content

Commit 66c8f7b

Browse files
unerligelucasdemarchi
authored andcommitted
drm/xe: Save CTX_TIMESTAMP mmio value instead of LRC value
For determining actual job execution time, save the current value of the CTX_TIMESTAMP register rather than the value saved in LRC since the current register value is the closest to the start time of the job. v2: Define MI_STORE_REGISTER_MEM to fix compile error v3: Place MI_STORE_REGISTER_MEM sorted by MI_INSTR (Lucas) Fixes: 6592137 ("drm/xe: Emit ctx timestamp copy in ring ops") Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20250509161159.2173069-6-umesh.nerlige.ramappa@intel.com (cherry picked from commit 38b1423) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 1b36ea2 commit 66c8f7b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
#define MI_LRI_FORCE_POSTED REG_BIT(12)
4848
#define MI_LRI_LEN(x) (((x) & 0xff) + 1)
4949

50+
#define MI_STORE_REGISTER_MEM (__MI_INSTR(0x24) | XE_INSTR_NUM_DW(4))
51+
#define MI_SRM_USE_GGTT REG_BIT(22)
52+
#define MI_SRM_ADD_CS_OFFSET REG_BIT(19)
53+
5054
#define MI_FLUSH_DW __MI_INSTR(0x26)
5155
#define MI_FLUSH_DW_PROTECTED_MEM_EN REG_BIT(22)
5256
#define MI_FLUSH_DW_STORE_INDEX REG_BIT(21)

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static inline u32 __xe_lrc_start_seqno_offset(struct xe_lrc *lrc)
684684

685685
static u32 __xe_lrc_ctx_job_timestamp_offset(struct xe_lrc *lrc)
686686
{
687-
/* The start seqno is stored in the driver-defined portion of PPHWSP */
687+
/* This is stored in the driver-defined portion of PPHWSP */
688688
return xe_lrc_pphwsp_offset(lrc) + LRC_CTX_JOB_TIMESTAMP_OFFSET;
689689
}
690690

drivers/gpu/drm/xe/xe_ring_ops.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,10 @@ static u32 get_ppgtt_flag(struct xe_sched_job *job)
234234

235235
static int emit_copy_timestamp(struct xe_lrc *lrc, u32 *dw, int i)
236236
{
237-
dw[i++] = MI_COPY_MEM_MEM | MI_COPY_MEM_MEM_SRC_GGTT |
238-
MI_COPY_MEM_MEM_DST_GGTT;
237+
dw[i++] = MI_STORE_REGISTER_MEM | MI_SRM_USE_GGTT | MI_SRM_ADD_CS_OFFSET;
238+
dw[i++] = RING_CTX_TIMESTAMP(0).addr;
239239
dw[i++] = xe_lrc_ctx_job_timestamp_ggtt_addr(lrc);
240240
dw[i++] = 0;
241-
dw[i++] = xe_lrc_ctx_timestamp_ggtt_addr(lrc);
242-
dw[i++] = 0;
243-
dw[i++] = MI_NOOP;
244241

245242
return i;
246243
}

0 commit comments

Comments
 (0)