Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Emit ctx timestamp copy in ring ops

Copy ctx timestamp at beginning of every GPU job to a saved location.
Used to determine how long a job has been running on the hardware.

v2:
- - s/ctx_timestamp_job/ctx_job_timestamp

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240611144053.2805091-4-matthew.brost@intel.com

+21
+21
drivers/gpu/drm/xe/xe_ring_ops.c
··· 224 224 return job->q->vm ? BIT(8) : 0; 225 225 } 226 226 227 + static int emit_copy_timestamp(struct xe_lrc *lrc, u32 *dw, int i) 228 + { 229 + dw[i++] = MI_COPY_MEM_MEM | MI_COPY_MEM_MEM_SRC_GGTT | 230 + MI_COPY_MEM_MEM_DST_GGTT; 231 + dw[i++] = xe_lrc_ctx_job_timestamp_ggtt_addr(lrc); 232 + dw[i++] = 0; 233 + dw[i++] = xe_lrc_ctx_timestamp_ggtt_addr(lrc); 234 + dw[i++] = 0; 235 + dw[i++] = MI_NOOP; 236 + 237 + return i; 238 + } 239 + 227 240 /* for engines that don't require any special HW handling (no EUs, no aux inval, etc) */ 228 241 static void __emit_job_gen12_simple(struct xe_sched_job *job, struct xe_lrc *lrc, 229 242 u64 batch_addr, u32 seqno) ··· 244 231 u32 dw[MAX_JOB_SIZE_DW], i = 0; 245 232 u32 ppgtt_flag = get_ppgtt_flag(job); 246 233 struct xe_gt *gt = job->q->gt; 234 + 235 + i = emit_copy_timestamp(lrc, dw, i); 247 236 248 237 if (job->ring_ops_flush_tlb) { 249 238 dw[i++] = preparser_disable(true); ··· 298 283 struct xe_device *xe = gt_to_xe(gt); 299 284 bool decode = job->q->class == XE_ENGINE_CLASS_VIDEO_DECODE; 300 285 286 + i = emit_copy_timestamp(lrc, dw, i); 287 + 301 288 dw[i++] = preparser_disable(true); 302 289 303 290 /* hsdes: 1809175790 */ ··· 349 332 bool lacks_render = !(gt->info.engine_mask & XE_HW_ENGINE_RCS_MASK); 350 333 u32 mask_flags = 0; 351 334 335 + i = emit_copy_timestamp(lrc, dw, i); 336 + 352 337 dw[i++] = preparser_disable(true); 353 338 if (lacks_render) 354 339 mask_flags = PIPE_CONTROL_3D_ARCH_FLAGS; ··· 393 374 struct xe_lrc *lrc, u32 seqno) 394 375 { 395 376 u32 dw[MAX_JOB_SIZE_DW], i = 0; 377 + 378 + i = emit_copy_timestamp(lrc, dw, i); 396 379 397 380 i = emit_store_imm_ggtt(xe_lrc_start_seqno_ggtt_addr(lrc), 398 381 seqno, dw, i);