]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
platform/x86/intel/pmt: Cache the telemetry discovery header
authorDavid E. Box <david.e.box@linux.intel.com>
Fri, 12 Jun 2026 21:01:46 +0000 (14:01 -0700)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Sun, 14 Jun 2026 23:12:59 +0000 (02:12 +0300)
commit4dfc7dca6e934ca414d8d3c70a84e79d13d9e750
tree84f3f4933536f67b9be67d0b191a60577b728ebb
parent4a87492cd137d158779923a034d7e742f7358952
platform/x86/intel/pmt: Cache the telemetry discovery header

pmt_telem_header_decode() only needs the discovery header dwords, but it
currently decodes them by reading directly from entry->disc_table.

Cache the discovery header in intel_pmt_entry when the device is created
and have telemetry decode use the cached values instead of performing MMIO
reads at decode time.

The DVSEC discovery resource for a namespace is sized by its per-entry
entry_size (in dwords), which can be less than the 4-dword cache (e.g.
telemetry uses entry_size = 3, i.e. 12 bytes). Cap the memcpy_fromio()
to resource_size(disc_res) so the new cache does not read past the
mapped region. Any unread dwords stay zero from the zero-initialized
allocation of the containing struct.

This keeps the telemetry header decode path independent of how the
discovery data is backed and avoids baking a direct MMIO assumption into
the feature-specific decode logic.

Assisted-by: GitHub-Copilot:claude-opus-4.7
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://patch.msgid.link/f805e2ada52dc0661761cda7f692e76e6ea2d257.1781294741.git.david.e.box@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/pmt/class.c
drivers/platform/x86/intel/pmt/class.h
drivers/platform/x86/intel/pmt/telemetry.c