[PATCH 06/15] x86/resctrl: Add the mount option for ABMC feature

From: Babu Moger
Date: Thu Nov 30 2023 - 19:57:56 EST


Add the mount option for ABMC (Assignable Bandwidth Monitoring Counters)
feature.

Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
---
Documentation/arch/x86/resctrl.rst | 2 ++
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 +++++
3 files changed, 8 insertions(+)

diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
index 1293cb6cba98..19e906f629d4 100644
--- a/Documentation/arch/x86/resctrl.rst
+++ b/Documentation/arch/x86/resctrl.rst
@@ -50,6 +50,8 @@ mount options are:
"debug":
Make debug files accessible. Available debug files are annotated with
"Available only with debug option".
+"abmc":
+ Enable ABMC (Assignable Bandwidth Monitoring Counters) feature.

L2 and L3 CDP are controlled separately.

diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 0b22be85a444..b8f3a0b1ca41 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -56,6 +56,7 @@ struct rdt_fs_context {
bool enable_cdpl3;
bool enable_mba_mbps;
bool enable_debug;
+ bool enable_abmc;
};

static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index feeb57ee7888..a4328e12a8f6 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -2687,6 +2687,7 @@ enum rdt_param {
Opt_cdpl2,
Opt_mba_mbps,
Opt_debug,
+ Opt_abmc,
nr__rdt_params
};

@@ -2695,6 +2696,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = {
fsparam_flag("cdpl2", Opt_cdpl2),
fsparam_flag("mba_MBps", Opt_mba_mbps),
fsparam_flag("debug", Opt_debug),
+ fsparam_flag("abmc", Opt_abmc),
{}
};

@@ -2723,6 +2725,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
case Opt_debug:
ctx->enable_debug = true;
return 0;
+ case Opt_abmc:
+ ctx->enable_abmc = true;
+ return 0;
}

return -EINVAL;
--
2.34.1