]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/pf: Convert control state to bitmap
authorMichał Winiarski <michal.winiarski@intel.com>
Wed, 12 Nov 2025 13:21:59 +0000 (14:21 +0100)
committerMichał Winiarski <michal.winiarski@intel.com>
Thu, 13 Nov 2025 10:48:18 +0000 (11:48 +0100)
In upcoming changes, the number of states will increase as a result of
introducing SAVE and RESTORE states.
This means that using unsigned long as underlying storage won't work on
32-bit architectures, as we'll run out of bits.
Use bitmap instead.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510231918.XlOqymLC-lkp@intel.com/
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20251112132220.516975-4-michal.winiarski@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h

index 9de05db1f0905a46c2ecb1caf052f3dd3f87483c..8a2577fda419826df59a227678aa1b7f0eba6de1 100644 (file)
@@ -225,7 +225,7 @@ static unsigned long *pf_peek_vf_state(struct xe_gt *gt, unsigned int vfid)
 {
        struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, vfid);
 
-       return &cs->state;
+       return cs->state;
 }
 
 static bool pf_check_vf_state(struct xe_gt *gt, unsigned int vfid,
index c80b7e77f1ad277160e5536c223b7d9695aba0e4..d9282eb259727b32cfcf490e669eacf3d29625ac 100644 (file)
@@ -73,9 +73,11 @@ enum xe_gt_sriov_control_bits {
        XE_GT_SRIOV_STATE_STOP_FAILED,
        XE_GT_SRIOV_STATE_STOPPED,
 
-       XE_GT_SRIOV_STATE_MISMATCH = BITS_PER_LONG - 1,
+       XE_GT_SRIOV_STATE_MISMATCH, /* always keep as last */
 };
 
+#define XE_GT_SRIOV_NUM_STATES (XE_GT_SRIOV_STATE_MISMATCH + 1)
+
 /**
  * struct xe_gt_sriov_control_state - GT-level per-VF control state.
  *
@@ -83,7 +85,7 @@ enum xe_gt_sriov_control_bits {
  */
 struct xe_gt_sriov_control_state {
        /** @state: VF state bits */
-       unsigned long state;
+       DECLARE_BITMAP(state, XE_GT_SRIOV_NUM_STATES);
 
        /** @done: completion of async operations */
        struct completion done;