Re: [PATCH v6 30/40] arm_mpam: resctrl: Add resctrl_arch_rmid_read()

From: Gavin Shan

Date: Mon Mar 23 2026 - 23:43:14 EST


On 3/14/26 12:46 AM, Ben Horgan wrote:
From: James Morse <james.morse@xxxxxxx>

resctrl uses resctrl_arch_rmid_read() to read counters. CDP emulation means
the counter may need reading in three different ways.

The helpers behind the resctrl_arch_ functions will be re-used for the ABMC
equivalent functions.

Add the rounding helper for checking monitor values while we're here.

Tested-by: Gavin Shan <gshan@xxxxxxxxxx>
Tested-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Tested-by: Peter Newman <peternewman@xxxxxxxxxx>
Tested-by: Zeng Heng <zengheng4@xxxxxxxxxx>
Reviewed-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
Signed-off-by: James Morse <james.morse@xxxxxxx>
Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
---
Changes since rfc:
cfg initialisation style
code flow at end of read_mon_cdp_safe()

Changes since v2:
Whitespace changes

Changes since v3:
Update function signatures
Remove abmc check

Changes since v5:
don't read mbwu
remove reset code as only needed for mbwu
---
drivers/resctrl/mpam_resctrl.c | 82 ++++++++++++++++++++++++++++++++++
include/linux/arm_mpam.h | 5 +++
2 files changed, 87 insertions(+)

Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>