Skip to content

Commit fb6c5b1

Browse files
committed
Merge tag 'drm-xe-next-2024-10-31' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next
UAPI Changes: - Define and parse OA sync properties (Ashutosh) Driver Changes: - Add caller info to xe_gt_reset_async (Nirmoy) - A large forcewake rework / cleanup (Himal) - A g2h response timeout fix (Badal) - A PTL workaround (Vinay) - Handle unreliable MMIO reads during forcewake (Shuicheng) - Ufence user-space access fixes (Nirmoy) - Annotate flexible arrays (Matthew Brost) - Enable GuC lite restore (Fei) - Prevent GuC register capture on VF (Zhanjun) - Show VFs VRAM / LMEM provisioning summary over debugfs (Michal) - Parallel queues fix on GT reset (Nirmoy) - Move reference grabbing to a job's dma-fence (Matt Brost) - Mark a number of local workqueues WQ_MEM_RECLAIM (Matt Brost) - OA synchronization support (Ashutosh) - Capture all available bits of GuC timestamp to GuC log (John) - Increase readability of guc_info debugfs (John) - Add a mmio barrier before GGTT invalidate (Matt Brost) - Don't short-circuit TDR on jobs not started (Matt Brost) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZyNvA_vZZYR-1eWE@fedora
2 parents ffd9939 + 35d25a4 commit fb6c5b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1012
-518
lines changed

drivers/gpu/drm/xe/abi/guc_klvs_abi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ enum xe_guc_klv_ids {
352352
GUC_WORKAROUND_KLV_ID_DISABLE_MTP_DURING_ASYNC_COMPUTE = 0x9007,
353353
GUC_WA_KLV_NP_RD_WRITE_TO_CLEAR_RCSM_AT_CGP_LATE_RESTORE = 0x9008,
354354
GUC_WORKAROUND_KLV_ID_BACK_TO_BACK_RCS_ENGINE_RESET = 0x9009,
355+
GUC_WA_KLV_WAKE_POWER_DOMAINS_FOR_OUTBOUND_MMIO = 0x900a,
355356
};
356357

357358
#endif

drivers/gpu/drm/xe/display/xe_hdcp_gsc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
4242
struct xe_gt *gt = tile->media_gt;
4343
struct xe_gsc *gsc = &gt->uc.gsc;
4444
bool ret = true;
45+
unsigned int fw_ref;
4546

