[RFC PATCH 14/31] x86/resctrl: Add emulation controller list to resctrl_ctrl
From: Chen Yu
Date: Sun Aug 02 2026 - 12:16:31 EST
There is a requirement to emulate Controller A using a set of other
controllers. The purpose is to either supply hierarchy information in
the schema info directory or emulate legacy controllers via the new
controllers for backward compatibility.
A legacy controller can be emulated by more than one controller. For
example, on region aware platforms the legacy MBA control is emulated by
the MAX control of every available memory region. Track the emulating
controllers on a list anchored at resctrl_ctrl::emul, linked via
resctrl_ctrl::emul_entry.
Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
---
arch/x86/kernel/cpu/resctrl/core.c | 4 ++++
include/linux/resctrl.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index f0e30f22576c..a7322f0ebaea 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -167,6 +167,7 @@ static inline void cache_alloc_hsw_probe(void)
hw_ctrl->r_ctrl.type = RESCTRL_CTRL_BITMAP;
hw_ctrl->r_ctrl.name = RESCTRL_CTRL_NAME_DEF;
INIT_LIST_HEAD(&hw_ctrl->r_ctrl.domains);
+ INIT_LIST_HEAD(&hw_ctrl->r_ctrl.emul);
hw_ctrl->r_ctrl.bitmap.cbm_len = 20;
hw_ctrl->r_ctrl.bitmap.shareable_bits = 0xc0000;
hw_ctrl->r_ctrl.bitmap.min_cbm_bits = 2;
@@ -205,6 +206,7 @@ static __init bool __get_mem_config_intel(struct rdt_resource *r)
hw_ctrl->r_ctrl.type = RESCTRL_CTRL_SCALAR;
hw_ctrl->r_ctrl.name = RESCTRL_CTRL_NAME_DEF;
INIT_LIST_HEAD(&hw_ctrl->r_ctrl.domains);
+ INIT_LIST_HEAD(&hw_ctrl->r_ctrl.emul);
hw_ctrl->r_ctrl.scalar.max_bw = MAX_MBA_BW;
hw_ctrl->r_ctrl.scalar.min_bw = MAX_MBA_BW - max_delay;
@@ -260,6 +262,7 @@ static __init bool __rdt_get_mem_config_amd(struct rdt_resource *r)
hw_ctrl->r_ctrl.type = RESCTRL_CTRL_SCALAR;
hw_ctrl->r_ctrl.name = RESCTRL_CTRL_NAME_DEF;
INIT_LIST_HEAD(&hw_ctrl->r_ctrl.domains);
+ INIT_LIST_HEAD(&hw_ctrl->r_ctrl.emul);
hw_ctrl->r_ctrl.scalar.max_bw = BIT(eax);
@@ -313,6 +316,7 @@ static void rdt_get_cache_alloc_cfg(int idx, struct rdt_resource *r)
hw_ctrl->r_ctrl.type = RESCTRL_CTRL_BITMAP;
hw_ctrl->r_ctrl.name = RESCTRL_CTRL_NAME_DEF;
INIT_LIST_HEAD(&hw_ctrl->r_ctrl.domains);
+ INIT_LIST_HEAD(&hw_ctrl->r_ctrl.emul);
hw_ctrl->r_ctrl.bitmap.cbm_len = eax.split.cbm_len + 1;
default_ctrl = BIT_MASK(eax.split.cbm_len + 1) - 1;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index b2af0664cce7..e8da30a71e13 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -378,6 +378,8 @@ enum resctrl_ctrl_name {
* visibility via the resource_schemata info directory.
* @bitmap: Bitmap control properties.
* @scalar: Scalar control properties.
+ * @emul: List of controls that emulate the current control.
+ * @emul_entry: List entry of the emulated control's resctrl_ctrl::emul.
*/
struct resctrl_ctrl {
struct list_head entry;
@@ -390,6 +392,8 @@ struct resctrl_ctrl {
struct resctrl_ctrl_bitmap bitmap;
struct resctrl_ctrl_scalar scalar;
};
+ struct list_head emul;
+ struct list_head emul_entry;
};
/**
--
2.43.0