Commit 489f04a3 authored by Nathan Lynch's avatar Nathan Lynch Committed by Luis Henriques

clocksource: arm_arch_timer: Change clocksource name if CP15 unavailable

commit 423bd69e upstream.

The arm and arm64 VDSOs need CP15 access to the architected counter.
If this is unavailable (which is allowed by ARM v7), indicate this by
changing the clocksource name to "arch_mem_counter" before registering
the clocksource.

Suggested by Stephen Boyd.
Signed-off-by: default avatarNathan Lynch <nathan_lynch@mentor.com>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent fb19a405
...@@ -429,11 +429,19 @@ static void __init arch_counter_register(unsigned type) ...@@ -429,11 +429,19 @@ static void __init arch_counter_register(unsigned type)
u64 start_count; u64 start_count;
/* Register the CP15 based counter if we have one */ /* Register the CP15 based counter if we have one */
if (type & ARCH_CP15_TIMER) if (type & ARCH_CP15_TIMER) {
arch_timer_read_counter = arch_counter_get_cntvct; arch_timer_read_counter = arch_counter_get_cntvct;
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();
clocksource_register_hz(&clocksource_counter, arch_timer_rate); clocksource_register_hz(&clocksource_counter, arch_timer_rate);
cyclecounter.mult = clocksource_counter.mult; cyclecounter.mult = clocksource_counter.mult;
......
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