summaryrefslogtreecommitdiff
path: root/include/linux/resctrl.h
diff options
context:
space:
mode:
authorDave Martin <dave.martin@arm.com>2026-09-11 17:36:11 +0100
committerBorislav Petkov (AMD) <bp@alien8.de>2026-09-14 08:15:11 -0700
commit57a354d20a01287bd173b13231eb5afcda337eee (patch)
tree6f80b48bb7ed588b9bb9984cb6fff5a6e9fb4161 /include/linux/resctrl.h
parentdf2908090cda368b01ff43709f51890076c56157 (diff)
downloadlinux-next-57a354d20a01287bd173b13231eb5afcda337eee.tar.gz
linux-next-57a354d20a01287bd173b13231eb5afcda337eee.zip
x86,fs/resctrl: Add resctrl_arch_preconvert_bw()
On MPAM systems the rounding behaviour of the MBA control would be improved if the rounding in the fs/resctrl code is removed but this is not the case for x86. To allow any rounding or conversion of the bandwidth value provided by the user to be specified by the arch code a new arch hook is required. Introduce resctrl_arch_preconvert_bw(), and add its x86 implementation. This is currently unused in resctrl but when plumbed in it will replace the call to roundup() in bw_validate(). Signed-off-by: Dave Martin <dave.martin@arm.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Link: https://patch.msgid.link/20260911163613.1131447-2-ben.horgan@arm.com
Diffstat (limited to 'include/linux/resctrl.h')
-rw-r--r--include/linux/resctrl.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index dd09c2ce9a0f..10dfdca7f4bf 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -505,6 +505,25 @@ bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_resource *r);
*/
int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable);
+/**
+ * resctrl_arch_preconvert_bw() - Prepare bandwidth control value for arch use.
+ * @r: Resource whose schema was written.
+ * @val: Bandwidth control value written to the schemata file by userspace.
+ *
+ * Convert the user provided bandwidth control value to an appropriate form for
+ * consumption by the hardware driver for resource @r. Converted value is stored
+ * in rdt_ctrl_domain::staged_config[] for later consumption by
+ * resctrl_arch_update_domains(). Is not called when MBA software controller is
+ * enabled.
+ *
+ * Architectures for which this pre-conversion hook is not useful should supply
+ * an implementation of this function that just returns @val unmodified.
+ *
+ * Return:
+ * The converted value.
+ */
+u32 resctrl_arch_preconvert_bw(const struct rdt_resource *r, u32 val);
+
/*
* Update the ctrl_val and apply this config right now.
* Must be called on one of the domain's CPUs.