Re: [PATCH v6 23/40] arm_mpam: resctrl: Add rmid index helpers

From: Gavin Shan

Date: Mon Mar 23 2026 - 18:52:35 EST


On 3/14/26 12:46 AM, Ben Horgan wrote:
Because MPAM's pmg aren't identical to RDT's rmid, resctrl handles some
data structures by index. This allows x86 to map indexes to RMID, and MPAM
to map them to partid-and-pmg.

Add the helpers to do this.

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>
Tested-by: Punit Agrawal <punit.agrawal@xxxxxxxxxxxxxxxx>
Reviewed-by: Zeng Heng <zengheng4@xxxxxxxxxx>
Reviewed-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Suggested-by: James Morse <james.morse@xxxxxxx>
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
---
Changes since rfc:
Use ~0U instead of ~0 in lhs of left shift

Changes since v2:
Drop changes signed-off-by as reworked patch
Use multiply and add rather than shift to avoid holes
---
drivers/resctrl/mpam_resctrl.c | 16 ++++++++++++++++
include/linux/arm_mpam.h | 3 +++
2 files changed, 19 insertions(+)


Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>