Add support for AArch32
[vpp.git] / vppinfra / vppinfra / cache.h
index 7ed7a1e..92e1e8c 100644 (file)
 
 #include <vppinfra/error_bootstrap.h>
 
-#ifdef __x86_64__
+/* 
+ * Allow CFLAGS to override the arch-specific cache line size 
+ */
+#ifndef CLIB_LOG2_CACHE_LINE_BYTES
+
+#if defined(__x86_64__) || defined(__ARM_ARCH_7A__)
 #define CLIB_LOG2_CACHE_LINE_BYTES 6
 #endif
 
+#ifdef __aarch64__
+#define CLIB_LOG2_CACHE_LINE_BYTES 7
+#endif
+
 /* Default cache line size of 32 bytes. */
 #ifndef CLIB_LOG2_CACHE_LINE_BYTES
 #define CLIB_LOG2_CACHE_LINE_BYTES 5
 #endif
 
+#endif /* CLIB_LOG2_CACHE_LINE_BYTES defined */
+
+#if (CLIB_LOG2_CACHE_LINE_BYTES >= 9)
+#error Cache line size 512 bytes or greater
+#endif
+
 #define CLIB_CACHE_LINE_BYTES (1 << CLIB_LOG2_CACHE_LINE_BYTES)
 #define CLIB_CACHE_LINE_ALIGN_MARK(mark) u8 mark[0] __attribute__((aligned(CLIB_CACHE_LINE_BYTES)))