diff options
Diffstat (limited to 'platform/linux-generic/m4/odp_cpu.m4')
-rw-r--r-- | platform/linux-generic/m4/odp_cpu.m4 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/platform/linux-generic/m4/odp_cpu.m4 b/platform/linux-generic/m4/odp_cpu.m4 new file mode 100644 index 000000000..35a83faf6 --- /dev/null +++ b/platform/linux-generic/m4/odp_cpu.m4 @@ -0,0 +1,35 @@ +########################################################################## +# Set ODP_CACHE_LINE_SIZE define +########################################################################## +# Currently used only for aarch64 +if test "${ARCH_DIR}" = "aarch64"; then + cache_line_size=64 + # Use default cache size if cross-compiling + if test $build = $host; then + cpu_implementer="" + cpu_part="" + + AC_PROG_GREP + AC_PROG_SED + while read line; do + if echo $line | $GREP -q "CPU implementer"; then + cpu_implementer=`echo $line | $SED 's/.*\:\s*//'` + fi + if echo $line | $GREP -q "CPU part"; then + cpu_part=`echo $line | $SED 's/.*\:\s*//'` + fi + done < /proc/cpuinfo + + # Cavium + if test "$cpu_implementer" == "0x43"; then + # ThunderX2 (0x0af) 64B, others 128B + if test "$cpu_part" == "0x0af"; then + cache_line_size=64; + else + cache_line_size=128; + fi + fi + fi + AC_DEFINE_UNQUOTED([_ODP_CACHE_LINE_SIZE], [$cache_line_size], + [Define cache line size]) +fi |