Skip to content

Commit f7be784

Browse files
committed
Merge tag 'drm-xe-fixes-2025-05-09' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
Driver Changes: - Prevent PF queue overflow - Hold all forcewake during mocs test - Remove GSC flush on reset path - Fix forcewake put on error path - Fix runtime warning when building without svm Signed-off-by: Dave Airlie <airlied@redhat.com> From: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/jffqa56f2zp4i5ztz677cdspgxhnw7qfop3dd3l2epykfpfvza@q2nw6wapsphz
2 parents 80e12f3 + 564467e commit f7be784

File tree

13 files changed

+84
-12
lines changed

13 files changed

+84
-12
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ static void read_l3cc_table(struct xe_gt *gt,
4646
unsigned int fw_ref, i;
4747
u32 reg_val;
4848

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");
49+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
50+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
51+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
52+
KUNIT_ASSERT_TRUE_MSG(test, true, "Forcewake Failed.\n");
53+
}
5154

5255
for (i = 0; i < info->num_mocs_regs; i++) {
5356
if (!(i & 1)) {

drivers/gpu/drm/xe/xe_gsc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,28 @@ void xe_gsc_wait_for_worker_completion(struct xe_gsc *gsc)
555555
flush_work(&gsc->work);
556556
}
557557

558+
void xe_gsc_stop_prepare(struct xe_gsc *gsc)
559+
{
560+
struct xe_gt *gt = gsc_to_gt(gsc);
561+
int ret;
562+
563+
if (!xe_uc_fw_is_loadable(&gsc->fw) || xe_uc_fw_is_in_error_state(&gsc->fw))
564+
return;
565+
566+
xe_force_wake_assert_held(gt_to_fw(gt), XE_FW_GSC);
567+
568+
/*
569+
* If the GSC FW load or the proxy init are interrupted, the only way
570+
* to recover it is to do an FLR and reload the GSC from scratch.
571+
* Therefore, let's wait for the init to complete before stopping
572+
* operations. The proxy init is the last step, so we can just wait on
573+
* that
574+
*/
575+
ret = xe_gsc_wait_for_proxy_init_done(gsc);
576+
if (ret)
577+
xe_gt_err(gt, "failed to wait for GSC init completion before uc stop\n");
578+
}
579+
558580
/*
559581
* wa_14015076503: if the GSC FW is loaded, we need to alert it before doing a
560582
* GSC engine reset by writing a notification bit in the GS1 register and then

drivers/gpu/drm/xe/xe_gsc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct xe_hw_engine;
1616
int xe_gsc_init(struct xe_gsc *gsc);
1717
int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc);
1818
void xe_gsc_wait_for_worker_completion(struct xe_gsc *gsc);
19+
void xe_gsc_stop_prepare(struct xe_gsc *gsc);
1920
void xe_gsc_load_start(struct xe_gsc *gsc);
2021
void xe_gsc_hwe_irq_handler(struct xe_hw_engine *hwe, u16 intr_vec);
2122

drivers/gpu/drm/xe/xe_gsc_proxy.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ bool xe_gsc_proxy_init_done(struct xe_gsc *gsc)
7171
HECI1_FWSTS1_PROXY_STATE_NORMAL;
7272
}
7373

74+
int xe_gsc_wait_for_proxy_init_done(struct xe_gsc *gsc)
75+
{
76+
struct xe_gt *gt = gsc_to_gt(gsc);
77+
78+
/* Proxy init can take up to 500ms, so wait double that for safety */
79+
return xe_mmio_wait32(&gt->mmio, HECI_FWSTS1(MTL_GSC_HECI1_BASE),
80+
HECI1_FWSTS1_CURRENT_STATE,
81+
HECI1_FWSTS1_PROXY_STATE_NORMAL,
82+
USEC_PER_SEC, NULL, false);
83+
}
84+
7485
static void __gsc_proxy_irq_rmw(struct xe_gsc *gsc, u32 clr, u32 set)
7586
{
7687
struct xe_gt *gt = gsc_to_gt(gsc);

drivers/gpu/drm/xe/xe_gsc_proxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct xe_gsc;
1212

1313
int xe_gsc_proxy_init(struct xe_gsc *gsc);
1414
bool xe_gsc_proxy_init_done(struct xe_gsc *gsc);
15+
int xe_gsc_wait_for_proxy_init_done(struct xe_gsc *gsc);
1516
int xe_gsc_proxy_start(struct xe_gsc *gsc);
1617

1718
int xe_gsc_proxy_request_handler(struct xe_gsc *gsc);

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ void xe_gt_suspend_prepare(struct xe_gt *gt)
857857

858858
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
859859

860-
xe_uc_stop_prepare(&gt->uc);
860+
xe_uc_suspend_prepare(&gt->uc);
861861

862862
xe_force_wake_put(gt_to_fw(gt), fw_ref);
863863
}

