clocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion
[platform/kernel/linux-exynos.git] / drivers / clocksource / arm_arch_timer.c
index 8e308d7..a328d2c 100644 (file)
@@ -78,6 +78,7 @@ static bool arch_counter_suspend_stop;
 static bool vdso_default = true;
 
 static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
+static bool mct_enable = IS_ENABLED(CONFIG_CLKSRC_EXYNOS_MCT);
 
 static int __init early_evtstrm_cfg(char *buf)
 {
@@ -299,8 +300,7 @@ static u64 notrace arm64_858921_read_cntvct_el0(void)
 #endif
 
 #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
-DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *,
-              timer_unstable_counter_workaround);
+DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
 EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
 
 DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
@@ -1018,12 +1018,25 @@ static int __init arch_timer_register(void)
                goto out_unreg_notify;
 
 
-       /* Register and immediately configure the timer on the boot CPU */
-       err = cpuhp_setup_state(CPUHP_AP_ARM_ARCH_TIMER_STARTING,
-                               "clockevents/arm/arch_timer:starting",
-                               arch_timer_starting_cpu, arch_timer_dying_cpu);
-       if (err)
-               goto out_unreg_cpupm;
+       if (mct_enable) {
+               /*
+                * FIXME: The arm64 architecture enables the arm_arch_timer always
+                * even if arm_arch_timer is not stable. When Exynos5433 uses the
+                * arm_arch_timer, it fails to enable/disble the secondary cpu.
+                * To fix the hotplug issue of secondary cpu, if Exynos's MCT timer
+                * is enabled, arm_arch_timer doesn't register the clockevent
+                * for Per-CPU.
+                */
+               return 0;
+       } else {
+               /* Register and immediately configure the timer on the boot CPU */
+               err = cpuhp_setup_state(CPUHP_AP_ARM_ARCH_TIMER_STARTING,
+                                       "clockevents/arm/arch_timer:starting",
+                                       arch_timer_starting_cpu, arch_timer_dying_cpu);
+               if (err)
+                       goto out_unreg_cpupm;
+       }
+
        return 0;
 
 out_unreg_cpupm: