On Fri, Nov 06, 2026 at 04:52:22PM +0200, Jani Nikula wrote:
> On Thu, 05 Nov 2026, Ville Syrjala <[email protected]> wrote:
> > From: Ville Syrjälä <[email protected]>
> >
> > In order to eliminate runtime platform check overhead from
> > the mmio read/write functions, we'll need a good way to construct
> > optimal variants for each platform. Do that in the form of
> > __intel_de_{read,write}() that can be customized via (compile time
> > constnt) mmio_flags. The compiler will eliminate all the stuff
> > we don't want.
> 
> Are the __always_inline required?

Perhaps not in practice, don't think I actually checked the
generated code without them. I put them there because I really
want to force the compiler to notice that mmio_flags is a
compile time constant and thus there is dead code to eliminate. 
Dunno if I want to rely on compiler inlining heuristics for that.

> 
> Reviewed-by: Jani Nikula <[email protected]>
> 
> >
> > For now there is nothing to eliminate but next we'll start
> > moving more stuff in to make that possible.
> >
> > Signed-off-by: Ville Syrjälä <[email protected]>
> > ---
> >  drivers/gpu/drm/i915/display/intel_de.c | 26 +++++++++++++++++++++++--
> >  1 file changed, 24 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_de.c 
> > b/drivers/gpu/drm/i915/display/intel_de.c
> > index 4f423a684ec2..cde2886fe2ca 100644
> > --- a/drivers/gpu/drm/i915/display/intel_de.c
> > +++ b/drivers/gpu/drm/i915/display/intel_de.c
> > @@ -163,16 +163,38 @@ u16 intel_de_read16(struct intel_display *display, 
> > intel_reg_t reg)
> >     return intel_uncore_read16(__to_uncore(display), reg);
> >  }
> >  
> > +static __always_inline u32
> > +__intel_de_read(struct intel_display *display, intel_reg_t reg,
> > +           const unsigned int mmio_flags)
> > +{
> > +   u32 val;
> > +
> > +   val = intel_uncore_read(__to_uncore(display), reg);
> > +
> > +   return val;
> > +}
> > +
> > +static __always_inline void
> > +__intel_de_write(struct intel_display *display, intel_reg_t reg, u32 val,
> > +            const unsigned int mmio_flags)
> > +{
> > +   intel_uncore_write(__to_uncore(display), reg, val);
> > +}
> > +
> > +#define I9XX_MMIO_FLAGS 0
> > +
> >  static u32 i9xx_mmio_read(struct intel_display *display, intel_reg_t reg)
> >  {
> > -   return intel_uncore_read(__to_uncore(display), reg);
> > +   return __intel_de_read(display, reg, I9XX_MMIO_FLAGS);
> >  }
> >  
> >  static void i9xx_mmio_write(struct intel_display *display, intel_reg_t 
> > reg, u32 val)
> >  {
> > -   intel_uncore_write(__to_uncore(display), reg, val);
> > +   __intel_de_write(display, reg, val, I9XX_MMIO_FLAGS);
> >  }
> >  
> > +#undef I9XX_MMIO_FLAGS
> > +
> >  static const struct intel_mmio_funcs i9xx_mmio_funcs = {
> >     .read = i9xx_mmio_read,
> >     .write = i9xx_mmio_write,
> 
> -- 
> Jani Nikula, Intel

-- 
Ville Syrjälä
Intel

Reply via email to