From fef15b4bb88c61248393b93d13b1f79bb628def0 Mon Sep 17 00:00:00 2001 From: Christophe Fontaine Date: Sat, 9 Apr 2016 12:38:49 +0900 Subject: Add support for AArch32 gcc version 4.9.2 (Raspbian 4.9.2-10) Tested on Linux raspberrypi 4.4.6-v7+ #875 SMP Tue Apr 12 16:33:02 BST 2016 armv7l GNU/Linux CPUs may be little or big endian, detect with gcc flags, not the processor architecture Add a new flag $(PLATFORM)_uses_openssl which allows to disable the link with openssl lib. vlib/vlib/threads.c: startup.conf must: - specify the heapsize as we don't have hugepages on raspbian cpu { main-core 3 } heapsize 64M Corrects in various files the assumption uword == u64 and replaces 'u64' cast with 'pointer_to_uword' and 'uword_to_pointer' where appropriate. 256 CPUs may create an OOM when testing with small memory footprint ( heapsize 64M ), allows the number of VLIB_MAX_CPUS to be set in platforms/*.mk vppinfra/vppinfra/longjmp.S: ARM - copy r1 (1st parameter of the setjmp call) to r0 (return value) vppinfra/vppinfra/time.h: On ARMv7 in AArch32 mode, we can access to a 64bit register to retreive the cycles count. gcc on rpi only declare ARM_ARCH 6. Override this info, and check if it is possible to use 'mrrc'. /!\ the time function will NOT work without allowing the user mode access to the PMU. You may download the source of the kmod here: https://github.com/christophefontaine/arm_rdtsc Change-Id: I8142606436d9671a184133b935398427f08a8bd2 Signed-off-by: Christophe Fontaine --- vppinfra/vppinfra/byte_order.h | 2 +- vppinfra/vppinfra/cache.h | 2 +- vppinfra/vppinfra/hash.c | 4 ++-- vppinfra/vppinfra/hash.h | 2 -- vppinfra/vppinfra/longjmp.S | 4 ++-- vppinfra/vppinfra/macros.c | 2 +- vppinfra/vppinfra/random_isaac.c | 2 +- vppinfra/vppinfra/test_vec.c | 4 ++-- vppinfra/vppinfra/time.h | 10 +++++++++- vppinfra/vppinfra/vector.h | 2 +- 10 files changed, 20 insertions(+), 14 deletions(-) (limited to 'vppinfra') diff --git a/vppinfra/vppinfra/byte_order.h b/vppinfra/vppinfra/byte_order.h index 4f385f152df..b2c26e5fdee 100644 --- a/vppinfra/vppinfra/byte_order.h +++ b/vppinfra/vppinfra/byte_order.h @@ -40,7 +40,7 @@ #include -#if defined(__x86_64__) || defined(i386) || defined(__aarch64__) +#if (__BYTE_ORDER__)==( __ORDER_LITTLE_ENDIAN__) #define CLIB_ARCH_IS_BIG_ENDIAN (0) #define CLIB_ARCH_IS_LITTLE_ENDIAN (1) #else diff --git a/vppinfra/vppinfra/cache.h b/vppinfra/vppinfra/cache.h index fea111698a2..92e1e8cf777 100644 --- a/vppinfra/vppinfra/cache.h +++ b/vppinfra/vppinfra/cache.h @@ -45,7 +45,7 @@ */ #ifndef CLIB_LOG2_CACHE_LINE_BYTES -#ifdef __x86_64__ +#if defined(__x86_64__) || defined(__ARM_ARCH_7A__) #define CLIB_LOG2_CACHE_LINE_BYTES 6 #endif diff --git a/vppinfra/vppinfra/hash.c b/vppinfra/vppinfra/hash.c index 9e038b4fd8c..adadf010a0c 100644 --- a/vppinfra/vppinfra/hash.c +++ b/vppinfra/vppinfra/hash.c @@ -88,7 +88,7 @@ static inline u64 zap64 (u64 x, word n) return x & masks_little_endian[n]; } -u64 hash_memory64 (void * p, word n_bytes, u64 state) +static inline u64 hash_memory64 (void * p, word n_bytes, u64 state) { u64 * q = p; u64 a, b, c, n; @@ -155,7 +155,7 @@ static inline u32 zap32 (u32 x, word n) return x & masks_little_endian[n]; } -u32 hash_memory32 (void * p, word n_bytes, u32 state) +static inline u32 hash_memory32 (void * p, word n_bytes, u32 state) { u32 * q = p; u32 a, b, c, n; diff --git a/vppinfra/vppinfra/hash.h b/vppinfra/vppinfra/hash.h index 3c4daada48b..978230b6ca0 100644 --- a/vppinfra/vppinfra/hash.h +++ b/vppinfra/vppinfra/hash.h @@ -586,8 +586,6 @@ do { \ hash_v3_finalize_step_2_u32x(a,b,c); \ } while (0) -extern u64 hash_memory64 (void * p, word n_bytes, u64 state); -extern u32 hash_memory32 (void * p, word n_bytes, u32 state); extern uword hash_memory (void * p, word n_bytes, uword state); extern uword mem_key_sum (hash_t * h, uword key); diff --git a/vppinfra/vppinfra/longjmp.S b/vppinfra/vppinfra/longjmp.S index 9ba237d4489..d4dd4c7d916 100644 --- a/vppinfra/vppinfra/longjmp.S +++ b/vppinfra/vppinfra/longjmp.S @@ -478,7 +478,7 @@ clib_setjmp: #endif /* Give back user's return value. */ - mov r1, r0 + mov r0, r1 bx lr .global clib_longjmp @@ -501,7 +501,7 @@ clib_longjmp: #endif /* Give back user's return value. */ - mov r1, r0 + mov r0, r1 bx lr .global clib_calljmp diff --git a/vppinfra/vppinfra/macros.c b/vppinfra/vppinfra/macros.c index 4107464e99e..f16948ef0e4 100644 --- a/vppinfra/vppinfra/macros.c +++ b/vppinfra/vppinfra/macros.c @@ -214,7 +214,7 @@ void clib_macro_init(macro_main_t * mm) { if (mm->the_builtin_eval_hash != 0) { - clib_warning ("mm %llx already initialized", (u64)mm); + clib_warning ("mm %p already initialized", mm); return; } diff --git a/vppinfra/vppinfra/random_isaac.c b/vppinfra/vppinfra/random_isaac.c index e9287402e52..ad2c165da46 100644 --- a/vppinfra/vppinfra/random_isaac.c +++ b/vppinfra/vppinfra/random_isaac.c @@ -110,7 +110,7 @@ void isaac2 (isaac_t * ctx, uword * results) u32 a##n, b##n, c##n, x##n, y##n, * m##n, * mm##n, * m2##n, * r##n, * mend##n _ (0); _ (1); - + (void)mend1; /* "set but unused variable" error on mend1 with gcc 4.9 */ #undef _ #define _(n) \ diff --git a/vppinfra/vppinfra/test_vec.c b/vppinfra/vppinfra/test_vec.c index 12c0603ec8d..80832bf52fd 100644 --- a/vppinfra/vppinfra/test_vec.c +++ b/vppinfra/vppinfra/test_vec.c @@ -1050,7 +1050,7 @@ int test_vec_main (unformat_input_t * input) u8 * bigboy = 0; u64 one_gig = (1<<30); u64 size; - i64 index; + u64 index; fformat (stdout, "giant vector test..."); size = 5ULL * one_gig; @@ -1090,7 +1090,7 @@ int main (int argc, char * argv[]) unformat_input_t i; int ret; - mheap_alloc (0, 10ULL<<30); + mheap_alloc (0, (uword)10ULL<<30); verbose = (argc > 1); unformat_init_command_line (&i, argv); diff --git a/vppinfra/vppinfra/time.h b/vppinfra/vppinfra/time.h index 3c481082ced..29398f3baea 100644 --- a/vppinfra/vppinfra/time.h +++ b/vppinfra/vppinfra/time.h @@ -113,7 +113,14 @@ always_inline u64 clib_cpu_time_now (void) } #elif defined (__arm__) - +#if defined(__ARM_ARCH_7A__) +always_inline u64 clib_cpu_time_now (void) +{ + u64 tsc; + asm volatile("mrrc p15, 0, %Q0, %R0, c9" : "=r" (tsc)); + return tsc; +} +#else always_inline u64 clib_cpu_time_now (void) { u32 lo; @@ -121,6 +128,7 @@ always_inline u64 clib_cpu_time_now (void) : [lo] "=r" (lo)); return (u64) lo; } +#endif #elif defined (__xtensa__) diff --git a/vppinfra/vppinfra/vector.h b/vppinfra/vppinfra/vector.h index 84c52a2836d..a6f4111e88c 100644 --- a/vppinfra/vppinfra/vector.h +++ b/vppinfra/vppinfra/vector.h @@ -61,7 +61,7 @@ #define _vector_size(n) __attribute__ ((vector_size (n))) -#if defined (__aarch64__) +#if defined (__aarch64__) || defined (__arm__) typedef unsigned int u32x4 _vector_size (16); #endif -- cgit 1.2.3-korg