summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Lynch <nathan_lynch@mentor.com>2014-09-29 01:50:06 +0200
committerLuis Henriques <luis.henriques@canonical.com>2015-01-15 10:43:31 +0000
commit489f04a3b25ea8477c4f3b0d90c7ac706f2e2299 (patch)
tree2dd1eca408f4680f0ace0684a03b800c0929bf53
parentfb19a40576259d2674c1fd7bb42b2ff30754e431 (diff)
downloadlinux-stable-489f04a3b25ea8477c4f3b0d90c7ac706f2e2299.tar.gz
linux-stable-489f04a3b25ea8477c4f3b0d90c7ac706f2e2299.tar.bz2
linux-stable-489f04a3b25ea8477c4f3b0d90c7ac706f2e2299.zip
clocksource: arm_arch_timer: Change clocksource name if CP15 unavailable
commit 423bd69e69f565167ba14e2fe61df76c3c4a0d26 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: Nathan Lynch <nathan_lynch@mentor.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
-rw-r--r--drivers/clocksource/arm_arch_timer.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 5163ec13429d..c99afdf12e98 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -429,11 +429,19 @@ static void __init arch_counter_register(unsigned type)
u64 start_count;
/* 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;
- else
+ } 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();
clocksource_register_hz(&clocksource_counter, arch_timer_rate);
cyclecounter.mult = clocksource_counter.mult;