Re: [PATCH 30/33] arm_mpam: Use long MBWU counters if supported
From: Gavin Shan
Date: Sun Nov 09 2025 - 18:17:33 EST
On 11/7/25 10:34 PM, Ben Horgan wrote:
From: Rohit Mathew <rohit.mathew@xxxxxxx>
Now that the larger counter sizes are probed, make use of them.
Callers of mpam_msmon_read() may not know (or care!) about the different
counter sizes. Allow them to specify mpam_feat_msmon_mbwu and have the
driver pick the counter to use.
Only 32bit accesses to the MSC are required to be supported by the
spec, but these registers are 64bits. The lower half may overflow
into the higher half between two 32bit reads. To avoid this, use
a helper that reads the top half multiple times to check for overflow.
Signed-off-by: Rohit Mathew <rohit.mathew@xxxxxxx>
[morse: merged multiple patches from Rohit, added explicit counter selection ]
Signed-off-by: James Morse <james.morse@xxxxxxx>
Reviewed-by: Ben Horgan <ben.horgan@xxxxxxx>
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
Reviewed-by: Fenghua Yu <fenghuay@xxxxxxxxxx>
Tested-by: Fenghua Yu <fenghuay@xxxxxxxxxx>
Cc: Peter Newman <peternewman@xxxxxxxxxx>
Tested-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
---
Changes since v3:
Peter:
Fix type checking, use mpam_feat_msmon_mbwu_<n>counter
Reset/configuration order of long counters
---
drivers/resctrl/mpam_devices.c | 145 ++++++++++++++++++++++++++++-----
1 file changed, 126 insertions(+), 19 deletions(-)
Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>