From c091e90721b836c2367fa3017636d92427f3f8f7 Mon Sep 17 00:00:00 2001 From: James Morse Date: Wed, 28 Jul 2021 17:06:24 +0000 Subject: x86/resctrl: Add a helper to read/set the CDP configuration Whether CDP is enabled for a hardware resource like the L3 cache can be found by inspecting the alloc_enabled flags of the L3CODE/L3DATA struct rdt_hw_resources, even if they aren't in use. Once these resources are merged, the flags can't be compared. Whether CDP is enabled needs tracking explicitly. If another architecture is emulating CDP the behaviour may not be per-resource. 'cdp_capable' needs to be visible to resctrl, even if its not in use, as this affects the padding of the schemata table visible to user-space. Add cdp_enabled to struct rdt_hw_resource and cdp_capable to struct rdt_resource. Add resctrl_arch_set_cdp_enabled() to let resctrl enable or disable CDP on a resource. resctrl_arch_get_cdp_enabled() lets it read the current state. Signed-off-by: James Morse Signed-off-by: Borislav Petkov Reviewed-by: Jamie Iles Reviewed-by: Reinette Chatre Tested-by: Babu Moger Link: https://lkml.kernel.org/r/20210728170637.25610-12-james.morse@arm.com --- include/linux/resctrl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/linux/resctrl.h') diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 979592c869e6..4b30571fbc8e 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -142,6 +142,7 @@ struct resctrl_schema; * @parse_ctrlval: Per resource function pointer to parse control values * @evt_list: List of monitoring events * @fflags: flags to choose base and info files + * @cdp_capable: Is the CDP feature available on this resource */ struct rdt_resource { int rid; @@ -163,7 +164,7 @@ struct rdt_resource { struct rdt_domain *d); struct list_head evt_list; unsigned long fflags; - + bool cdp_capable; }; /** -- cgit