Commit 1d8f51d4 authored by Scott Wood's avatar Scott Wood Committed by Will Deacon

arm/arm64: arch_timer: Use archdata to indicate vdso suitability

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: default avatarWill Deacon <will.deacon@arm.com>
Acked-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarScott Wood <oss@buserror.net>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent f6dc1576
config ARM config ARM
bool bool
default y default y
select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_ELF_RANDOMIZE
......
#ifndef _ASM_CLOCKSOURCE_H
#define _ASM_CLOCKSOURCE_H
struct arch_clocksource_data {
bool vdso_direct; /* Usable for direct VDSO access? */
};
#endif
...@@ -270,7 +270,7 @@ static bool tk_is_cntvct(const struct timekeeper *tk) ...@@ -270,7 +270,7 @@ static bool tk_is_cntvct(const struct timekeeper *tk)
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
return false; return false;
if (strcmp(tk->tkr_mono.clock->name, "arch_sys_counter") != 0) if (!tk->tkr_mono.clock->archdata.vdso_direct)
return false; return false;
return true; return true;
......
...@@ -4,6 +4,7 @@ config ARM64 ...@@ -4,6 +4,7 @@ config ARM64
select ACPI_GENERIC_GSI if ACPI select ACPI_GENERIC_GSI if ACPI
select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ACPI_REDUCED_HARDWARE_ONLY if ACPI
select ACPI_MCFG if ACPI select ACPI_MCFG if ACPI
select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
......
#ifndef _ASM_CLOCKSOURCE_H
#define _ASM_CLOCKSOURCE_H
struct arch_clocksource_data {
bool vdso_direct; /* Usable for direct VDSO access? */
};
#endif
...@@ -201,7 +201,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, ...@@ -201,7 +201,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
*/ */
void update_vsyscall(struct timekeeper *tk) 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; ++vdso_data->tb_seq_count;
smp_wmb(); smp_wmb();
......
...@@ -602,23 +602,18 @@ static void __init arch_counter_register(unsigned type) ...@@ -602,23 +602,18 @@ static void __init arch_counter_register(unsigned type)
else else
arch_timer_read_counter = arch_counter_get_cntpct; arch_timer_read_counter = arch_counter_get_cntpct;
clocksource_counter.archdata.vdso_direct = true;
#ifdef CONFIG_FSL_ERRATUM_A008585 #ifdef CONFIG_FSL_ERRATUM_A008585
/* /*
* Don't use the vdso fastpath if errata require using * Don't use the vdso fastpath if errata require using
* the out-of-line counter accessor. * the out-of-line counter accessor.
*/ */
if (static_branch_unlikely(&arch_timer_read_ool_enabled)) if (static_branch_unlikely(&arch_timer_read_ool_enabled))
clocksource_counter.name = "arch_sys_counter_ool"; clocksource_counter.archdata.vdso_direct = false;
#endif #endif
} else { } else {
arch_timer_read_counter = arch_counter_get_cntvct_mem; 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(); start_count = arch_timer_read_counter();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment