Re: [PATCH v11 20/23] platform/x86/intel/pmt: Inform resctrl when MMIO maps are being removed

From: Ilpo Järvinen

Date: Tue Sep 01 2026 - 07:09:35 EST


On Mon, 31 Aug 2026, Tony Luck wrote:

> 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>
> ---
> v11:
> Unbind/remove operations can't cross package boundaries.
> Psss package_id instead of bitmap of package IDs.
> Use dev_warn() to report failure to find package_id.
>
> drivers/platform/x86/intel/pmt/telemetry.c | 32 ++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
> index 2d2282c636b2..92871ce51c57 100644
> --- a/drivers/platform/x86/intel/pmt/telemetry.c
> +++ b/drivers/platform/x86/intel/pmt/telemetry.c
> @@ -366,11 +366,43 @@ 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)
> +{
> + u32 ret = -1;
> + int i;
> +
> + mutex_lock(&ep_lock);
> + 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)) {
> + ret = plat_info->package_id;

Use guard() and a direct return, no need to complicate code flow anymore
just for handling unlocking.

> + break;
> + }
> + }
> + mutex_unlock(&ep_lock);
> +
> + return ret;
> +}

> +
> static void pmt_telem_remove(struct auxiliary_device *auxdev)
> {
> struct pmt_telem_priv *priv = auxiliary_get_drvdata(auxdev);
> + int package_id = pmt_telem_get_package_id(priv);
> int i;
>
> + /*
> + * Tell resctrl/AET that virtual mappings for MMIO space in a CPU
> + * packages are about to be torn down.
> + */
> + if (package_id != -1)
> + intel_aet_invalidate(package_id);
> + else
> + dev_warn(&auxdev->dev, "Unable to determine package ID for removed device\n");

Why to print this? To me it looks like dev_dbg() material at most, if even
that.

> +
> mutex_lock(&ep_lock);
> for (i = 0; i < priv->num_entries; i++) {
> struct intel_pmt_entry *entry = &priv->entry[i];
>

--
i.