drivers/gpu/drm/xe/xe_gt_debugfs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,23 @@ static int hw_engines(struct xe_gt *gt, struct drm_printer *p)
9292
struct xe_hw_engine *hwe;
9393
enum xe_hw_engine_id id;
9494
unsigned int fw_ref;
95+
int ret = 0;
9596

9697
xe_pm_runtime_get(xe);
9798
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
9899
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
99-
xe_pm_runtime_put(xe);
100-
xe_force_wake_put(gt_to_fw(gt), fw_ref);
101-
return -ETIMEDOUT;
100+
ret = -ETIMEDOUT;
101+
goto fw_put;
102102
}
103103

104104
for_each_hw_engine(hwe, gt, id)
105105
xe_hw_engine_print(hwe, p);
106106

107+
fw_put:
107108
xe_force_wake_put(gt_to_fw(gt), fw_ref);
108109
xe_pm_runtime_put(xe);
109110

110-
return 0;
111+
return ret;
111112
}
112113

113114
static int powergate_info(struct xe_gt *gt, struct drm_printer *p)

drivers/gpu/drm/xe/xe_gt_pagefault.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,16 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
435435
num_eus = bitmap_weight(gt->fuse_topo.eu_mask_per_dss,
436436
XE_MAX_EU_FUSE_BITS) * num_dss;
437437

438-
/* user can issue separate page faults per EU and per CS */
438+
/*
439+
* user can issue separate page faults per EU and per CS
440+
*
441+
* XXX: Multiplier required as compute UMD are getting PF queue errors
442+
* without it. Follow on why this multiplier is required.
443+
*/
444+
#define PF_MULTIPLIER 8
439445
pf_queue->num_dw =
440-
(num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;
446+
(num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW * PF_MULTIPLIER;
447+
#undef PF_MULTIPLIER
441448

442449
pf_queue->gt = gt;
443450
pf_queue->data = devm_kcalloc(xe->drm.dev, pf_queue->num_dw,

drivers/gpu/drm/xe/xe_svm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,3 +947,15 @@ int xe_devm_add(struct xe_tile *tile, struct xe_vram_region *vr)
947947
return 0;
948948
}
949949
#endif
950+
951+
/**
952+
* xe_svm_flush() - SVM flush
953+
* @vm: The VM.
954+
*
955+
* Flush all SVM actions.
956+
*/
957+
void xe_svm_flush(struct xe_vm *vm)
958+
{
959+
if (xe_vm_in_fault_mode(vm))
960+
flush_work(&vm->svm.garbage_collector.work);
961+
}

drivers/gpu/drm/xe/xe_svm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ bool xe_svm_has_mapping(struct xe_vm *vm, u64 start, u64 end);
7272
int xe_svm_bo_evict(struct xe_bo *bo);
7373

7474
void xe_svm_range_debug(struct xe_svm_range *range, const char *operation);
75+
76+
void xe_svm_flush(struct xe_vm *vm);
77+
7578
#else
7679
static inline bool xe_svm_range_pages_valid(struct xe_svm_range *range)
7780
{
@@ -124,6 +127,11 @@ static inline
124127
void xe_svm_range_debug(struct xe_svm_range *range, const char *operation)
125128
{
126129
}
130+
131+
static inline void xe_svm_flush(struct xe_vm *vm)
132+
{
133+
}
134+
127135
#endif
128136

129137
/**

0 commit comments

Comments
 (0)