cacheinfo: Expose the code to generate a cache-id from a device_node
ANBZ: #1654 cherry-picked from https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git The MPAM driver identifies caches by id for use with resctrl. It needs to know the cache-id when probeing, but the value isn't set in cacheinfo until device_initcall(). Expose the code that generates the cache-id. The parts of the MPAM driver that run early can use this to set up the resctrl structures. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Xin Hao <xhao@linux.alibaba.com> Signed-off-by: Shawn Wang <shawnwang@linux.alibaba.com> Reviewed-by: Xin Hao <xhao@linux.alibaba.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
This commit is contained in:
parent
fdd96acd1c
commit
335a8d3f7d
|
@ -136,7 +136,7 @@ static bool cache_node_is_unified(struct cacheinfo *this_leaf,
|
|||
return of_property_read_bool(np, "cache-unified");
|
||||
}
|
||||
|
||||
static void cache_of_set_id(struct cacheinfo *this_leaf, struct device_node *np)
|
||||
unsigned long cache_of_get_id(struct device_node *np)
|
||||
{
|
||||
struct device_node *cpu;
|
||||
unsigned long min_id = ~0UL;
|
||||
|
@ -155,8 +155,15 @@ static void cache_of_set_id(struct cacheinfo *this_leaf, struct device_node *np)
|
|||
}
|
||||
}
|
||||
|
||||
if (min_id != ~0UL) {
|
||||
this_leaf->id = min_id;
|
||||
return min_id;
|
||||
}
|
||||
|
||||
static void cache_of_set_id(struct cacheinfo *this_leaf, struct device_node *np)
|
||||
{
|
||||
unsigned long id = cache_of_get_id(np);
|
||||
|
||||
if (id != ~0UL) {
|
||||
this_leaf->id = id;
|
||||
this_leaf->attributes |= CACHE_ID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ int acpi_find_last_cache_level(unsigned int cpu);
|
|||
#endif
|
||||
|
||||
const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);
|
||||
unsigned long cache_of_get_id(struct device_node *np);
|
||||
|
||||
/*
|
||||
* Get the id of the cache associated with @cpu at level @level.
|
||||
|
|
Loading…
Reference in New Issue