Skip to content

Commit e827cf3

Browse files
harishchegondiashutoshx
authored andcommitted
drm/xe/eustall: Add EU stall sampling support for Xe2
Add EU stall sampling support for Xe2 architecture GPUs - LNL and BMG. EU stall data format for LNL and BMG is different from that of PVC. v10: Update comments as per review feedback v9: Use GRAPHICS_VER() check instead of platform v8: Renamed struct drm_xe_eu_stall_data_xe2 to struct xe_eu_stall_data_xe2 since it is a local structure. Reviewed-by: Ashutosh Dixit <[email protected]> Signed-off-by: Harish Chegondi <[email protected]> Signed-off-by: Ashutosh Dixit <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/d85093e9ab1204d14d2cc783f304a4bc8688951c.1740533885.git.harish.chegondi@intel.com
1 parent 9e0590e commit e827cf3

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

drivers/gpu/drm/xe/xe_eu_stall.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,35 @@ struct xe_eu_stall_data_pvc {
9999
__u64 unused[6];
100100
} __packed;
101101

102+
/*
103+
* EU stall data format for Xe2 arch GPUs (LNL, BMG).
104+
*/
105+
struct xe_eu_stall_data_xe2 {
106+
__u64 ip_addr:29; /* Bits 0 to 28 */
107+
__u64 tdr_count:8; /* Bits 29 to 36 */
108+
__u64 other_count:8; /* Bits 37 to 44 */
109+
__u64 control_count:8; /* Bits 45 to 52 */
110+
__u64 pipestall_count:8; /* Bits 53 to 60 */
111+
__u64 send_count:8; /* Bits 61 to 68 */
112+
__u64 dist_acc_count:8; /* Bits 69 to 76 */
113+
__u64 sbid_count:8; /* Bits 77 to 84 */
114+
__u64 sync_count:8; /* Bits 85 to 92 */
115+
__u64 inst_fetch_count:8; /* Bits 93 to 100 */
116+
__u64 active_count:8; /* Bits 101 to 108 */
117+
__u64 ex_id:3; /* Bits 109 to 111 */
118+
__u64 end_flag:1; /* Bit 112 */
119+
__u64 unused_bits:15;
120+
__u64 unused[6];
121+
} __packed;
122+
102123
static size_t xe_eu_stall_data_record_size(struct xe_device *xe)
103124
{
104125
size_t record_size = 0;
105126

106127
if (xe->info.platform == XE_PVC)
107128
record_size = sizeof(struct xe_eu_stall_data_pvc);
129+
else if (GRAPHICS_VER(xe) >= 20)
130+
record_size = sizeof(struct xe_eu_stall_data_xe2);
108131

109132
xe_assert(xe, is_power_of_2(record_size));
110133

@@ -345,10 +368,16 @@ static bool eu_stall_data_buf_poll(struct xe_eu_stall_data_stream *stream)
345368

346369
static void clear_dropped_eviction_line_bit(struct xe_gt *gt, u16 group, u16 instance)
347370
{
371+
struct xe_device *xe = gt_to_xe(gt);
348372
u32 write_ptr_reg;
349373

350-
/* On PVC, the overflow bit has to be cleared by writing 1 to it. */
351-
write_ptr_reg = _MASKED_BIT_ENABLE(XEHPC_EUSTALL_REPORT_OVERFLOW_DROP);
374+
/* On PVC, the overflow bit has to be cleared by writing 1 to it.
375+
* On Xe2 and later GPUs, the bit has to be cleared by writing 0 to it.
376+
*/
377+
if (GRAPHICS_VER(xe) >= 20)
378+
write_ptr_reg = _MASKED_BIT_DISABLE(XEHPC_EUSTALL_REPORT_OVERFLOW_DROP);
379+
else
380+
write_ptr_reg = _MASKED_BIT_ENABLE(XEHPC_EUSTALL_REPORT_OVERFLOW_DROP);
352381

353382
xe_gt_mcr_unicast_write(gt, XEHPC_EUSTALL_REPORT, write_ptr_reg, group, instance);
354383
}
@@ -785,7 +814,7 @@ static const struct file_operations fops_eu_stall = {
785814

786815
static inline bool has_eu_stall_sampling_support(struct xe_device *xe)
787816
{
788-
return xe->info.platform == XE_PVC;
817+
return xe->info.platform == XE_PVC || GRAPHICS_VER(xe) >= 20;
789818
}
790819

791820
static int xe_eu_stall_stream_open_locked(struct drm_device *dev,

0 commit comments

Comments
 (0)