[PATCH V3 01/16] platform/x86/intel/pmt: Add pre/post decode hooks around header parsing

David E. Box
2026-05-01T23:11:01Z

Add optional pre- and post-decode callbacks to the PMT class so namespaces
can perform setup and cleanup steps around header parsing.

- Add pmt_pre_decode() and pmt_post_decode() to struct
intel_pmt_namespace.
- Update intel_pmt_dev_create() to invoke, in order:
pre → header_decode() → post.
- Keep the existing pmt_header_decode() callback unchanged.

No functional changes. This adds flexibility for upcoming decoders while
preserving current behavior.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
V3 - No changes

V2 - No changes

drivers/platform/x86/intel/pmt/class.c | 12 ++++++++++++
drivers/platform/x86/intel/pmt/class.h | 4 ++++
2 files changed, 16 insertions(+)

diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
index b4c9964df807..9b315334a69b 100644
--- a/drivers/platform/x86/intel/pmt/class.c
+++ b/drivers/platform/x86/intel/pmt/class.c
@@ -381,10 +381,22 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
if (IS_ERR(entry->disc_table))
return PTR_ERR(entry->disc_table);

+ if (ns->pmt_pre_decode) {
+ ret = ns->pmt_pre_decode(intel_vsec_dev, entry);
+ if (ret)
+ return ret;
+ }
+
ret = ns->pmt_header_decode(entry, dev);
if (ret)
return ret;

+ if (ns->pmt_post_decode) {
+ ret = ns->pmt_post_decode(intel_vsec_dev, entry);
+ if (ret)
+ return ret;
+ }
+
ret = intel_pmt_populate_entry(entry, intel_vsec_dev, disc_res);
if (ret)
return ret;
diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h
index 1ae56a5baad2..ff39014b208c 100644
--- a/drivers/platform/x86/intel/pmt/class.h
+++ b/drivers/platform/x86/intel/pmt/class.h
@@ -62,6 +62,10 @@ struct intel_pmt_namespace {
struct xarray *xa;
int (*pmt_header_decode)(struct intel_pmt_entry *entry,
struct device *dev);
+ int (*pmt_pre_decode)(struct intel_vsec_device *ivdev,
+ struct intel_pmt_entry *entry);
+ int (*pmt_post_decode)(struct intel_vsec_device *ivdev,
+ struct intel_pmt_entry *entry);
int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev,
struct intel_pmt_entry *entry);
};
--
2.43.0