[PATCH v2 0/3] Get cache information from userland
zong.li at sifive.com
Thu Aug 27 04:22:25 EDT 2020
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. We
exploit 'struct cacheinfo' to obtain the information of cache, then we
don't need additional variable or data structure to record it.
We also need some works in glibc, but we have to support the function in
kernel first by rule of glibc, then post the patch to glibc site.
The result of 'getconf -a' as follows:
Changed in v2:
- Add error checking for parsing cache properties.
Zong Li (3):
riscv: Set more data to cacheinfo
riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
riscv: Add cache information in AUX vector
arch/riscv/include/asm/cacheinfo.h | 5 ++
arch/riscv/include/asm/elf.h | 13 ++++
arch/riscv/include/uapi/asm/auxvec.h | 24 ++++++++
arch/riscv/kernel/cacheinfo.c | 91 +++++++++++++++++++++++-----
4 files changed, 117 insertions(+), 16 deletions(-)
More information about the linux-riscv