[PATCH v13 22/25] platform/x86/intel/pmt: Inform resctrl when MMIO maps are being removed
From: Tony Luck
Date: Mon Sep 28 2026 - 18:17:54 EST
When a telemetry device is unbound from its driver or deleted the
pmt_telemetry driver invalidates all the MMIO mappings for that
device. When resctrl reads a telemetry event it faults on the access
to the event counter.
Before destroying devices, tell resctrl that the virtual addresses
supplied by an earlier call to intel_pmt_get_regions_by_feature()
are about to be invalidated and should not be used again.
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
v13:
Context paragraph added describing the problem.
New aet_mmio_lock moved to previous patch to avoid
churn here changing lines that were just changed there.
Add a comment in code that all entries for a removed device
are on the same package.
---
drivers/platform/x86/intel/pmt/telemetry.c | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
index 57eb2967a4d0..bd63653802d9 100644
--- a/drivers/platform/x86/intel/pmt/telemetry.c
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
@@ -366,12 +366,42 @@ pmt_telem_find_and_register_endpoint(struct device *dev, u32 guid, u16 pos)
}
EXPORT_SYMBOL_NS_GPL(pmt_telem_find_and_register_endpoint, "INTEL_PMT_TELEMETRY");
+static int pmt_telem_get_package_id(struct pmt_telem_priv *priv)
+{
+ int i;
+
+ for (i = 0; i < priv->num_entries; i++) {
+ struct intel_pmt_entry *entry = &priv->entry[i];
+ struct pci_dev *pdev = to_pci_dev(entry->ep->dev);
+ struct oobmsm_plat_info *plat_info;
+
+ plat_info = intel_vsec_get_mapping(pdev);
+ if (!IS_ERR(plat_info)) {
+ /* All entries for a device have the same package ID */
+ return plat_info->package_id;
+ }
+ }
+
+ return -ENODEV;
+}
+
static void pmt_telem_remove(struct auxiliary_device *auxdev)
{
struct pmt_telem_priv *priv = auxiliary_get_drvdata(auxdev);
+ int package_id;
int i;
mutex_lock(&ep_lock);
+ package_id = pmt_telem_get_package_id(priv);
+ /*
+ * Tell resctrl/AET that virtual mappings for MMIO space in a CPU
+ * package are about to be torn down.
+ */
+ if (package_id < 0)
+ dev_dbg(&auxdev->dev, "Unable to determine package ID for removed device\n");
+ else
+ intel_aet_invalidate(package_id);
+
for (i = 0; i < priv->num_entries; i++) {
struct intel_pmt_entry *entry = &priv->entry[i];
--
2.55.0