[PATCH v9 01/12] platform/x86/intel/{pmt,vsec}: Prevent unbind via sysfs

From: Tony Luck

Date: Wed Jul 01 2026 - 17:36:20 EST


The resctrl AET code uses intel_pmt_get_regions_by_feature() (exported by the
pmt_telemetry module) to obtain pmt_feature_group instances that are populated
using data from the pmt_discovery module. The returned telemetry_region::addr
values are MMIO mappings created in the telemetry driver's probe path,
and resctrl reads from them while a mount is active.

However, a user can unbind the intel_pmt driver or its parent intel_vsec
from their devices via sysfs "unbind" attributes. Unbinding either of these
drivers would tear down the MMIO mappings, leaving resctrl with stale pointers
and causing a fault on the next access.

It is safe for the discovery driver to be unbound. It does all its work at
initial probe time and saves a copy of the features and RMID count.

Set device_driver::suppress_bind_attrs in each driver so that the "bind"
and "unbind" sysfs attributes are not exposed and the user cannot detach
the driver from its devices while resctrl (or any other in-kernel consumer)
may be using the resources.

Fixes: 1fb2daa60de6 ("x86/resctrl: Discover hardware telemetry events")
Assisted-by: Claude:Opus-4.7
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
--
v9:
Set .suppress_bind_attrs for intel_vsec as well as intel_telemetry
---
drivers/platform/x86/intel/pmt/telemetry.c | 3 +++
drivers/platform/x86/intel/vsec.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
index 953f35b6daec..f243ccf3185b 100644
--- a/drivers/platform/x86/intel/pmt/telemetry.c
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
@@ -427,6 +427,9 @@ static struct auxiliary_driver pmt_telem_aux_driver = {
.id_table = pmt_telem_id_table,
.remove = pmt_telem_remove,
.probe = pmt_telem_probe,
+ .driver = {
+ .suppress_bind_attrs = true,
+ },
};

static int __init pmt_telem_init(void)
diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c
index 3ae4557b32b4..50e9e122866c 100644
--- a/drivers/platform/x86/intel/vsec.c
+++ b/drivers/platform/x86/intel/vsec.c
@@ -893,6 +893,9 @@ static struct pci_driver intel_vsec_pci_driver = {
.id_table = intel_vsec_pci_ids,
.probe = intel_vsec_pci_probe,
.err_handler = &intel_vsec_pci_err_handlers,
+ .driver = {
+ .suppress_bind_attrs = true,
+ },
};
module_pci_driver(intel_vsec_pci_driver);

--
2.54.0