[PATCH v2 1/2] platform/x86/intel/pmt: allow user offset for PMT callbacks

Ruhl, Michael J michael.j.ruhl at intel.com
Wed Nov 13 21:57:17 UTC 2024


> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> Sent: Wednesday, November 13, 2024 5:26 AM
> To: Ruhl, Michael J <michael.j.ruhl at intel.com>
> Cc: intel-xe at lists.freedesktop.org; platform-driver-x86 at vger.kernel.org;
> david.e.box at linux.intel.com; ilpo.jarvinen at linux.intel.com;
> hdegoede at redhat.com; Vivi, Rodrigo <rodrigo.vivi at intel.com>; De Marchi,
> Lucas <lucas.demarchi at intel.com>
> Subject: Re: [PATCH v2 1/2] platform/x86/intel/pmt: allow user offset for PMT
> callbacks
> 
> On Tue, Nov 12, 2024 at 11:30:34AM -0500, Michael J. Ruhl wrote:
> > Usage of the telem sysfs file allows for partial reads at an offset.
> >
> > The current callback method returns the buffer starting from offset 0
> > only.
> >
> > Include the requested offset in the callback.
> > Update the necessary address calculations with the offset.
> >
> > Note: offset addition is moved from the caller to the local usage.
> > For non-callback usage this unchanged behavior.
> 
> ...
> 
> >  int pmt_telem_read_mmio(struct pci_dev *pdev, struct pmt_callbacks *cb,
> u32 guid, void *buf,
> > -			void __iomem *addr, u32 count)
> > +			void __iomem *addr, loff_t off, u32 count)
> >  {
> >  	if (cb && cb->read_telem)
> > -		return cb->read_telem(pdev, guid, buf, count);
> > +		return cb->read_telem(pdev, guid, buf, off, count);
> 
> Also possible instead of the below changes is to add here
> 
> 	addr += off;

Yeah, that makes sense.   Was not happy with adding it twice.  I will update.

Thanks!

M

 
> >  	if (guid == GUID_SPR_PUNIT)
> >  		/* PUNIT on SPR only supports aligned 64-bit read */
> > -		return pmt_memcpy64_fromio(buf, addr, count);
> > +		return pmt_memcpy64_fromio(buf, addr + off, count);
> >
> > -	memcpy_fromio(buf, addr, count);
> > +	memcpy_fromio(buf, addr + off, count);
> >
> >  	return count;
> >  }
> 
> --
> With Best Regards,
> Andy Shevchenko
> 



More information about the Intel-xe mailing list