clocksource/drivers/exynos_mct: Increase priority over ARM arch timer [Linux 4.9.187]

This Linux kernel change "clocksource/drivers/exynos_mct: Increase priority over ARM arch timer" is included in the Linux 4.9.187 release. This change is authored by Marek Szyprowski <m.szyprowski [at]> on Thu May 30 12:50:43 2019 +0200. The commit for this change in Linux stable tree is df5b058 (patch) which is from upstream commit 6282edb. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 6282edb.

clocksource/drivers/exynos_mct: Increase priority over ARM arch timer

[ Upstream commit 6282edb72bed5324352522d732080d4c1b9dfed6 ]

Exynos SoCs based on CA7/CA15 have 2 timer interfaces: custom Exynos MCT
(Multi Core Timer) and standard ARM Architected Timers.

There are use cases, where both timer interfaces are used simultanously.
One of such examples is using Exynos MCT for the main system timer and
ARM Architected Timers for the KVM and virtualized guests (KVM requires
arch timers).

Exynos Multi-Core Timer driver (exynos_mct) must be however started
before ARM Architected Timers (arch_timer), because they both share some
common hardware blocks (global system counter) and turning on MCT is
needed to get ARM Architected Timer working properly.

To ensure selecting Exynos MCT as the main system timer, increase MCT
timer rating. To ensure proper starting order of both timers during
suspend/resume cycle, increase MCT hotplug priority over ARM Archictected

Signed-off-by: Marek Szyprowski <>
Reviewed-by: Krzysztof Kozlowski <>
Reviewed-by: Chanwoo Choi <>
Signed-off-by: Daniel Lezcano <>
Signed-off-by: Sasha Levin <>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/clocksource/exynos_mct.c | 4 ++--
 include/linux/cpuhotplug.h       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index fb0cf8b..d32248e 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -211,7 +211,7 @@ static void exynos4_frc_resume(struct clocksource *cs)

 static struct clocksource mct_frc = {
    .name       = "mct-frc",
-   .rating     = 400,
+   .rating     = 450,  /* use value higher than ARM arch timer */
    .read       = exynos4_frc_read,
    .mask       = CLOCKSOURCE_MASK(32),
@@ -466,7 +466,7 @@ static int exynos4_mct_starting_cpu(unsigned int cpu)
    evt->set_state_oneshot_stopped = set_state_shutdown;
    evt->tick_resume = set_state_shutdown;
-   evt->rating = 450;
+   evt->rating = 500;  /* use value higher than ARM arch timer */

    exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);

diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index c9447a6..1ab0273 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -77,10 +77,10 @@ enum cpuhp_state {

Leave a Reply

Your email address will not be published. Required fields are marked *