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 <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-3-ben.horgan@arm.com
This commit is contained in:
Ben Horgan 2026-09-11 17:36:12 +01:00 committed by Borislav Petkov (AMD)
parent 57a354d20a
commit 255f92316a

View File

@ -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.
*