Skip to content

Commit 81dccec

Browse files
mwajdeczlucasdemarchi
authored andcommitted
drm/xe/pf: Prepare to stop SR-IOV support prior GT reset
As part of the resume or GT reset, the PF driver schedules work which is then used to complete restarting of the SR-IOV support, including resending to the GuC configurations of provisioned VFs. However, in case of short delay between those two actions, which could be seen by triggering a GT reset on the suspened device: $ echo 1 > /sys/kernel/debug/dri/0000:00:02.0/gt0/force_reset this PF worker might be still busy, which lead to errors due to just stopped or disabled GuC CTB communication: [ ] xe 0000:00:02.0: [drm:xe_gt_resume [xe]] GT0: resumed [ ] xe 0000:00:02.0: [drm] GT0: trying reset from force_reset_show [xe] [ ] xe 0000:00:02.0: [drm] GT0: reset queued [ ] xe 0000:00:02.0: [drm] GT0: reset started [ ] xe 0000:00:02.0: [drm:guc_ct_change_state [xe]] GT0: GuC CT communication channel stopped [ ] xe 0000:00:02.0: [drm:guc_ct_send_recv [xe]] GT0: H2G request 0x5503 canceled! [ ] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF1 12 config KLVs (-ECANCELED) [ ] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF1 configuration (-ECANCELED) [ ] xe 0000:00:02.0: [drm:guc_ct_change_state [xe]] GT0: GuC CT communication channel disabled [ ] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF2 12 config KLVs (-ENODEV) [ ] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF2 configuration (-ENODEV) [ ] xe 0000:00:02.0: [drm] GT0: PF: Failed to push 2 of 2 VFs configurations [ ] xe 0000:00:02.0: [drm:pf_worker_restart_func [xe]] GT0: PF: restart completed While this VFs reprovisioning will be successful during next spin of the worker, to avoid those errors, make sure to cancel restart worker if we are about to trigger next reset. Fixes: 4112208 ("drm/xe/pf: Restart VFs provisioning after GT reset") Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Piotr Piórkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit 9f50b72) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 057a7d6 commit 81dccec

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,9 @@ static int gt_reset(struct xe_gt *gt)
839839
goto err_out;
840840
}
841841

842+
if (IS_SRIOV_PF(gt_to_xe(gt)))
843+
xe_gt_sriov_pf_stop_prepare(gt);
844+
842845
xe_uc_gucrc_disable(&gt->uc);
843846
xe_uc_stop_prepare(&gt->uc);
844847
xe_gt_pagefault_reset(gt);

drivers/gpu/drm/xe/xe_gt_sriov_pf.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,25 @@ void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid)
172172
pf_clear_vf_scratch_regs(gt, vfid);
173173
}
174174

175+
static void pf_cancel_restart(struct xe_gt *gt)
176+
{
177+
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
178+
179+
if (cancel_work_sync(&gt->sriov.pf.workers.restart))
180+
xe_gt_sriov_dbg_verbose(gt, "pending restart canceled!\n");
181+
}
182+
183+
/**
184+
* xe_gt_sriov_pf_stop_prepare() - Prepare to stop SR-IOV support.
185+
* @gt: the &xe_gt
186+
*
187+
* This function can only be called on the PF.
188+
*/
189+
void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt)
190+
{
191+
pf_cancel_restart(gt);
192+
}
193+
175194
static void pf_restart(struct xe_gt *gt)
176195
{
177196
struct xe_device *xe = gt_to_xe(gt);

drivers/gpu/drm/xe/xe_gt_sriov_pf.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt);
1313
int xe_gt_sriov_pf_init(struct xe_gt *gt);
1414
void xe_gt_sriov_pf_init_hw(struct xe_gt *gt);
1515
void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid);
16+
void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt);
1617
void xe_gt_sriov_pf_restart(struct xe_gt *gt);
1718
#else
1819
static inline int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
@@ -29,6 +30,10 @@ static inline void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)
2930
{
3031
}
3132

33+
static inline void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt)
34+
{
35+
}
36+
3237
static inline void xe_gt_sriov_pf_restart(struct xe_gt *gt)
3338
{
3439
}

0 commit comments

Comments
 (0)