提交 950e5edb 编写于 作者: J James Morse 提交者: Zheng Zengkai

drivers: base: cacheinfo: Add helper to search cacheinfo by of_node

hulk inclusion
category: feature
feature: ARM MPAM support
bugzilla: 48265
CVE: NA

--------------------------------

The MPAM ACPI table holds a PPTT-offset that describes a cache. Add a
helper cacheinfo_shared_cpu_map_search() to search the cacheinfo
structures for a cache that represents this firmware description.

The cacheinfo structures are freed and allocated over CPU online/offline,
the caller of this helper must hold the cpu-hotplug read lock while
the helper runs, and while it holds the return value.
Signed-off-by: NJames Morse <james.morse@arm.com>
Link: http://www.linux-arm.org/git?p=linux-jm.git;a=patch;h=9e5b7ec7c145019f7160c56795ede536f0de5347Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Signed-off-by: NHongbo Yao <yaohongbo@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 cf3fad61
...@@ -213,6 +213,34 @@ int __weak cache_setup_acpi(unsigned int cpu) ...@@ -213,6 +213,34 @@ int __weak cache_setup_acpi(unsigned int cpu)
return -ENOTSUPP; return -ENOTSUPP;
} }
/**
* cacheinfo_shared_cpu_map_search() - find an instance of struct cacheinfo
* from the provided firmware description.
* Caller must hold cpus_read_lock() until its finished with the cacheinfo.
*
* Return a CPUs cache leaf described @fw_desc, or NULL.
*/
struct cacheinfo *cacheinfo_shared_cpu_map_search(void *fw_token)
{
struct cacheinfo *iter;
unsigned int cpu, index;
struct cpu_cacheinfo *cpu_ci;
for_each_online_cpu(cpu) {
cpu_ci = get_cpu_cacheinfo(cpu);
for (index = 0; index < cache_leaves(cpu); index++) {
iter = cpu_ci->info_list + index;
if (iter->fw_token == fw_token) {
return iter;
}
}
}
return NULL;
}
unsigned int coherency_max_size; unsigned int coherency_max_size;
static int cache_shared_cpu_map_setup(unsigned int cpu) static int cache_shared_cpu_map_setup(unsigned int cpu)
......
...@@ -98,6 +98,7 @@ int func(unsigned int cpu) \ ...@@ -98,6 +98,7 @@ int func(unsigned int cpu) \
} }
struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu); struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu);
struct cacheinfo *cacheinfo_shared_cpu_map_search(void *fw_desc);
int init_cache_level(unsigned int cpu); int init_cache_level(unsigned int cpu);
int populate_cache_leaves(unsigned int cpu); int populate_cache_leaves(unsigned int cpu);
int cache_setup_acpi(unsigned int cpu); int cache_setup_acpi(unsigned int cpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册