> -----Original Message----- > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Sent: Wednesday, November 13, 2024 5:26 AM > To: Ruhl, Michael J <michael.j.ruhl@xxxxxxxxx> > Cc: intel-xe@xxxxxxxxxxxxxxxxxxxxx; platform-driver-x86@xxxxxxxxxxxxxxx; > david.e.box@xxxxxxxxxxxxxxx; ilpo.jarvinen@xxxxxxxxxxxxxxx; > hdegoede@xxxxxxxxxx; Vivi, Rodrigo <rodrigo.vivi@xxxxxxxxx>; De Marchi, > Lucas <lucas.demarchi@xxxxxxxxx> > 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 >