[PATCH v7 21/49] x86/resctrl: Move mba_mbps_default_event init to filesystem code

James Morse
2025-02-28T20:01:15Z

mba_mbps_default_event is initialised base on whether mbm_local or
mbm_total is supported. In the case of both, it is initialised to
mbm_local. mba_mbps_default_event is initialised in core.c's
get_rdt_mon_resources(), while all the readers are in rdtgroup.c.

After this code is split into architecture specific and filesystem code,
get_rdt_mon_resources() remains part of the architecture code, which
would mean mba_mbps_default_event has to be exposed by the filesystem
code.

Move the initialisation to the filesystem's resctrl_mon_resource_init()

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
---
arch/x86/kernel/cpu/resctrl/core.c | 5 -----
arch/x86/kernel/cpu/resctrl/monitor.c | 5 +++++
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 943e4c56077b..2c352938d18d 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -925,11 +925,6 @@ static __init bool get_rdt_mon_resources(void)
if (!rdt_mon_features)
return false;

- if (resctrl_arch_is_mbm_local_enabled())
- mba_mbps_default_event = QOS_L3_MBM_LOCAL_EVENT_ID;
- else if (resctrl_arch_is_mbm_total_enabled())
- mba_mbps_default_event = QOS_L3_MBM_TOTAL_EVENT_ID;
-
return !rdt_get_mon_l3_config(r);
}

diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index 27d983121b0a..306b06ba32db 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -1213,6 +1213,11 @@ int __init resctrl_mon_resource_init(void)
RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
}

+ if (resctrl_arch_is_mbm_local_enabled())
+ mba_mbps_default_event = QOS_L3_MBM_LOCAL_EVENT_ID;
+ else if (resctrl_arch_is_mbm_total_enabled())
+ mba_mbps_default_event = QOS_L3_MBM_TOTAL_EVENT_ID;
+
return 0;
}

--
2.39.5