Skip to content

Commit

Permalink
s390/cache: fix data/instruction cache output
Browse files Browse the repository at this point in the history
The sysfs and procfs output of the instruction and data caches were
wrong: the output of the data cache provided that instruction cache
values and vice versa.
Fix this by using the correct type indication when issueing the
ecag instruction.

Reported-by: Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Oct 18, 2012
1 parent c985cb3 commit d18f99c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/s390/kernel/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ enum {

enum {
CACHE_TI_UNIFIED = 0,
CACHE_TI_INSTRUCTION = 0,
CACHE_TI_DATA,
CACHE_TI_DATA = 0,
CACHE_TI_INSTRUCTION,
};

struct cache_info {
Expand Down Expand Up @@ -121,7 +121,10 @@ static int __init cache_add(int level, int private, int type)
cache = kzalloc(sizeof(*cache), GFP_KERNEL);
if (!cache)
return -ENOMEM;
ti = type == CACHE_TYPE_DATA ? CACHE_TI_DATA : CACHE_TI_UNIFIED;
if (type == CACHE_TYPE_INSTRUCTION)
ti = CACHE_TI_INSTRUCTION;
else
ti = CACHE_TI_UNIFIED;
cache->size = ecag(EXTRACT_SIZE, level, ti);
cache->line_size = ecag(EXTRACT_LINE_SIZE, level, ti);
cache->associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti);
Expand Down

0 comments on commit d18f99c

Please sign in to comment.