Re: [PATCH v1 1/2] platform/x86/intel: Introduce Intel Elkhart Lake PSE I/O

Raag Jadav
2025-10-31T11:59:29Z

On Fri, Oct 31, 2025 at 12:02:14PM +0200, Andy Shevchenko wrote:
> On Fri, Oct 31, 2025 at 10:34:28AM +0100, Raag Jadav wrote:
> > On Wed, Oct 29, 2025 at 10:36:19AM +0200, Andy Shevchenko wrote:
> > > On Wed, Oct 29, 2025 at 11:50:49AM +0530, Raag Jadav wrote:
>
> ...
>
> > > > +#define EHL_PSE_IO_DEV_OFFSET SZ_4K
> > > > +#define EHL_PSE_IO_DEV_SIZE SZ_4K
> > >
> > > Not sure if SZ_4K is a good idea for the _OFFSET, the _SIZE is fine. Also why
> > > do we need two? If the devices are of the same size, we don't need to have a
> > > separate offset.
> >
> > Yes but they're semantically different, atleast as per DEFINE_RES_MEM().
> > Either way works for me.
>
> They are "slices" in the HW, see also my "if the devices..." passage.
>
> If you want to use SZ_* in _OFFSET, I would write it as (1 * SZ_4K) to point
> out that size constant here is the _unit_ and not the size semantically.
> Currently the definitions have the same values semantically, but you pointed
> out that they should not be.

Fair. Will consolidate.

> > > > + io_dev = kzalloc(sizeof(*io_dev), GFP_KERNEL);
> > > > + if (!io_dev)
> > > > + return -ENOMEM;
> > >
> > > Why devm_kzalloc() can't be used? I don't see if the device lifetime is anyhow
> > > different to this object. Am I wrong?
> >
> > Looks like it but I don't know the code well enough to tell if there're
> > corner cases, so just following the documented rules. Your call.
>
> Do you expect this to be called in non-probe() contexts? If no --> devm.
> Otherwise some comments are needed.

Sure.

> > > > + ret = __auxiliary_device_add(aux_dev, dev->driver->name);
> > >
> > > Hmm... Is it okay to use double underscored variant? Only a single driver uses
> > > this so far... Care to elaborate?
> >
> > The regular variant uses KBUILD_MODNAME which comes with 'intel' prefix
> > after commit df7f9acd8646, and with that we overshoot the max id string
> > length for leaf drivers.
>
> At bare minimum this needs a comment, but I think ideally we need to bump the
> limit by factor of 2.

Which will probably require a wider discussion, so perhaps let's pursue it
separately?

Raag