for (i = 0; i < closids_supported(); i++) {
if (!closid_allocated(i))
continue;
- resctrl_arch_get_config(r, dom, i, &ctrl_val);
+ resctrl_arch_get_config(r, dom, i, s->conf_type,
+ &ctrl_val);
mode = rdtgroup_mode_by_closid(i);
switch (mode) {
case RDT_MODE_SHAREABLE:
* Used to return the result.
* @d_cdp: RDT domain that shares hardware with @d (RDT domain peer)
* Used to return the result.
+ * @peer_type: The CDP configuration type of the peer resource.
*
* RDT resources are managed independently and by extension the RDT domains
* (RDT resource instances) are managed independently also. The Code and
*/
static int rdt_cdp_peer_get(struct rdt_resource *r, struct rdt_domain *d,
struct rdt_resource **r_cdp,
- struct rdt_domain **d_cdp)
+ struct rdt_domain **d_cdp,
+ enum resctrl_conf_type *peer_type)
{
struct rdt_resource *_r_cdp = NULL;
struct rdt_domain *_d_cdp = NULL;
switch (r->rid) {
case RDT_RESOURCE_L3DATA:
_r_cdp = &rdt_resources_all[RDT_RESOURCE_L3CODE].r_resctrl;
+ *peer_type = CDP_CODE;
break;
case RDT_RESOURCE_L3CODE:
_r_cdp = &rdt_resources_all[RDT_RESOURCE_L3DATA].r_resctrl;
+ *peer_type = CDP_DATA;
break;
case RDT_RESOURCE_L2DATA:
_r_cdp = &rdt_resources_all[RDT_RESOURCE_L2CODE].r_resctrl;
+ *peer_type = CDP_CODE;
break;
case RDT_RESOURCE_L2CODE:
_r_cdp = &rdt_resources_all[RDT_RESOURCE_L2DATA].r_resctrl;
+ *peer_type = CDP_DATA;
break;
default:
ret = -ENOENT;
* Return: false if CBM does not overlap, true if it does.
*/
static bool __rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
- unsigned long cbm, int closid, bool exclusive)
+ unsigned long cbm, int closid,
+ enum resctrl_conf_type type, bool exclusive)
{
enum rdtgrp_mode mode;
unsigned long ctrl_b;
/* Check for overlap with other resource groups */
for (i = 0; i < closids_supported(); i++) {
- resctrl_arch_get_config(r, d, i, (u32 *)&ctrl_b);
+ resctrl_arch_get_config(r, d, i, type, (u32 *)&ctrl_b);
mode = rdtgroup_mode_by_closid(i);
if (closid_allocated(i) && i != closid &&
mode != RDT_MODE_PSEUDO_LOCKSETUP) {
bool rdtgroup_cbm_overlaps(struct resctrl_schema *s, struct rdt_domain *d,
unsigned long cbm, int closid, bool exclusive)
{
+ enum resctrl_conf_type peer_type;
struct rdt_resource *r = s->res;
struct rdt_resource *r_cdp;
struct rdt_domain *d_cdp;
- if (__rdtgroup_cbm_overlaps(r, d, cbm, closid, exclusive))
+ if (__rdtgroup_cbm_overlaps(r, d, cbm, closid, s->conf_type,
+ exclusive))
return true;
- if (rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp) < 0)
+ if (rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp, &peer_type) < 0)
return false;
- return __rdtgroup_cbm_overlaps(r_cdp, d_cdp, cbm, closid, exclusive);
+ return __rdtgroup_cbm_overlaps(r_cdp, d_cdp, cbm, closid, peer_type, exclusive);
}
/**
continue;
has_cache = true;
list_for_each_entry(d, &r->domains, list) {
- resctrl_arch_get_config(r, d, closid, &ctrl);
+ resctrl_arch_get_config(r, d, closid, s->conf_type, &ctrl);
if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) {
rdt_last_cmd_puts("Schemata overlaps\n");
return false;
size = 0;
} else {
resctrl_arch_get_config(r, d, rdtgrp->closid,
- &ctrl);
+ schema->conf_type, &ctrl);
if (r->rid == RDT_RESOURCE_MBA)
size = ctrl;
else
enum resctrl_conf_type t = s->conf_type;
struct rdt_resource *r_cdp = NULL;
struct resctrl_staged_config *cfg;
+ enum resctrl_conf_type peer_type;
struct rdt_domain *d_cdp = NULL;
struct rdt_resource *r = s->res;
u32 used_b = 0, unused_b = 0;
u32 peer_ctl, ctrl_val;
int i;
- rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp);
+ rdt_cdp_peer_get(r, d, &r_cdp, &d_cdp, &peer_type);
cfg = &d->staged_config[t];
cfg->have_new_ctrl = false;
cfg->new_ctrl = r->cache.shareable_bits;
* with an exclusive group.
*/
if (d_cdp)
- resctrl_arch_get_config(r_cdp, d_cdp, i, &peer_ctl);
+ resctrl_arch_get_config(r_cdp, d_cdp, i, peer_type, &peer_ctl);
else
peer_ctl = 0;
- resctrl_arch_get_config(r, d, i, &ctrl_val);
+ resctrl_arch_get_config(r, d, i, s->conf_type, &ctrl_val);
used_b |= ctrl_val | peer_ctl;
if (mode == RDT_MODE_SHAREABLE)
cfg->new_ctrl |= ctrl_val | peer_ctl;