OSDN Git Service

riscv: Add cache information in AUX vector
authorZong Li <zong.li@sifive.com>
Mon, 31 Aug 2020 07:33:50 +0000 (15:33 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Wed, 16 Sep 2020 01:46:08 +0000 (18:46 -0700)
commit38f5bd23deae24c8fa67a2c574b6d43df27a8aa8
tree5d0762eb60036e15eef0d2a79497e594ee88923f
parentb5fca7c55f9fbab5ad732c3bce00f31af6ba5cfa
riscv: Add cache information in AUX vector

There are no standard CSR registers to provide cache information, the
way for RISC-V is to get this information from DT. Currently, AT_L1I_X,
AT_L1D_X and AT_L2_X are present in glibc header, and sysconf syscall
could use them to get information of cache through AUX vector.

The result of 'getconf -a' as follows:
LEVEL1_ICACHE_SIZE                 32768
LEVEL1_ICACHE_ASSOC                8
LEVEL1_ICACHE_LINESIZE             64
LEVEL1_DCACHE_SIZE                 32768
LEVEL1_DCACHE_ASSOC                8
LEVEL1_DCACHE_LINESIZE             64
LEVEL2_CACHE_SIZE                  2097152
LEVEL2_CACHE_ASSOC                 32
LEVEL2_CACHE_LINESIZE              64

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/cacheinfo.h
arch/riscv/include/asm/elf.h
arch/riscv/include/uapi/asm/auxvec.h
arch/riscv/kernel/cacheinfo.c