[PATCH v8 12/16] platform/x86/intel/pmt: Register enumeration functions with resctrl

From: Tony Luck

Date: Mon Jun 15 2026 - 14:26:27 EST


INTEL_PMT_TELEMETRY is a loadable module, but resctrl is built-in and cannot
call PMT functions directly. Register the telemetry enumeration function
pointers at pmt_telemetry module .probe(), and unregister them at module
.remove().

Note that checkpatch complains about the #include of <asm/resctrl.h>.
This is needed rather than <linux/resctrl.h> to get the function stub
definitions when CONFIG_X86_CPU_RESCTRL=n.

Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
v8:
Move register/unregister calls to .probe()/.remove()

drivers/platform/x86/intel/pmt/telemetry.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
index daa6da9bad2a..fa4033f94d2f 100644
--- a/drivers/platform/x86/intel/pmt/telemetry.c
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
@@ -25,6 +25,8 @@
#include <linux/uaccess.h>
#include <linux/xarray.h>

+#include <asm/resctrl.h>
+
#include "class.h"

#define TELEM_SIZE_OFFSET 0x0
@@ -365,6 +367,8 @@ static void pmt_telem_remove(struct auxiliary_device *auxdev)
struct pmt_telem_priv *priv = auxiliary_get_drvdata(auxdev);
int i;

+ intel_aet_unregister_enumeration();
+
mutex_lock(&ep_lock);
for (i = 0; i < priv->num_entries; i++) {
struct intel_pmt_entry *entry = &priv->entry[i];
@@ -405,6 +409,8 @@ static int pmt_telem_probe(struct auxiliary_device *auxdev, const struct auxilia
intel_pmt_get_features(entry);
}

+ intel_aet_register_enumeration(THIS_MODULE, intel_pmt_get_regions_by_feature,
+ intel_pmt_put_feature_group);
return 0;
abort_probe:
pmt_telem_remove(auxdev);
--
2.54.0