[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <gtnomrunyh72n55y4wg7blgqeuyx5h6y5ddeq7uvbdovnyy67l@fapstjgnvdkn>
Date: Fri, 31 Oct 2025 08:50:42 +0100
From: Michał Winiarski <michal.winiarski@...el.com>
To: Michal Wajdeczko <michal.wajdeczko@...el.com>
CC: Alex Williamson <alex@...zbot.org>, Lucas De Marchi
<lucas.demarchi@...el.com>, Thomas Hellström
<thomas.hellstrom@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
Jason Gunthorpe <jgg@...pe.ca>, Yishai Hadas <yishaih@...dia.com>, Kevin Tian
<kevin.tian@...el.com>, Shameer Kolothum <skolothumtho@...dia.com>,
<intel-xe@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<kvm@...r.kernel.org>, Matthew Brost <matthew.brost@...el.com>,
<dri-devel@...ts.freedesktop.org>, Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, Tvrtko Ursulin
<tursulin@...ulin.net>, David Airlie <airlied@...il.com>, Simona Vetter
<simona@...ll.ch>, Lukasz Laguna <lukasz.laguna@...el.com>, Christoph Hellwig
<hch@...radead.org>, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v3 03/28] drm/xe/pf: Convert control state to bitmap
On Thu, Oct 30, 2025 at 11:57:28PM +0100, Michal Wajdeczko wrote:
>
>
> On 10/30/2025 9:31 PM, Michał Winiarski wrote:
> > 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@...el.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202510231918.XlOqymLC-lkp@intel.com/
> > Signed-off-by: Michał Winiarski <michal.winiarski@...el.com>
> > ---
> > drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c | 2 +-
> > drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h | 5 +++--
> > 2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > index 9de05db1f0905..8a2577fda4198 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
> > @@ -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,
> > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > index c80b7e77f1ad2..3ba6ad886c939 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_control_types.h
> > @@ -73,7 +73,8 @@ 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,
> > + XE_GT_SRIOV_STATE_MAX,
>
> while this feels handy, this MAX enumerator is not a real state
> and as such shouldn't be passed to any function that expects
> "enum"
>
> since we know (and want) to keep MISMATCH state as last one
> (aka top bit) then maybe tag it and use separate define:
>
> - 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)
Sure, sounds good.
Thanks,
-Michał
>
> > };
> >
> > /**
> > @@ -83,7 +84,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_STATE_MAX);
> >
> > /** @done: completion of async operations */
> > struct completion done;
>
Powered by blists - more mailing lists