Skip to content

Commit c286ce6

Browse files
mwajdeczrodrigovivi
authored andcommitted
drm/xe/pf: Disable PF restart worker on device removal
We can't let restart worker run once device is removed, since other data that it might want to access could be already released. Explicitly disable worker as part of device cleanup action. Fixes: a4d1c5d ("drm/xe/pf: Move VFs reprovisioning to worker") Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com> Cc: Jonathan Cavitt <jonathan.cavitt@intel.com> Link: https://lore.kernel.org/r/20250801142822.180530-2-michal.wajdeczko@intel.com (cherry picked from commit a424353) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 465f1db commit c286ce6

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@ static int pf_alloc_metadata(struct xe_gt *gt)
4747

4848
static void pf_init_workers(struct xe_gt *gt)
4949
{
50+
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
5051
INIT_WORK(&gt->sriov.pf.workers.restart, pf_worker_restart_func);
5152
}
5253

54+
static void pf_fini_workers(struct xe_gt *gt)
55+
{
56+
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
57+
disable_work_sync(&gt->sriov.pf.workers.restart);
58+
}
59+
5360
/**
5461
* xe_gt_sriov_pf_init_early - Prepare SR-IOV PF data structures on PF.
5562
* @gt: the &xe_gt to initialize
@@ -79,6 +86,21 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
7986
return 0;
8087
}
8188

89+
static void pf_fini_action(void *arg)
90+
{
91+
struct xe_gt *gt = arg;
92+
93+
pf_fini_workers(gt);
94+
}
95+
96+
static int pf_init_late(struct xe_gt *gt)
97+
{
98+
struct xe_device *xe = gt_to_xe(gt);
99+
100+
xe_gt_assert(gt, IS_SRIOV_PF(xe));
101+
return devm_add_action_or_reset(xe->drm.dev, pf_fini_action, gt);
102+
}
103+
82104
/**
83105
* xe_gt_sriov_pf_init - Prepare SR-IOV PF data structures on PF.
84106
* @gt: the &xe_gt to initialize
@@ -95,7 +117,15 @@ int xe_gt_sriov_pf_init(struct xe_gt *gt)
95117
if (err)
96118
return err;
97119

98-
return xe_gt_sriov_pf_migration_init(gt);
120+
err = xe_gt_sriov_pf_migration_init(gt);
121+
if (err)
122+
return err;
123+
124+
err = pf_init_late(gt);
125+
if (err)
126+
return err;
127+
128+
return 0;
99129
}
100130

101131
static bool pf_needs_enable_ggtt_guest_update(struct xe_device *xe)

0 commit comments

Comments
 (0)