[PATCH 04/26] drm/xe/pf: Extract migration mutex out of its struct

Michał Winiarski
2025-10-11T19:40:37Z

As part of upcoming changes, the struct xe_gt_sriov_pf_migration will be
used as a per-VF data structure.
The mutex (which is currently the only member of this structure) will
have slightly different semantics.
Extract the mutex to free up the struct name and simplify the future
changes.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c | 4 ++--
drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h | 2 --
drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h | 2 +-
3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
index ca28f45aaf481..f8604b172963e 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration.c
@@ -122,7 +122,7 @@ static bool pf_migration_supported(struct xe_gt *gt)
static struct mutex *pf_migration_mutex(struct xe_gt *gt)
{
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
- return &gt->sriov.pf.migration.snapshot_lock;
+ return &gt->sriov.pf.snapshot_lock;
}

static struct xe_gt_sriov_state_snapshot *pf_pick_vf_snapshot(struct xe_gt *gt,
@@ -400,7 +400,7 @@ int xe_gt_sriov_pf_migration_init(struct xe_gt *gt)
if (!pf_migration_supported(gt))
return 0;

- err = drmm_mutex_init(&xe->drm, &gt->sriov.pf.migration.snapshot_lock);
+ err = drmm_mutex_init(&xe->drm, &gt->sriov.pf.snapshot_lock);
if (err)
return err;

diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
index 9d672feac5f04..fdc5a31dd8989 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_migration_types.h
@@ -30,8 +30,6 @@ struct xe_gt_sriov_state_snapshot {
* Used by the PF driver to maintain non-VF specific per-GT data.
*/
struct xe_gt_sriov_pf_migration {
- /** @snapshot_lock: protects all VFs snapshots */
- struct mutex snapshot_lock;
};

#endif
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
index a64a6835ad656..9a856da379d39 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_types.h
@@ -58,7 +58,7 @@ struct xe_gt_sriov_pf {
struct xe_gt_sriov_pf_service service;
struct xe_gt_sriov_pf_control control;
struct xe_gt_sriov_pf_policy policy;
- struct xe_gt_sriov_pf_migration migration;
+ struct mutex snapshot_lock;
struct xe_gt_sriov_spare_config spare;
struct xe_gt_sriov_metadata *vfs;
};
--
2.50.1