Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm_mpam: resctrl: Add rmid index helpers

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@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Suggested-by: James Morse <james.morse@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>

authored by

Ben Horgan and committed by
James Morse
3e9b3582 80d147d2

+19
+16
drivers/resctrl/mpam_resctrl.c
··· 145 145 return mpam_partid_max + 1; 146 146 } 147 147 148 + u32 resctrl_arch_system_num_rmid_idx(void) 149 + { 150 + return (mpam_pmg_max + 1) * (mpam_partid_max + 1); 151 + } 152 + 153 + u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid) 154 + { 155 + return closid * (mpam_pmg_max + 1) + rmid; 156 + } 157 + 158 + void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid) 159 + { 160 + *closid = idx / (mpam_pmg_max + 1); 161 + *rmid = idx % (mpam_pmg_max + 1); 162 + } 163 + 148 164 void resctrl_arch_sched_in(struct task_struct *tsk) 149 165 { 150 166 lockdep_assert_preemption_disabled();
+3
include/linux/arm_mpam.h
··· 58 58 void resctrl_arch_sched_in(struct task_struct *tsk); 59 59 bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid); 60 60 bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid); 61 + u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid); 62 + void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid); 63 + u32 resctrl_arch_system_num_rmid_idx(void); 61 64 62 65 /** 63 66 * mpam_register_requestor() - Register a requestor with the MPAM driver