ARM: vdso: Remove dependency with the arch_timer driver internals
authorMarc Zyngier <marc.zyngier@arm.com>
Mon, 8 Apr 2019 15:49:01 +0000 (16:49 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 30 Apr 2019 15:09:07 +0000 (16:09 +0100)
The VDSO code uses the kernel helper that was originally designed
to abstract the access between 32 and 64bit systems. It worked so
far because this function is declared as 'inline'.

As we're about to revamp that part of the code, the VDSO would
break. Let's fix it by doing what should have been done from
the start, a proper system register access.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/include/asm/cp15.h
arch/arm/vdso/vgettimeofday.c

index 07e27f2..d2453e2 100644 (file)
@@ -68,6 +68,8 @@
 #define BPIALL                         __ACCESS_CP15(c7, 0, c5, 6)
 #define ICIALLU                                __ACCESS_CP15(c7, 0, c5, 0)
 
+#define CNTVCT                         __ACCESS_CP15_64(1, c14)
+
 extern unsigned long cr_alignment;     /* defined in entry-armv.S */
 
 static inline unsigned long get_cr(void)
index a9dd619..7bdbf5d 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/compiler.h>
 #include <linux/hrtimer.h>
 #include <linux/time.h>
-#include <asm/arch_timer.h>
 #include <asm/barrier.h>
 #include <asm/bug.h>
+#include <asm/cp15.h>
 #include <asm/page.h>
 #include <asm/unistd.h>
 #include <asm/vdso_datapage.h>
@@ -123,7 +123,8 @@ static notrace u64 get_ns(struct vdso_data *vdata)
        u64 cycle_now;
        u64 nsec;
 
-       cycle_now = arch_counter_get_cntvct();
+       isb();
+       cycle_now = read_sysreg(CNTVCT);
 
        cycle_delta = (cycle_now - vdata->cs_cycle_last) & vdata->cs_mask;