From f57a3a31c8d074b309f797a4336101e4c1e5ed39 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 11 Feb 2022 06:58:12 -0700 Subject: [PATCH] Add aarch64 cpu clock support We can use cntvct_el0 to read the CPU clock. Signed-off-by: Jens Axboe --- arch/arch-aarch64.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arch-aarch64.h b/arch/arch-aarch64.h index 2a86cc5a..94571709 100644 --- a/arch/arch-aarch64.h +++ b/arch/arch-aarch64.h @@ -27,4 +27,21 @@ static inline int arch_ffz(unsigned long bitmask) #define ARCH_HAVE_FFZ +static inline unsigned long long get_cpu_clock(void) +{ + unsigned long val; + + asm volatile("mrs %0, cntvct_el0" : "=r" (val)); + return val; +} +#define ARCH_HAVE_CPU_CLOCK + +#define ARCH_HAVE_INIT +extern bool tsc_reliable; +static inline int arch_init(char *envp[]) +{ + tsc_reliable = true; + return 0; +} + #endif -- 2.25.1