powerpc: add sysconf support for cache geometries

System Internals / glibc - Paul Clarke [us.ibm.com] - 9 June 2017 13:36 EDT

There is currently no "cross-platform" (x86 and POWER) support for determining the cacheline size.

This patch adds support to sysconf() to correctly report cacheline sizes based on the information in the auxilliary vector.

Thus, using sysconf() is a cross-platform (x86 and POWER) solution for determining cacheline sizes.

Support is added (on powerpc) for: _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_LINESIZE

- sysdeps/unix/sysv/linux/powerpc/sysconf.c: New file. Add powerpc-specific overrides for L1, L2, L3 CACHE_SIZEs, CACHE_ASSOCs, and CACHE_LINESIZEs, retrieving from auxv.
- sysdeps/unix/sysv/linux/powerpc/test-powerpc-linux-sysconf.c: New file. Invoke newly supported sysconf values for powerpc, and report results. If none are supported, report so.
- sysdeps/unix/sysv/linux/powerpc/Makefile (tests): Add new test, tst-sysconf.

cdfbe50 powerpc: add sysconf support for cache geometries
ChangeLog | 11 +++
sysdeps/unix/sysv/linux/powerpc/Makefile | 1 +
sysdeps/unix/sysv/linux/powerpc/sysconf.c | 96 ++++++++++++++++++++++
.../linux/powerpc/test-powerpc-linux-sysconf.c | 73 ++++++++++++++++
4 files changed, 181 insertions(+)

Upstream: sourceware.org


  • Share