[RFC PATCH 27/31] x86/resctrl: Enable region-aware MBM/MBA via the RDT_CTRL register
From: Chen Yu
Date: Sun Aug 02 2026 - 12:17:53 EST
Region-aware MBM and MBA are exposed through per-RMDD MMIO register
blocks. These MMIO interfaces are only honored by hardware once the
domain is taken out of legacy "Total" mode.
Clear the legacy-mode bit once an RMDD's region-aware ACPI sub-tables
have parsed successfully, so the switch to region-aware mode only
happens for fully validated domains. The specification requires that
region-aware MBM and MBA be enabled together and consistently across
all RMDDs.
Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
---
arch/x86/kernel/cpu/resctrl/erdt.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/erdt.c b/arch/x86/kernel/cpu/resctrl/erdt.c
index 8f087defffac..6464463973bb 100644
--- a/arch/x86/kernel/cpu/resctrl/erdt.c
+++ b/arch/x86/kernel/cpu/resctrl/erdt.c
@@ -29,6 +29,8 @@ static u32 erdt_max_clos;
#define MARC_SUPPORTED_INDEX_FN 1
#define RMDD_FLAG_CPU_L3_DOMAIN BIT(0)
+#define RDT_CTRL_LEGACY_MODE BIT(2)
+
#define MARC_FLAG_OPT BIT(0)
#define MARC_FLAG_MIN BIT(1)
#define MARC_FLAG_MAX BIT(2)
@@ -406,8 +408,23 @@ static void erdt_iounmap_domain(struct erdt_domain_info *domain)
}
}
+static void region_aware_enable(void __iomem *addr, bool enable)
+{
+ u64 rdt_ctrl = readq(addr);
+
+ if (enable)
+ rdt_ctrl &= ~RDT_CTRL_LEGACY_MODE;
+ else
+ rdt_ctrl |= RDT_CTRL_LEGACY_MODE;
+
+ writeq(rdt_ctrl, addr);
+}
+
static void cleanup_one_domain(struct erdt_domain_info *d)
{
+ if (d->base[ERDT_MMIO_RMDD_CREG])
+ region_aware_enable(d->base[ERDT_MMIO_RMDD_CREG], false);
+
erdt_iounmap_domain(d);
kfree(d->marc_buf);
kfree(d->cmrc);
@@ -804,6 +821,7 @@ static __init int enumerate_erdt_table(struct acpi_table_header *table_hdr)
{
struct acpi_table_erdt *erdt = (struct acpi_table_erdt *)table_hdr;
struct acpi_subtbl_hdr_16 *subtbl;
+ struct erdt_domain_info *d;
void *table_end;
if (erdt->header.revision != ERDT_VALID_VERSION) {
@@ -831,6 +849,9 @@ static __init int enumerate_erdt_table(struct acpi_table_header *table_hdr)
if (list_empty(&domain_info_list))
goto cleanup;
+ list_for_each_entry(d, &domain_info_list, entry)
+ region_aware_enable(d->base[ERDT_MMIO_RMDD_CREG], true);
+
erdt_max_clos = erdt->max_clos;
erdt_enabled = true;
--
2.43.0