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 resctrl_arch_get_config()

Implement resctrl_arch_get_config() by testing the live configuration for a
CPOR bitmap. For any other configuration type return the default.

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>
Co-developed-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>

+43
+43
drivers/resctrl/mpam_resctrl.c
··· 170 170 return comp->comp_id; 171 171 } 172 172 173 + u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_ctrl_domain *d, 174 + u32 closid, enum resctrl_conf_type type) 175 + { 176 + u32 partid; 177 + struct mpam_config *cfg; 178 + struct mpam_props *cprops; 179 + struct mpam_resctrl_res *res; 180 + struct mpam_resctrl_dom *dom; 181 + enum mpam_device_features configured_by; 182 + 183 + lockdep_assert_cpus_held(); 184 + 185 + if (!mpam_is_enabled()) 186 + return resctrl_get_default_ctrl(r); 187 + 188 + res = container_of(r, struct mpam_resctrl_res, resctrl_res); 189 + dom = container_of(d, struct mpam_resctrl_dom, resctrl_ctrl_dom); 190 + cprops = &res->class->props; 191 + 192 + partid = resctrl_get_config_index(closid, type); 193 + cfg = &dom->ctrl_comp->cfg[partid]; 194 + 195 + switch (r->rid) { 196 + case RDT_RESOURCE_L2: 197 + case RDT_RESOURCE_L3: 198 + configured_by = mpam_feat_cpor_part; 199 + break; 200 + default: 201 + return resctrl_get_default_ctrl(r); 202 + } 203 + 204 + if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r) || 205 + !mpam_has_feature(configured_by, cfg)) 206 + return resctrl_get_default_ctrl(r); 207 + 208 + switch (configured_by) { 209 + case mpam_feat_cpor_part: 210 + return cfg->cpbm; 211 + default: 212 + return resctrl_get_default_ctrl(r); 213 + } 214 + } 215 + 173 216 void resctrl_arch_reset_all_ctrls(struct rdt_resource *r) 174 217 { 175 218 struct mpam_resctrl_res *res;