s390/cacheinfo: coding style changes
Just some minor coding style changes, while I had to look at the code. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Родитель
4fd4f1c799
Коммит
f4dce5c936
|
@ -91,12 +91,9 @@ static inline enum cache_type get_cache_type(struct cache_info *ci, int level)
|
||||||
{
|
{
|
||||||
if (level >= CACHE_MAX_LEVEL)
|
if (level >= CACHE_MAX_LEVEL)
|
||||||
return CACHE_TYPE_NOCACHE;
|
return CACHE_TYPE_NOCACHE;
|
||||||
|
|
||||||
ci += level;
|
ci += level;
|
||||||
|
|
||||||
if (ci->scope != CACHE_SCOPE_SHARED && ci->scope != CACHE_SCOPE_PRIVATE)
|
if (ci->scope != CACHE_SCOPE_SHARED && ci->scope != CACHE_SCOPE_PRIVATE)
|
||||||
return CACHE_TYPE_NOCACHE;
|
return CACHE_TYPE_NOCACHE;
|
||||||
|
|
||||||
return cache_type_map[ci->type];
|
return cache_type_map[ci->type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,14 +116,11 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, int private,
|
||||||
ti = CACHE_TI_INSTRUCTION;
|
ti = CACHE_TI_INSTRUCTION;
|
||||||
else
|
else
|
||||||
ti = CACHE_TI_UNIFIED;
|
ti = CACHE_TI_UNIFIED;
|
||||||
|
|
||||||
this_leaf->level = level + 1;
|
this_leaf->level = level + 1;
|
||||||
this_leaf->type = type;
|
this_leaf->type = type;
|
||||||
this_leaf->coherency_line_size = ecag(EXTRACT_LINE_SIZE, level, ti);
|
this_leaf->coherency_line_size = ecag(EXTRACT_LINE_SIZE, level, ti);
|
||||||
this_leaf->ways_of_associativity = ecag(EXTRACT_ASSOCIATIVITY,
|
this_leaf->ways_of_associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti);
|
||||||
level, ti);
|
|
||||||
this_leaf->size = ecag(EXTRACT_SIZE, level, ti);
|
this_leaf->size = ecag(EXTRACT_SIZE, level, ti);
|
||||||
|
|
||||||
num_sets = this_leaf->size / this_leaf->coherency_line_size;
|
num_sets = this_leaf->size / this_leaf->coherency_line_size;
|
||||||
num_sets /= this_leaf->ways_of_associativity;
|
num_sets /= this_leaf->ways_of_associativity;
|
||||||
this_leaf->number_of_sets = num_sets;
|
this_leaf->number_of_sets = num_sets;
|
||||||
|
@ -144,7 +138,6 @@ int init_cache_level(unsigned int cpu)
|
||||||
|
|
||||||
if (!this_cpu_ci)
|
if (!this_cpu_ci)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
|
ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
|
||||||
do {
|
do {
|
||||||
ctype = get_cache_type(&ct.ci[0], level);
|
ctype = get_cache_type(&ct.ci[0], level);
|
||||||
|
@ -153,27 +146,24 @@ int init_cache_level(unsigned int cpu)
|
||||||
/* Separate instruction and data caches */
|
/* Separate instruction and data caches */
|
||||||
leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1;
|
leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1;
|
||||||
} while (++level < CACHE_MAX_LEVEL);
|
} while (++level < CACHE_MAX_LEVEL);
|
||||||
|
|
||||||
this_cpu_ci->num_levels = level;
|
this_cpu_ci->num_levels = level;
|
||||||
this_cpu_ci->num_leaves = leaves;
|
this_cpu_ci->num_leaves = leaves;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int populate_cache_leaves(unsigned int cpu)
|
int populate_cache_leaves(unsigned int cpu)
|
||||||
{
|
{
|
||||||
|
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
|
||||||
|
struct cacheinfo *this_leaf = this_cpu_ci->info_list;
|
||||||
unsigned int level, idx, pvt;
|
unsigned int level, idx, pvt;
|
||||||
union cache_topology ct;
|
union cache_topology ct;
|
||||||
enum cache_type ctype;
|
enum cache_type ctype;
|
||||||
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
|
|
||||||
struct cacheinfo *this_leaf = this_cpu_ci->info_list;
|
|
||||||
|
|
||||||
ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
|
ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
|
||||||
for (idx = 0, level = 0; level < this_cpu_ci->num_levels &&
|
for (idx = 0, level = 0; level < this_cpu_ci->num_levels &&
|
||||||
idx < this_cpu_ci->num_leaves; idx++, level++) {
|
idx < this_cpu_ci->num_leaves; idx++, level++) {
|
||||||
if (!this_leaf)
|
if (!this_leaf)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pvt = (ct.ci[level].scope == CACHE_SCOPE_PRIVATE) ? 1 : 0;
|
pvt = (ct.ci[level].scope == CACHE_SCOPE_PRIVATE) ? 1 : 0;
|
||||||
ctype = get_cache_type(&ct.ci[0], level);
|
ctype = get_cache_type(&ct.ci[0], level);
|
||||||
if (ctype == CACHE_TYPE_SEPARATE) {
|
if (ctype == CACHE_TYPE_SEPARATE) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче