[RFC PATCH 24/31] x86/resctrl: Attach ACPI ERDT information to ctrl domain on CPU online

From: Chen Yu

Date: Sun Aug 02 2026 - 12:19:14 EST


After the rdt_hw_ctrl_domain has been created during CPU online, attach
the pre-parsed ACPI ERDT table information to the rdt_hw_ctrl_domain
to facilitate MBA control programming via the MARC MMIO registers.

This mirrors the approach used by the monitoring domain
(rdt_hw_l3_mon_domain::d_info) where ERDT domain information is
attached during domain creation.

Add erdt_find_domain_info() to look up the erdt_domain_info for a given
CPU by matching against the CACD-derived cpu_mask in each domain.

Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
---
arch/x86/kernel/cpu/resctrl/core.c | 1 +
arch/x86/kernel/cpu/resctrl/erdt.c | 12 ++++++++++++
arch/x86/kernel/cpu/resctrl/internal.h | 3 +++
3 files changed, 16 insertions(+)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index b2c53eab7d8f..86d78107537e 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -575,6 +575,7 @@ static void domain_add_cpu_ctrl(int cpu, struct rdt_resource *r,
d->hdr.type = RESCTRL_CTRL_DOMAIN;
d->hdr.rid = r->rid;
cpumask_set_cpu(cpu, &d->hdr.cpu_mask);
+ hw_dom->d_info = erdt_find_domain_info(cpu);

rdt_domain_reconfigure_cdp(r);

diff --git a/arch/x86/kernel/cpu/resctrl/erdt.c b/arch/x86/kernel/cpu/resctrl/erdt.c
index b61f75b63f37..38720c3b4a3d 100644
--- a/arch/x86/kernel/cpu/resctrl/erdt.c
+++ b/arch/x86/kernel/cpu/resctrl/erdt.c
@@ -261,6 +261,18 @@ int erdt_mon_read(struct rdt_domain_hdr *hdr, enum resctrl_event_id evtid, u32 r
return -EIO;
}

+struct erdt_domain_info *erdt_find_domain_info(int cpu)
+{
+ struct erdt_domain_info *d;
+
+ list_for_each_entry(d, &domain_info_list, entry) {
+ if (cpumask_test_cpu(cpu, &d->cpu_mask))
+ return d;
+ }
+
+ return NULL;
+}
+
static void marc_hw_update(struct hw_param *m)
{
}
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index f09583c95a62..e9602525e4bd 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -137,12 +137,14 @@ static inline struct resctrl_hw_ctrl *resctrl_to_arch_ctrl(struct resctrl_ctrl *
* a resource for a control function
* @d_resctrl: Properties exposed to the resctrl file system
* @ctrl_val: array of cache or mem ctrl values (indexed by CLOSID)
+ * @d_info: ERDT table information of this domain (read-only)
*
* Members of this structure are accessed via helpers that provide abstraction.
*/
struct rdt_hw_ctrl_domain {
struct rdt_ctrl_domain d_resctrl;
u32 *ctrl_val;
+ struct erdt_domain_info *d_info;
};

/**
@@ -325,6 +327,7 @@ static inline void intel_aet_mon_domain_setup(int cpu, int id, struct rdt_resour
static inline bool intel_handle_aet_option(bool force_off, char *tok) { return false; }
#endif

+struct erdt_domain_info *erdt_find_domain_info(int cpu);
bool erdt_support(int flag);
bool erdt_cpu_has(int flag);
bool erdt_enable_mon(void);
--
2.43.0