[PATCH 1/4] resctrl: Add kmode arch stubs for ARM MPAM and hide kernel_mode on non-PLZA platforms

From: Qinyun Tan

Date: Thu Jun 11 2026 - 07:18:20 EST


fs/resctrl/rdtgroup.c calls resctrl_arch_get_kmode_support() and
resctrl_arch_configure_kmode() which are only implemented under
arch/x86/. ARM MPAM enables CONFIG_RESCTRL_FS but has no PLZA
hardware, causing link failures on aarch64 allyesconfig:

undefined reference to `resctrl_arch_configure_kmode'
undefined reference to `resctrl_arch_get_kmode_support'

Add empty stubs in drivers/resctrl/mpam_resctrl.c, following the
same pattern used for resctrl_arch_io_alloc_enable().

Additionally, the kernel_mode file under info/ was unconditionally
visible (fflags = RFTYPE_TOP_INFO). On platforms without PLZA
(ARM MPAM, older AMD/Intel), the file shows only inherit_ctrl_and_mon
with no other options, which is unnecessary. Set the initial fflags
to 0 and dynamically enable the file in resctrl_kmode_init() only
when resctrl_arch_get_kmode_support() registers additional modes,
matching the io_alloc pattern.

Signed-off-by: Qinyun Tan <qinyuntan@xxxxxxxxxxxxxxxxx>
Reviewed-by: Xunlei Pang <xlpang@xxxxxxxxxxxxxxxxx>
---
drivers/resctrl/mpam_resctrl.c | 9 +++++++++
fs/resctrl/rdtgroup.c | 5 ++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 1dd3bbd0772cd..fc2b3f508c039 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -161,6 +161,15 @@ bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r)
return false;
}

+void resctrl_arch_get_kmode_support(struct resctrl_kmode_cfg *kcfg)
+{
+}
+
+void resctrl_arch_configure_kmode(const struct cpumask *cpu_mask, u32 closid,
+ u32 rmid, bool enable)
+{
+}
+
void resctrl_arch_pre_mount(void)
{
}
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index dd9c4da836983..0b2606f10e2e9 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2602,7 +2602,7 @@ static struct rftype res_common_files[] = {
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = resctrl_kernel_mode_show,
.write = resctrl_kernel_mode_write,
- .fflags = RFTYPE_TOP_INFO,
+ .fflags = 0,
},
{
.name = "mbm_assign_on_mkdir",
@@ -2968,6 +2968,9 @@ static void resctrl_kmode_init(void)
resctrl_kcfg.k_rdtgrp = &rdtgroup_default;

resctrl_arch_get_kmode_support(&resctrl_kcfg);
+
+ if (resctrl_kcfg.kmode != BIT(INHERIT_CTRL_AND_MON))
+ resctrl_file_fflags_init("kernel_mode", RFTYPE_TOP_INFO);
}

void resctrl_file_fflags_init(const char *config, unsigned long fflags)
--
2.43.7