4647
if (!gsc && !xe_uc_fw_is_enabled(&gsc->fw)) {
4748
drm_dbg_kms(&xe->drm,
@@ -50,7 +51,8 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
5051
}
5152

5253
xe_pm_runtime_get(xe);
53-
if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) {
54+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
55+
if (!fw_ref) {
5456
drm_dbg_kms(&xe->drm,
5557
"failed to get forcewake to check proxy status\n");
5658
ret = false;
@@ -60,7 +62,7 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
6062
if (!xe_gsc_proxy_init_done(gsc))
6163
ret = false;
6264

63-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);
65+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
6466
out:
6567
xe_pm_runtime_put(xe);
6668
return ret;

drivers/gpu/drm/xe/regs/xe_guc_regs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
#define HUC_LOADING_AGENT_GUC REG_BIT(1)
8585
#define GUC_WOPCM_OFFSET_VALID REG_BIT(0)
8686
#define GUC_MAX_IDLE_COUNT XE_REG(0xc3e4)
87-
#define GUC_PMTIMESTAMP XE_REG(0xc3e8)
87+
#define GUC_PMTIMESTAMP_LO XE_REG(0xc3e8)
88+
#define GUC_PMTIMESTAMP_HI XE_REG(0xc3ec)
8889

8990
#define GUC_SEND_INTERRUPT XE_REG(0xc4c8)
9091
#define GUC_SEND_TRIGGER REG_BIT(0)

drivers/gpu/drm/xe/tests/xe_mocs.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ static void read_l3cc_table(struct xe_gt *gt,
4343
{
4444
struct kunit *test = kunit_get_current_test();
4545
u32 l3cc, l3cc_expected;
46-
unsigned int i;
46+
unsigned int fw_ref, i;
4747
u32 reg_val;
48-
u32 ret;
4948

50-
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
51-
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
49+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
50+
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");
5251

5352
for (i = 0; i < info->num_mocs_regs; i++) {
5453
if (!(i & 1)) {
@@ -72,23 +71,22 @@ static void read_l3cc_table(struct xe_gt *gt,
7271
KUNIT_EXPECT_EQ_MSG(test, l3cc_expected, l3cc,
7372
"l3cc idx=%u has incorrect val.\n", i);
7473
}
75-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
74+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
7675
}
7776

7877
static void read_mocs_table(struct xe_gt *gt,
7978
const struct xe_mocs_info *info)
8079
{
8180
struct kunit *test = kunit_get_current_test();
8281
u32 mocs, mocs_expected;
83-
unsigned int i;
82+
unsigned int fw_ref, i;
8483
u32 reg_val;
85-
u32 ret;
8684

8785
KUNIT_EXPECT_TRUE_MSG(test, info->unused_entries_index,
8886
"Unused entries index should have been defined\n");
8987

90-
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
91-
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
88+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
89+
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");
9290

9391
for (i = 0; i < info->num_mocs_regs; i++) {
9492
if (regs_are_mcr(gt))
@@ -106,7 +104,7 @@ static void read_mocs_table(struct xe_gt *gt,
106104
"mocs reg 0x%x has incorrect val.\n", i);
107105
}
108106

109-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
107+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
110108
}
111109

112110
static int mocs_kernel_test_run_device(struct xe_device *xe)

drivers/gpu/drm/xe/xe_debugfs.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,32 @@ static int forcewake_open(struct inode *inode, struct file *file)
9090
{
9191
struct xe_device *xe = inode->i_private;
9292
struct xe_gt *gt;
93-
u8 id;
93+
u8 id, last_gt;
94+
unsigned int fw_ref;
9495

9596
xe_pm_runtime_get(xe);
96-
for_each_gt(gt, xe, id)
97-
XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL));
97+
for_each_gt(gt, xe, id) {
98+
last_gt = id;
99+
100+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
101+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
102+
goto err_fw_get;
103+
}
98104

99105
return 0;
106+
107+
err_fw_get:
108+
for_each_gt(gt, xe, id) {
109+
if (id < last_gt)
110+
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
111+
else if (id == last_gt)
112+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
113+
else
114+
break;
115+
}
116+
117+
xe_pm_runtime_put(xe);
118+
return -ETIMEDOUT;
100119
}
101120

102121
static int forcewake_release(struct inode *inode, struct file *file)
@@ -106,7 +125,7 @@ static int forcewake_release(struct inode *inode, struct file *file)
106125
u8 id;
107126

108127
for_each_gt(gt, xe, id)
109-
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
128+
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
110129
xe_pm_runtime_put(xe);
111130

112131
return 0;

drivers/gpu/drm/xe/xe_devcoredump.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
158158
{
159159
struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
160160
struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
161+
unsigned int fw_ref;
161162

162163
/* keep going if fw fails as we still want to save the memory and SW data */
163-
if (xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL))
164+
fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
165+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
164166
xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
165167
xe_vm_snapshot_capture_delayed(ss->vm);
166168
xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
167-
xe_force_wake_put(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
169+
xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);
168170

169171
/* Calculate devcoredump size */
170172
ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
@@ -236,8 +238,9 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
236238
u32 width_mask = (0x1 << q->width) - 1;
237239
const char *process_name = "no process";
238240

239-
int i;
241+
unsigned int fw_ref;
240242
bool cookie;
243+
int i;
241244

242245
ss->snapshot_time = ktime_get_real();
243246
ss->boot_time = ktime_get_boottime();
@@ -261,11 +264,10 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
261264
}
262265

263266
/* keep going if fw fails as we still want to save the memory and SW data */
264-
if (xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL))
265-
xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
267+
fw_ref = xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
266268

267269
ss->guc.log = xe_guc_log_snapshot_capture(&guc->log, true);
268-
ss->guc.ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
270+
ss->guc.ct = xe_guc_ct_snapshot_capture(&guc->ct);
269271
ss->ge = xe_guc_exec_queue_snapshot_capture(q);
270272
ss->job = xe_sched_job_snapshot_capture(job);
271273
ss->vm = xe_vm_snapshot_capture(q->vm);
@@ -274,7 +276,7 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
274276

275277
queue_work(system_unbound_wq, &ss->work);
276278

277-
xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
279+
xe_force_wake_put(gt_to_fw(q->gt), fw_ref);
278280
dma_fence_end_signalling(cookie);
279281
}
280282

