From 255f92316ac1017478e9ace42cafdeb6c98c1f25 Mon Sep 17 00:00:00 2001 From: Ben Horgan Date: Fri, 11 Sep 2026 17:36:12 +0100 Subject: arm_mpam: resctrl: Add pass-through resctrl_arch_preconvert_bw() resctrl rounds up the percentage value of the MBA based on the bw_gran. As MPAM uses a binary fixed point fraction format for MBA rather than a decimal percentage, this introduces rounding errors. Without this additional rounding, if the user reads the value in an MB schema and then writes it back to the schema, the value in hardware won't change. However, with this additional rounding, this guarantee is broken for systems with mbw_wd < 7. resctrl is introducing resctrl_arch_preconvert_bw() to allow the arch code to specify the conversion resctrl does to the user-provided bandwidth value. Add the MPAM version of resctrl_arch_preconvert_bw(). This does no conversion. Signed-off-by: Ben Horgan Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Reinette Chatre Reviewed-by: Gavin Shan Link: https://patch.msgid.link/20260911163613.1131447-3-ben.horgan@arm.com --- drivers/resctrl/mpam_resctrl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers') diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 9d223057953a..f2c651e9f6ea 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -148,6 +148,11 @@ bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level rid) return mpam_resctrl_controls[rid].cdp_enabled; } +u32 resctrl_arch_preconvert_bw(const struct rdt_resource *r, u32 val) +{ + return val; +} + /** * resctrl_reset_task_closids() - Reset the PARTID/PMG values for all tasks. * -- cgit v1.2.3