Before the name for the schema can be generated, the type of the
configuration being applied to the resource needs to be known. Label
all the entries in rdt_resources_all[], and copy that value in to struct
resctrl_schema.
Subsequent patches will generate the schema names in what will become
the fs code. Eventually the fs code will generate pairs of CODE/DATA if
the platform supports CDP for this resource.
Signed-off-by: James Morse <james.morse@xxxxxxx>
---
arch/x86/kernel/cpu/resctrl/core.c | 7 +++++++
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 1 +
include/linux/resctrl.h | 8 ++++++++
4 files changed, 17 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 682e84aebd14..6c87a81946b1 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -367,6 +367,7 @@ struct rdt_parse_data {
* @mon_scale: cqm counter * mon_scale = occupancy in bytes
*/
struct rdt_hw_resource {
+ enum resctrl_conf_type conf_type;
struct rdt_resource resctrl;
int num_closid;
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 1bd785b1920c..628e5eb4d7a9 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -2141,6 +2141,7 @@ static int create_schemata_list(void)
s->res = r;
s->num_closid = resctrl_arch_get_num_closid(r);
+ s->conf_type = resctrl_to_arch_res(r)->conf_type;
INIT_LIST_HEAD(&s->list);
list_add(&s->list, &resctrl_all_schema);
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index b32152968bca..20d8b6dd4af4 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -15,6 +15,12 @@ int proc_resctrl_show(struct seq_file *m,
#endif
+enum resctrl_conf_type {
+ CDP_BOTH,
+ CDP_CODE,
+ CDP_DATA,
+};
+
/**
* struct rdt_domain - group of cpus sharing an RDT resource
* @list: all instances of this resource
@@ -165,11 +171,13 @@ struct rdt_resource {
/**
* @list: Member of resctrl's schema list
+ * @cdp_type: Whether this entry is for code/data/both
* @res: The rdt_resource for this entry
* @num_closid Number of CLOSIDs available for this resource
*/
struct resctrl_schema {
struct list_head list;
+ enum resctrl_conf_type conf_type;
struct rdt_resource *res;
u32 num_closid;
};