|
@@ -35,6 +35,7 @@
|
|
|
|
|
|
#define MAX_MBA_BW 100u
|
|
#define MAX_MBA_BW 100u
|
|
#define MBA_IS_LINEAR 0x4
|
|
#define MBA_IS_LINEAR 0x4
|
|
|
|
+#define MBA_MAX_MBPS U32_MAX
|
|
|
|
|
|
/* Mutex to protect rdtgroup access. */
|
|
/* Mutex to protect rdtgroup access. */
|
|
DEFINE_MUTEX(rdtgroup_mutex);
|
|
DEFINE_MUTEX(rdtgroup_mutex);
|
|
@@ -439,25 +440,40 @@ struct rdt_domain *rdt_find_domain(struct rdt_resource *r, int id,
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Initialize the Control MSRs to having no control.
|
|
|
|
+ * For Cache Allocation: Set all bits in cbm
|
|
|
|
+ * For Memory Allocation: Set b/w requested to 100%
|
|
|
|
+ * and the bandwidth in MBps to U32_MAX
|
|
|
|
+ */
|
|
|
|
+ for (i = 0; i < r->num_closid; i++, dc++, dm++) {
|
|
|
|
+ *dc = r->default_ctrl;
|
|
|
|
+ *dm = MBA_MAX_MBPS;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d)
|
|
static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d)
|
|
{
|
|
{
|
|
struct msr_param m;
|
|
struct msr_param m;
|
|
- u32 *dc;
|
|
|
|
- int i;
|
|
|
|
|
|
+ u32 *dc, *dm;
|
|
|
|
|
|
dc = kmalloc_array(r->num_closid, sizeof(*d->ctrl_val), GFP_KERNEL);
|
|
dc = kmalloc_array(r->num_closid, sizeof(*d->ctrl_val), GFP_KERNEL);
|
|
if (!dc)
|
|
if (!dc)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
- d->ctrl_val = dc;
|
|
|
|
|
|
+ dm = kmalloc_array(r->num_closid, sizeof(*d->mbps_val), GFP_KERNEL);
|
|
|
|
+ if (!dm) {
|
|
|
|
+ kfree(dc);
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+ }
|
|
|
|
|
|
- /*
|
|
|
|
- * Initialize the Control MSRs to having no control.
|
|
|
|
- * For Cache Allocation: Set all bits in cbm
|
|
|
|
- * For Memory Allocation: Set b/w requested to 100
|
|
|
|
- */
|
|
|
|
- for (i = 0; i < r->num_closid; i++, dc++)
|
|
|
|
- *dc = r->default_ctrl;
|
|
|
|
|
|
+ d->ctrl_val = dc;
|
|
|
|
+ d->mbps_val = dm;
|
|
|
|
+ setup_default_ctrlval(r, dc, dm);
|
|
|
|
|
|
m.low = 0;
|
|
m.low = 0;
|
|
m.high = r->num_closid;
|
|
m.high = r->num_closid;
|
|
@@ -596,6 +612,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
|
|
}
|
|
}
|
|
|
|
|
|
kfree(d->ctrl_val);
|
|
kfree(d->ctrl_val);
|
|
|
|
+ kfree(d->mbps_val);
|
|
kfree(d->rmid_busy_llc);
|
|
kfree(d->rmid_busy_llc);
|
|
kfree(d->mbm_total);
|
|
kfree(d->mbm_total);
|
|
kfree(d->mbm_local);
|
|
kfree(d->mbm_local);
|