From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35CDD38E8A7 for ; Wed, 29 Jul 2026 17:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785346091; cv=none; b=A0eFiVNTavs3DEBnNfTJHe0IgXYYKowPR574NFqg3nttY6TwJcTJOghWXnFxR/Zybu4lN/a0ozNyq1ic47l6ufOa6kr1OG3BzEJ6tR5Og+7nz1K5kUTylZZWjw5PizH/0vxetvnEgJxuauwEXKYx6iYvxaUxHLWT/mUlHBcnDrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785346091; c=relaxed/simple; bh=Q+lDfevC0LkB+caxK2Kwy70m+DokXlTJROyqFCPznew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k958vRnmFpLkxOZFeqaWWk0qEvbkNb1fOS5g7RlveNsxkvD7rq9d57Hq5QR/P2uaEvmpUT326JWTgwWFdbXgyhrvDdUYJGa7opBFbPe8z7+3QJO0Fc4odB3+pacmP7ju2bvpr0kFut1PtGe440wuFS9I5VLsQPWLjFyR5O11m5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AOH+O/N7; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AOH+O/N7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785346089; x=1816882089; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q+lDfevC0LkB+caxK2Kwy70m+DokXlTJROyqFCPznew=; b=AOH+O/N77oiWRK4PSIKqoRdGDTCxvzUM3l5LcGxMF/1xVjkAYJE3/via aE8+RoDcskicD1/3qnXItCJRv1LNTrFd6lmZrSKwlPOu5bIM082TZWEIC O4cOrAzXXbT4E7zMdvmdK3RKHBxiLUSNTV9kRv4nbvWSiBAfiAY8i9/YH 0D1uJpRrZl7lUXCSo7o1m2gynCAxc2gKcSS84QAFxIBZSJkcQ4DOA0AhR 0dL0UhLQXWhQTCLKTTSV0V56YtbDrugJLLPCsk0kZvJ1ln6lNQDIHo76W x7mzussdUEqpcCtCrEf2ReBXiPETIkvWlGKNloy8IfyoU8fnouXleq8lu g==; X-CSE-ConnectionGUID: hsOIIGn8SkKT5CWDZZcdUg== X-CSE-MsgGUID: r8jVRzBySfS4/5ZngHutgw== X-IronPort-AV: E=McAfee;i="6800,10657,11859"; a="97473636" X-IronPort-AV: E=Sophos;i="6.25,192,1779174000"; d="scan'208";a="97473636" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2026 10:28:02 -0700 X-CSE-ConnectionGUID: /z+nCRIgTvqpZoFxz7yp9Q== X-CSE-MsgGUID: PKLczt36QdGTgiCnPfI5UA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,192,1779174000"; d="scan'208";a="262024591" Received: from iherna2-mobl4.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.223.238]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2026 10:28:02 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v10 09/17] x86/resctrl: Add PMT registration API for AET enumeration callbacks Date: Wed, 29 Jul 2026 10:27:44 -0700 Message-ID: <20260729172752.11561-10-tony.luck@intel.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260729172752.11561-1-tony.luck@intel.com> References: <20260729172752.11561-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit resctrl is always built-in; INTEL_PMT_TELEMETRY may be a module. Add, and export, register/unregister functions so the PMT module can supply/clear enumeration callback functions when loaded/unloaded. Suggested-by: Christoph Hellwig Signed-off-by: Tony Luck --- v10: Move declaration and stubs for registration functions out of and into Defer adding aet_register_lock mutex until mount/unmount changes where it is needed. include/linux/intel_vsec.h | 12 ++++++++++++ arch/x86/kernel/cpu/resctrl/intel_aet.c | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/linux/intel_vsec.h b/include/linux/intel_vsec.h index 843cda8f8644..c04b1d0f3143 100644 --- a/include/linux/intel_vsec.h +++ b/include/linux/intel_vsec.h @@ -257,4 +257,16 @@ static inline void intel_pmt_put_feature_group(struct pmt_feature_group *feature_group) {} #endif +#ifdef CONFIG_X86_CPU_RESCTRL_INTEL_AET +void intel_aet_register_enumeration(struct module *module, + struct pmt_feature_group *(*get)(enum pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)); +void intel_aet_unregister_enumeration(void); +#else +static inline void intel_aet_register_enumeration(struct module *module, + struct pmt_feature_group *(*get)(enum pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)) { } +static inline void intel_aet_unregister_enumeration(void) { } +#endif /* CONFIG_X86_CPU_RESCTRL_INTEL_AET */ + #endif diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/resctrl/intel_aet.c index e6cc57206381..407c9aba5eea 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -17,12 +17,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -291,6 +293,10 @@ static enum pmt_feature_id lookup_pfid(const char *pfname) return FEATURE_INVALID; } +static struct module *pmt_module; +static struct pmt_feature_group *(*get_feature)(enum pmt_feature_id id); +static void (*put_feature)(struct pmt_feature_group *p); + /* * Request a copy of struct pmt_feature_group for each event group. If there is * one, the returned structure has an array of telemetry_region structures, @@ -334,6 +340,24 @@ void __init intel_aet_init(void) (*peg)->num_rmid = min(max_rmid, (*peg)->num_rmid); } +void intel_aet_register_enumeration(struct module *module, + struct pmt_feature_group *(*get)(enum pmt_feature_id id), + void (*put)(struct pmt_feature_group *p)) +{ + get_feature = get; + put_feature = put; + pmt_module = module; +} +EXPORT_SYMBOL_NS_GPL(intel_aet_register_enumeration, "INTEL_PMT"); + +void intel_aet_unregister_enumeration(void) +{ + pmt_module = NULL; + get_feature = NULL; + put_feature = NULL; +} +EXPORT_SYMBOL_NS_GPL(intel_aet_unregister_enumeration, "INTEL_PMT"); + void __exit intel_aet_exit(void) { struct event_group **peg; -- 2.55.0