]> git.karo-electronics.de Git - linux-beck.git/commitdiff
arm/arm64: arch_timer: Use archdata to indicate vdso suitability
authorScott Wood <oss@buserror.net>
Thu, 22 Sep 2016 08:35:18 +0000 (03:35 -0500)
committerWill Deacon <will.deacon@arm.com>
Fri, 23 Sep 2016 16:19:25 +0000 (17:19 +0100)
Instead of comparing the name to a magic string, use archdata to
explicitly communicate whether the arch timer is suitable for
direct vdso access.

Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Scott Wood <oss@buserror.net>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm/Kconfig
arch/arm/include/asm/clocksource.h [new file with mode: 0644]
arch/arm/kernel/vdso.c
arch/arm64/Kconfig
arch/arm64/include/asm/clocksource.h [new file with mode: 0644]
arch/arm64/kernel/vdso.c
drivers/clocksource/arm_arch_timer.c

index a9c4e48bb7ec997bec394066914d26f337a2fec4..b2113c24850c9809b398b440838d26743a0868ed 100644 (file)
@@ -1,6 +1,7 @@
 config ARM
        bool
        default y
+       select ARCH_CLOCKSOURCE_DATA
        select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_ELF_RANDOMIZE
diff --git a/arch/arm/include/asm/clocksource.h b/arch/arm/include/asm/clocksource.h
new file mode 100644 (file)
index 0000000..0b350a7
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _ASM_CLOCKSOURCE_H
+#define _ASM_CLOCKSOURCE_H
+
+struct arch_clocksource_data {
+       bool vdso_direct;       /* Usable for direct VDSO access? */
+};
+
+#endif
index 994e971a8538a2d316235ba1f61be54317fbba61..a0affd14086aabb7beea88e29606bd4bf5c9d41b 100644 (file)
@@ -270,7 +270,7 @@ static bool tk_is_cntvct(const struct timekeeper *tk)
        if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
                return false;
 
-       if (strcmp(tk->tkr_mono.clock->name, "arch_sys_counter") != 0)
+       if (!tk->tkr_mono.clock->archdata.vdso_direct)
                return false;
 
        return true;
index 0e11c8a2aec1bb9190597f507f19552cb8a9ba6f..8f868ec4e27f1e4d99eea8710bc20cd23baad69c 100644 (file)
@@ -4,6 +4,7 @@ config ARM64
        select ACPI_GENERIC_GSI if ACPI
        select ACPI_REDUCED_HARDWARE_ONLY if ACPI
        select ACPI_MCFG if ACPI
+       select ARCH_CLOCKSOURCE_DATA
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
        select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
diff --git a/arch/arm64/include/asm/clocksource.h b/arch/arm64/include/asm/clocksource.h
new file mode 100644 (file)
index 0000000..0b350a7
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _ASM_CLOCKSOURCE_H
+#define _ASM_CLOCKSOURCE_H
+
+struct arch_clocksource_data {
+       bool vdso_direct;       /* Usable for direct VDSO access? */
+};
+
+#endif
index 6225612f24640b9623335413b699e333470936b8..a2c2478e7d7896d568e7b9a04849f4adacb61fdf 100644 (file)
@@ -201,7 +201,7 @@ up_fail:
  */
 void update_vsyscall(struct timekeeper *tk)
 {
-       u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter");
+       u32 use_syscall = !tk->tkr_mono.clock->archdata.vdso_direct;
 
        ++vdso_data->tb_seq_count;
        smp_wmb();
index eb5fb4121ac84f52d2a5daaed033ff4288e5a5dd..73c487da6d2a9f0004043e23ff5e1e747672a065 100644 (file)
@@ -602,23 +602,18 @@ static void __init arch_counter_register(unsigned type)
                else
                        arch_timer_read_counter = arch_counter_get_cntpct;
 
+               clocksource_counter.archdata.vdso_direct = true;
+
 #ifdef CONFIG_FSL_ERRATUM_A008585
                /*
                 * Don't use the vdso fastpath if errata require using
                 * the out-of-line counter accessor.
                 */
                if (static_branch_unlikely(&arch_timer_read_ool_enabled))
-                       clocksource_counter.name = "arch_sys_counter_ool";
+                       clocksource_counter.archdata.vdso_direct = false;
 #endif
        } else {
                arch_timer_read_counter = arch_counter_get_cntvct_mem;
-
-               /* If the clocksource name is "arch_sys_counter" the
-                * VDSO will attempt to read the CP15-based counter.
-                * Ensure this does not happen when CP15-based
-                * counter is not available.
-                */
-               clocksource_counter.name = "arch_mem_counter";
        }
 
        start_count = arch_timer_read_counter();