x86/resctrl: Make resctrl_arch_get_config() return its value
resctrl_arch_get_config() has no return, but does pass a single value back via one of its arguments. Return the value instead. Suggested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20210811163831.14917-1-james.morse@arm.com
This commit is contained in:
committed by
Borislav Petkov
parent
5c3b63cdba
commit
111136e69c
@@ -427,16 +427,15 @@ out:
|
|||||||
return ret ?: nbytes;
|
return ret ?: nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
|
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
|
||||||
u32 closid, enum resctrl_conf_type type, u32 *value)
|
u32 closid, enum resctrl_conf_type type)
|
||||||
{
|
{
|
||||||
struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
|
struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
|
||||||
u32 idx = get_config_index(closid, type);
|
u32 idx = get_config_index(closid, type);
|
||||||
|
|
||||||
if (!is_mba_sc(r))
|
if (!is_mba_sc(r))
|
||||||
*value = hw_dom->ctrl_val[idx];
|
return hw_dom->ctrl_val[idx];
|
||||||
else
|
return hw_dom->mbps_val[idx];
|
||||||
*value = hw_dom->mbps_val[idx];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int closid)
|
static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int closid)
|
||||||
@@ -451,8 +450,8 @@ static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int clo
|
|||||||
if (sep)
|
if (sep)
|
||||||
seq_puts(s, ";");
|
seq_puts(s, ";");
|
||||||
|
|
||||||
resctrl_arch_get_config(r, dom, closid, schema->conf_type,
|
ctrl_val = resctrl_arch_get_config(r, dom, closid,
|
||||||
&ctrl_val);
|
schema->conf_type);
|
||||||
seq_printf(s, r->format_str, dom->id, max_data_width,
|
seq_printf(s, r->format_str, dom->id, max_data_width,
|
||||||
ctrl_val);
|
ctrl_val);
|
||||||
sep = true;
|
sep = true;
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm)
|
|||||||
hw_dom_mba = resctrl_to_arch_dom(dom_mba);
|
hw_dom_mba = resctrl_to_arch_dom(dom_mba);
|
||||||
|
|
||||||
cur_bw = pmbm_data->prev_bw;
|
cur_bw = pmbm_data->prev_bw;
|
||||||
resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE, &user_bw);
|
user_bw = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE);
|
||||||
delta_bw = pmbm_data->delta_bw;
|
delta_bw = pmbm_data->delta_bw;
|
||||||
/*
|
/*
|
||||||
* resctrl_arch_get_config() chooses the mbps/ctrl value to return
|
* resctrl_arch_get_config() chooses the mbps/ctrl value to return
|
||||||
|
|||||||
@@ -923,8 +923,8 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
|
|||||||
for (i = 0; i < closids_supported(); i++) {
|
for (i = 0; i < closids_supported(); i++) {
|
||||||
if (!closid_allocated(i))
|
if (!closid_allocated(i))
|
||||||
continue;
|
continue;
|
||||||
resctrl_arch_get_config(r, dom, i, s->conf_type,
|
ctrl_val = resctrl_arch_get_config(r, dom, i,
|
||||||
&ctrl_val);
|
s->conf_type);
|
||||||
mode = rdtgroup_mode_by_closid(i);
|
mode = rdtgroup_mode_by_closid(i);
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case RDT_MODE_SHAREABLE:
|
case RDT_MODE_SHAREABLE:
|
||||||
@@ -1142,7 +1142,7 @@ static bool __rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d
|
|||||||
|
|
||||||
/* Check for overlap with other resource groups */
|
/* Check for overlap with other resource groups */
|
||||||
for (i = 0; i < closids_supported(); i++) {
|
for (i = 0; i < closids_supported(); i++) {
|
||||||
resctrl_arch_get_config(r, d, i, type, (u32 *)&ctrl_b);
|
ctrl_b = resctrl_arch_get_config(r, d, i, type);
|
||||||
mode = rdtgroup_mode_by_closid(i);
|
mode = rdtgroup_mode_by_closid(i);
|
||||||
if (closid_allocated(i) && i != closid &&
|
if (closid_allocated(i) && i != closid &&
|
||||||
mode != RDT_MODE_PSEUDO_LOCKSETUP) {
|
mode != RDT_MODE_PSEUDO_LOCKSETUP) {
|
||||||
@@ -1222,7 +1222,8 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp)
|
|||||||
continue;
|
continue;
|
||||||
has_cache = true;
|
has_cache = true;
|
||||||
list_for_each_entry(d, &r->domains, list) {
|
list_for_each_entry(d, &r->domains, list) {
|
||||||
resctrl_arch_get_config(r, d, closid, s->conf_type, &ctrl);
|
ctrl = resctrl_arch_get_config(r, d, closid,
|
||||||
|
s->conf_type);
|
||||||
if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) {
|
if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) {
|
||||||
rdt_last_cmd_puts("Schemata overlaps\n");
|
rdt_last_cmd_puts("Schemata overlaps\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -1395,8 +1396,9 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
|
|||||||
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
|
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
|
||||||
size = 0;
|
size = 0;
|
||||||
} else {
|
} else {
|
||||||
resctrl_arch_get_config(r, d, rdtgrp->closid,
|
ctrl = resctrl_arch_get_config(r, d,
|
||||||
schema->conf_type, &ctrl);
|
rdtgrp->closid,
|
||||||
|
schema->conf_type);
|
||||||
if (r->rid == RDT_RESOURCE_MBA)
|
if (r->rid == RDT_RESOURCE_MBA)
|
||||||
size = ctrl;
|
size = ctrl;
|
||||||
else
|
else
|
||||||
@@ -2724,10 +2726,12 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct resctrl_schema *s,
|
|||||||
* with an exclusive group.
|
* with an exclusive group.
|
||||||
*/
|
*/
|
||||||
if (resctrl_arch_get_cdp_enabled(r->rid))
|
if (resctrl_arch_get_cdp_enabled(r->rid))
|
||||||
resctrl_arch_get_config(r, d, i, peer_type, &peer_ctl);
|
peer_ctl = resctrl_arch_get_config(r, d, i,
|
||||||
|
peer_type);
|
||||||
else
|
else
|
||||||
peer_ctl = 0;
|
peer_ctl = 0;
|
||||||
resctrl_arch_get_config(r, d, i, s->conf_type, &ctrl_val);
|
ctrl_val = resctrl_arch_get_config(r, d, i,
|
||||||
|
s->conf_type);
|
||||||
used_b |= ctrl_val | peer_ctl;
|
used_b |= ctrl_val | peer_ctl;
|
||||||
if (mode == RDT_MODE_SHAREABLE)
|
if (mode == RDT_MODE_SHAREABLE)
|
||||||
cfg->new_ctrl |= ctrl_val | peer_ctl;
|
cfg->new_ctrl |= ctrl_val | peer_ctl;
|
||||||
|
|||||||
@@ -194,8 +194,7 @@ struct resctrl_schema {
|
|||||||
/* The number of closid supported by this resource regardless of CDP */
|
/* The number of closid supported by this resource regardless of CDP */
|
||||||
u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
|
u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
|
||||||
int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
|
int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
|
||||||
void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
|
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
|
||||||
u32 closid, enum resctrl_conf_type type,
|
u32 closid, enum resctrl_conf_type type);
|
||||||
u32 *value);
|
|
||||||
|
|
||||||
#endif /* _RESCTRL_H */
|
#endif /* _RESCTRL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user