From: Xie XiuQi <xiexiuqi(a)huawei.com>
commit 40ff7729c8c451e5c403554629aaf473e7b211df openEuler-1.0
hulk inclusion
category: feature
bugzilla: 10897
CVE: NA
MPAM feature is just for debug and preview in this version,
so disable it by default. You can enable it by cmdline: "mpam".
Signed-off-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Reviewed-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/include/asm/mpam_sched.h | 2 ++
arch/arm64/kernel/mpam.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/arch/arm64/include/asm/mpam_sched.h b/arch/arm64/include/asm/mpam_sched.h
index 31522efbf8e5..14638793e53e 100644
--- a/arch/arm64/include/asm/mpam_sched.h
+++ b/arch/arm64/include/asm/mpam_sched.h
@@ -39,6 +39,8 @@ static inline void mpam_sched_in(void)
__mpam_sched_in();
}
+extern int __read_mostly mpam_enabled;
+
#else
static inline void mpam_sched_in(void) {}
diff --git a/arch/arm64/kernel/mpam.c b/arch/arm64/kernel/mpam.c
index aa52e5896ac9..623e9f8d6d8e 100644
--- a/arch/arm64/kernel/mpam.c
+++ b/arch/arm64/kernel/mpam.c
@@ -1242,11 +1242,23 @@ static void mpam_domains_init(struct resctrl_resource *r)
}
}
+int __read_mostly mpam_enabled;
+
+static int __init mpam_setup(char *str)
+{
+ mpam_enabled = 1;
+ return 1;
+}
+__setup("mpam", mpam_setup);
+
static int __init mpam_late_init(void)
{
struct resctrl_resource *r;
int state, ret;
+ if (!mpam_enabled)
+ return 0;
+
if (!cpus_have_const_cap(ARM64_HAS_MPAM))
return -ENODEV;
--
2.31.0