aarch64: add get_cycles

borrowed from arch/arm64/include/asm/arch_timer.h

Change-Id: I489fb8346fbc7440f40695f01d80a89b90761165
This commit is contained in:
Eric Wild 2023-07-06 17:07:46 +02:00 committed by Harald Welte
parent ed469d82a0
commit 2d5fbe439b
2 changed files with 11 additions and 0 deletions

1
.checkpatch.conf Normal file
View File

@ -0,0 +1 @@
--ignore NEW_TYPEDEFS

View File

@ -103,6 +103,16 @@ static inline cycles_t get_cycles()
#endif
return ret & ~TICK_PRIV_BIT;
}
#elif defined(__aarch64__)
typedef unsigned long cycles_t;
static inline cycles_t get_cycles(void)
{
cycles_t cval;
asm volatile("isb" : : : "memory");
asm volatile("mrs %0, cntvct_el0" : "=r" (cval));
return cval;
}
#elif defined(__PPC__)
#define CPU_FTR_601 0x00000100
typedef unsigned long cycles_t;