drivers/gpu/drm/xe/xe_device.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,18 +604,18 @@ int xe_device_probe_early(struct xe_device *xe)
604604
static int probe_has_flat_ccs(struct xe_device *xe)
605605
{
606606
struct xe_gt *gt;
607+
unsigned int fw_ref;
607608
u32 reg;
608-
int err;
609609

610610
/* Always enabled/disabled, no runtime check to do */
611611
if (GRAPHICS_VER(xe) < 20 || !xe->info.has_flat_ccs)
612612
return 0;
613613

614614
gt = xe_root_mmio_gt(xe);
615615

616-
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
617-
if (err)
618-
return err;
616+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
617+
if (!fw_ref)
618+
return -ETIMEDOUT;
619619

620620
reg = xe_gt_mcr_unicast_read_any(gt, XE2_FLAT_CCS_BASE_RANGE_LOWER);
621621
xe->info.has_flat_ccs = (reg & XE2_FLAT_CCS_ENABLE);
@@ -624,7 +624,8 @@ static int probe_has_flat_ccs(struct xe_device *xe)
624624
drm_dbg(&xe->drm,
625625
"Flat CCS has been disabled in bios, May lead to performance impact");
626626

627-
return xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
627+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
628+
return 0;
628629
}
629630

630631
int xe_device_probe(struct xe_device *xe)
@@ -875,6 +876,7 @@ void xe_device_wmb(struct xe_device *xe)
875876
void xe_device_td_flush(struct xe_device *xe)
876877
{
877878
struct xe_gt *gt;
879+
unsigned int fw_ref;
878880
u8 id;
879881

880882
if (!IS_DGFX(xe) || GRAPHICS_VER(xe) < 20)
@@ -889,7 +891,8 @@ void xe_device_td_flush(struct xe_device *xe)
889891
if (xe_gt_is_media_type(gt))
890892
continue;
891893

892-
if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
894+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
895+
if (!fw_ref)
893896
return;
894897

895898
xe_mmio_write32(&gt->mmio, XE2_TDF_CTRL, TRANSIENT_FLUSH_REQUEST);
@@ -904,22 +907,22 @@ void xe_device_td_flush(struct xe_device *xe)
904907
150, NULL, false))
905908
xe_gt_err_once(gt, "TD flush timeout\n");
906909

907-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
910+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
908911
}
909912
}
910913

911914
void xe_device_l2_flush(struct xe_device *xe)
912915
{
913916
struct xe_gt *gt;
914-
int err;
917+
unsigned int fw_ref;
915918

916919
gt = xe_root_mmio_gt(xe);
917920

918921
if (!XE_WA(gt, 16023588340))
919922
return;
920923

921-
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
922-
if (err)
924+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
925+
if (!fw_ref)
923926
return;
924927

925928
spin_lock(&gt->global_invl_lock);
@@ -929,7 +932,7 @@ void xe_device_l2_flush(struct xe_device *xe)
929932
xe_gt_err_once(gt, "Global invalidation timeout\n");
930933
spin_unlock(&gt->global_invl_lock);
931934

932-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
935+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
933936
}
934937

935938
u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)

drivers/gpu/drm/xe/xe_drm_client.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
278278
struct xe_hw_engine *hwe;
279279
struct xe_exec_queue *q;
280280
u64 gpu_timestamp;
281+
unsigned int fw_ref;
281282

282283
xe_pm_runtime_get(xe);
283284

@@ -303,13 +304,16 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
303304
continue;
304305

305306
fw = xe_hw_engine_to_fw_domain(hwe);
306-
if (xe_force_wake_get(gt_to_fw(gt), fw)) {
307+
308+
fw_ref = xe_force_wake_get(gt_to_fw(gt), fw);
309+
if (!xe_force_wake_ref_has_domain(fw_ref, fw)) {
307310
hwe = NULL;
311+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
308312
break;
309313
}
310314

311315
gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
312-
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), fw));
316+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
313317
break;
314318
}
315319

drivers/gpu/drm/xe/xe_exec_queue_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct xe_exec_queue {
143143
/** @hw_engine_group_link: link into exec queues in the same hw engine group */
144144
struct list_head hw_engine_group_link;
145145
/** @lrc: logical ring context for this exec queue */
146-
struct xe_lrc *lrc[];
146+
struct xe_lrc *lrc[] __counted_by(width);
147147
};
148148

149149
/**

drivers/gpu/drm/xe/xe_execlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ execlist_run_job(struct drm_sched_job *drm_job)
313313
q->ring_ops->emit_job(job);
314314
xe_execlist_make_active(exl);
315315

316-
return dma_fence_get(job->fence);
316+
return job->fence;
317317
}
318318

319319
static void execlist_job_free(struct drm_sched_job *drm_job)

0 commit comments

Comments
 (0)