Skip to content

Commit 02cc661

Browse files
author
James Morse
committed
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>
1 parent 370d166 commit 02cc661

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

drivers/resctrl/mpam_resctrl.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,49 @@ static int mpam_resctrl_pick_domain_id(int cpu, struct mpam_component *comp)
170170
return comp->comp_id;
171171
}
172172

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+
173216
void resctrl_arch_reset_all_ctrls(struct rdt_resource *r)
174217
{
175218
struct mpam_resctrl_res *res;

0 commit comments

Comments
 (0)