aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/include/asm/arch_timer.h4
-rw-r--r--drivers/clocksource/arm_arch_timer.c25
2 files changed, 7 insertions, 22 deletions
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index 4a06d46def7e..5502ea049b63 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -45,13 +45,9 @@
45 (__wa && __wa->h) ? __wa->h : arch_timer_##h; \ 45 (__wa && __wa->h) ? __wa->h : arch_timer_##h; \
46 }) 46 })
47 47
48extern struct static_key_false arch_timer_read_ool_enabled;
49#define needs_unstable_timer_counter_workaround() \
50 static_branch_unlikely(&arch_timer_read_ool_enabled)
51#else 48#else
52#define has_erratum_handler(h) false 49#define has_erratum_handler(h) false
53#define erratum_handler(h) (arch_timer_##h) 50#define erratum_handler(h) (arch_timer_##h)
54#define needs_unstable_timer_counter_workaround() false
55#endif 51#endif
56 52
57enum arch_timer_erratum_match_type { 53enum arch_timer_erratum_match_type {
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index b2a88a64aab4..8f22976247c0 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -365,8 +365,6 @@ static u32 notrace sun50i_a64_read_cntv_tval_el0(void)
365DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround); 365DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
366EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround); 366EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
367 367
368DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
369EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
370 368
371static void erratum_set_next_event_tval_generic(const int access, unsigned long evt, 369static void erratum_set_next_event_tval_generic(const int access, unsigned long evt,
372 struct clock_event_device *clk) 370 struct clock_event_device *clk)
@@ -538,12 +536,6 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
538 } 536 }
539 537
540 /* 538 /*
541 * Use the locked version, as we're called from the CPU
542 * hotplug framework. Otherwise, we end-up in deadlock-land.
543 */
544 static_branch_enable_cpuslocked(&arch_timer_read_ool_enabled);
545
546 /*
547 * Don't use the vdso fastpath if errata require using the 539 * Don't use the vdso fastpath if errata require using the
548 * out-of-line counter accessor. We may change our mind pretty 540 * out-of-line counter accessor. We may change our mind pretty
549 * late in the game (with a per-CPU erratum, for example), so 541 * late in the game (with a per-CPU erratum, for example), so
@@ -558,7 +550,7 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa
558static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type, 550static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type,
559 void *arg) 551 void *arg)
560{ 552{
561 const struct arch_timer_erratum_workaround *wa; 553 const struct arch_timer_erratum_workaround *wa, *__wa;
562 ate_match_fn_t match_fn = NULL; 554 ate_match_fn_t match_fn = NULL;
563 bool local = false; 555 bool local = false;
564 556
@@ -582,16 +574,13 @@ static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type t
582 if (!wa) 574 if (!wa)
583 return; 575 return;
584 576
585 if (needs_unstable_timer_counter_workaround()) { 577 __wa = __this_cpu_read(timer_unstable_counter_workaround);
586 const struct arch_timer_erratum_workaround *__wa; 578 if (__wa && wa != __wa)
587 __wa = __this_cpu_read(timer_unstable_counter_workaround); 579 pr_warn("Can't enable workaround for %s (clashes with %s\n)",
588 if (__wa && wa != __wa) 580 wa->desc, __wa->desc);
589 pr_warn("Can't enable workaround for %s (clashes with %s\n)",
590 wa->desc, __wa->desc);
591 581
592 if (__wa) 582 if (__wa)
593 return; 583 return;
594 }
595 584
596 arch_timer_enable_workaround(wa, local); 585 arch_timer_enable_workaround(wa, local);
597 pr_info("Enabling %s workaround for %s\n", 586 pr_info("Enabling %s workaround for %s\n",