[Intel-gfx] [PATCH 3/9] drm/i915/pcode: Extend pcode functions for multiple gt's

Dixit, Ashutosh ashutosh.dixit at intel.com
Fri Apr 29 14:46:05 UTC 2022


On Fri, 29 Apr 2022 05:58:21 -0700, Rodrigo Vivi wrote:
>
> > @@ -1251,7 +1251,7 @@ static int i915_drm_resume(struct drm_device *dev)
> >
> >	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
> >
> > -	ret = intel_pcode_init(dev_priv);
> > +	ret = intel_gt_pcode_init(dev_priv);
>
> I didn't like we have this indirection i915 -> gt -> i915...
> At the same time I understand you don't want to duplicate the for_each with
> the error msg and all in here.
>
> So, what about having in this file a
> static int __init_pcode(dev_priv)
> ?!

Sure, will fix.

> > diff --git a/drivers/gpu/drm/i915/intel_pcode.c b/drivers/gpu/drm/i915/intel_pcode.c
> > index ac727546868e..66020b2e461f 100644
> > --- a/drivers/gpu/drm/i915/intel_pcode.c
> > +++ b/drivers/gpu/drm/i915/intel_pcode.c
> > @@ -52,14 +52,12 @@ static int gen7_check_mailbox_status(u32 mbox)
> >	}
> >  }
> >
> > -static int __snb_pcode_rw(struct drm_i915_private *i915, u32 mbox,
> > +static int intel_pcode_rw(struct intel_uncore *uncore, u32 mbox,
>
> I'm not sure if I like the idea of the renaming here...
> I mean, it looks nicer indeed, but at the same time the "intel_"
> make it looks it is exported one.

Sure, will fix.

> > --- a/drivers/gpu/drm/i915/intel_pcode.h
> > +++ b/drivers/gpu/drm/i915/intel_pcode.h
> > @@ -8,17 +8,32 @@
> >
> >  #include <linux/types.h>
> >
> > +struct intel_uncore;
> >  struct drm_i915_private;
> >
> > -int snb_pcode_read(struct drm_i915_private *i915, u32 mbox, u32 *val, u32 *val1);
> > -int snb_pcode_write_timeout(struct drm_i915_private *i915, u32 mbox, u32 val,
> > -			    int fast_timeout_us, int slow_timeout_ms);
> > -#define snb_pcode_write(i915, mbox, val)			\
> > +int intel_pcode_read(struct intel_uncore *uncore, u32 mbox, u32 *val, u32 *val1);
> > +
> > +int intel_pcode_write_timeout(struct intel_uncore *uncore, u32 mbox, u32 val,
> > +			      int fast_timeout_us, int slow_timeout_ms);
> > +
> > +#define intel_pcode_write(uncore, mbox, val) \
> > +	intel_pcode_write_timeout(uncore, mbox, val, 500, 0)
> > +
> > +int intel_pcode_request(struct intel_uncore *uncore, u32 mbox, u32 request,
> > +			u32 reply_mask, u32 reply, int timeout_base_ms);
> > +
> > +#define snb_pcode_read(i915, mbox, val, val1) \
> > +	intel_pcode_read(&(i915)->uncore, mbox, val, val1)
> > +
> > +#define snb_pcode_write_timeout(i915, mbox, val, fast_timeout_us, slow_timeout_ms) \
> > +	intel_pcode_write_timeout(&(i915)->uncore, mbox, val, fast_timeout_us, slow_timeout_ms)
> > +
> > +#define snb_pcode_write(i915, mbox, val) \
> >	snb_pcode_write_timeout(i915, mbox, val, 500, 0)
> >
> > -int skl_pcode_request(struct drm_i915_private *i915, u32 mbox, u32 request,
> > -		      u32 reply_mask, u32 reply, int timeout_base_ms);
> > +#define skl_pcode_request(i915, mbox, request, reply_mask, reply, timeout_base_ms) \
> > +	intel_pcode_request(&(i915)->uncore, mbox, request, reply_mask, reply, timeout_base_ms)
>
> and for the exported one, since we are renaming it, shouldn't we rename
> all the users instead of creating these defines?

Ok, in that case we might as well retain the original function names
(snb_/skl_ etc. and just change the first argument to uncore)? So will do
that in the next rev unless we think we want to rename everything to
intel_?

Thanks.
--
Ashutosh


More information about the Intel-gfx mailing list