diff options
| author | Michael J. Ruhl <[email protected]> | 2024-11-14 13:03:57 +0000 |
|---|---|---|
| committer | Ilpo Järvinen <[email protected]> | 2024-11-14 13:16:50 +0000 |
| commit | 0c32840763b1579c923b4216c18bb756ca4ba473 (patch) | |
| tree | 9f3826c75eeed5320acd5a922c38054b73b2bd8f /drivers/platform/x86/intel/pmt/class.c | |
| parent | platform/x86/amd/hsmp: Change the error type (diff) | |
| download | kernel-0c32840763b1579c923b4216c18bb756ca4ba473.tar.gz kernel-0c32840763b1579c923b4216c18bb756ca4ba473.zip | |
platform/x86/intel/pmt: allow user offset for PMT callbacks
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 and 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 is unchanged behavior.
Fixes: e92affc74cd8 ("platform/x86/intel/vsec: Add PMT read callbacks")
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Michael J. Ruhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
Diffstat (limited to 'drivers/platform/x86/intel/pmt/class.c')
| -rw-r--r-- | drivers/platform/x86/intel/pmt/class.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c index 7680474c4f96..375695cc0d60 100644 --- a/drivers/platform/x86/intel/pmt/class.c +++ b/drivers/platform/x86/intel/pmt/class.c @@ -59,10 +59,12 @@ pmt_memcpy64_fromio(void *to, const u64 __iomem *from, size_t count) } 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); + + addr += off; if (guid == GUID_SPR_PUNIT) /* PUNIT on SPR only supports aligned 64-bit read */ @@ -96,7 +98,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj, count = entry->size - off; count = pmt_telem_read_mmio(entry->ep->pcidev, entry->cb, entry->header.guid, buf, - entry->base + off, count); + entry->base, off, count); return count; } |
