On Sun, Oct 12, 2025 at 12:08:34PM -0700, Matthew Brost wrote:
> On Sat, Oct 11, 2025 at 09:38:25PM +0200, Michał Winiarski wrote:
> > 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 <[email protected]>
> > ---
> >  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;
> 
> By the end of series this function looks like:
> 
>  14 static struct mutex *pf_migration_mutex(struct xe_device *xe, unsigned 
> int vfid)
>  15 {
>  16         xe_assert(xe, IS_SRIOV_PF(xe));
>  17         xe_assert(xe, vfid <= xe_sriov_pf_get_totalvfs(xe));
>  18         return &xe->sriov.pf.vfs[vfid].migration.lock;
>  19 }
> 
> And...
> 
> grep snapshot_lock *.c *.h
> xe_gt_sriov_pf_migration.c:     err = drmm_mutex_init(&xe->drm, 
> &gt->sriov.pf.snapshot_lock);
> xe_gt_sriov_pf_types.h: struct mutex snapshot_lock;
> 
> So 'snapshot_lock' isn't used at the end of the series. Maybe drop this
> patch, delete the snapshot_lock in the patch which restructures the
> above code / remove the snapshot_lock usage.
> 
> Matt 

It should actually be removed later in the series, but looks like it got
left over by mistake.

I'll squash it with:
drm/xe/pf: Switch VF migration GuC save/restore to struct migration data

Thanks,
-Michał

> 
> >  }
> >  
> >  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
> > 

Reply via email to