Skip to contentSkip to conversation

Add module support for Arm64 Exynos MCT driver

PATCH Superseded Will McVicker 5 participants 25 messages Mar 31, 2025 – Apr 3, 2025

Subsystems (6)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover Add module support for Arm64 Exynos MCT driver

This series adds support to build the Arm64 Exynos MCT driver as a module. This is only possible on Arm64 SoCs since they can use the Arm architected timer as the clocksource. Once the Exynos MCT module is loaded and the device probes, the MCT driver is used as the wakeup source for the arch_timer.

These patches are originally from the downstream Pixel 6 (gs101) kernel found at [1] and have been adapted for upstream. Not only has the Exynos MCT driver been shipping as a module in the field with Android, but I've also tested this seris with the upstream kernel on my Pixel 6 Pro.

Thanks,
Will

Note1, instructions to build and flash a Pixel 6 device with the upstream kernel can be found at [2].

Note2, this series is based off of linux-next/master commit 405e2241def8 ("Add linux-next specific files for 20250331").

[1] https://android.googlesource.com/kernel/gs/+log/refs/heads/android-gs-raviole-5.10-android12-d1
[2] https://git.codelinaro.org/linaro/googlelt/pixelscripts/-/blob/clo/main/README.md?ref_type=heads

Donghoon Yu (1):
clocksource/drivers/exynos_mct: Add module support

Hosung Kim (1):
clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

Will Deacon (1):
arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Will McVicker (3):
of/irq: Export of_irq_count for modules clocksource/drivers/exynos_mct: Don't register as a sched_clock on

    arm64

arm64: exynos: Drop select CLKSRC_EXYNOS_MCT

 arch/arm64/Kconfig.platforms                 |  1 -
 arch/arm64/boot/dts/exynos/google/gs101.dtsi |  3 ++
 drivers/clocksource/Kconfig                  |  3 +-
 drivers/clocksource/exynos_mct.c             | 55 ++++++++++++++++----
 drivers/of/irq.c                             |  1 +
 5 files changed, 51 insertions(+), 12 deletions(-)
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
#1 lore raw

PATCH 1/6 of/irq: Export of_irq_count for modules

Need to export of_irq_count in preparation for modularizing the Exynos MCT driver which uses this API for setting up the timer IRQs.

---
 drivers/of/irq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/of/irq.c +1 -0
index f8ad79b9b1c9..5adda1dac3cf 100644
@@ -519,6 +519,7 @@ int of_irq_count(struct device_node *dev)
 
 	return nr;
 }
+EXPORT_SYMBOL_GPL(of_irq_count);
 
 /**
  * of_irq_to_resource_table - Fill in resource table with node's IRQ info
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
#3 lore raw

PATCH 2/6 clocksource/drivers/exynos_mct: Don't register as a sched_clock on arm64

In reply to Will McVicker

When using the Exynos MCT as a sched_clock, accessing the timer value via the MCT register is extremely slow. To improve performance on Arm64 SoCs, use the Arm architected timer instead for timekeeping.

Note, ARM32 SoCs don't have an architectured timer and therefore will continue to use the MCT timer. Detailed discussion on this topic can be found at [1].

[1] https://lore.kernel.org/all/[email protected]/

[Original commit from https://android.googlesource.com/kernel/gs/+/630817f7080e92c5e0216095ff52f6eb8dd00727

---
 drivers/clocksource/exynos_mct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/exynos_mct.c +3 -2
index da09f467a6bb..05c50f2f7a7e 100644
@@ -219,12 +219,12 @@ static struct clocksource mct_frc = {
 	.resume		= exynos4_frc_resume,
 };
 
+#if defined(CONFIG_ARM)
 static u64 notrace exynos4_read_sched_clock(void)
 {
 	return exynos4_read_count_32();
 }
 
-#if defined(CONFIG_ARM)
 static struct delay_timer exynos4_delay_timer;
 
 static cycles_t exynos4_read_current_timer(void)
@@ -250,12 +250,13 @@ static int __init exynos4_clocksource_init(bool frc_shared)
 	exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
 	exynos4_delay_timer.freq = clk_rate;
 	register_current_timer_delay(&exynos4_delay_timer);
+
+	sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 #endif
 
 	if (clocksource_register_hz(&mct_frc, clk_rate))
 		panic("%s: can't register clocksource\n", mct_frc.name);
 
-	sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 
 	return 0;
 }
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
#4 lore raw

Re: [PATCH v1 2/6] clocksource/drivers/exynos_mct: Don't register as a sched_clock on arm64

Quoted 4 lines · Will McVicker' via kernel-team

When using the Exynos MCT as a sched_clock, accessing the timer value via the MCT register is extremely slow. To improve performance on Arm64 SoCs, use the Arm architected timer instead for timekeeping.

This probably needs some further expansion to explain why we don't want to use it for sched_clock but continue to register the MCT as a clocksource (ie: why not disable MCT entirely?).

Quoted 5 lines

Note, ARM32 SoCs don't have an architectured timer and therefore will continue to use the MCT timer. Detailed discussion on this topic can be found at [1].

[1] https://lore.kernel.org/all/[email protected]/

That's a pretty deep thread (more so with the duplicate messages, as you used the "all" instead of a specific list). It might be good to have a bit more of a summary here in the commit message, so folks don't have to dig too deeply themselves.

Quoted 13 lines

[Original commit from https://android.googlesource.com/kernel/gs/+/630817f7080e92c5e0216095ff52f6eb8dd00727

---
 drivers/clocksource/exynos_mct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/exynos_mct.c +0 -0
index da09f467a6bb..05c50f2f7a7e 100644

drivers/clocksource/exynos_mct.c static struct clocksource mct_frc = { · line 222

Quoted 4 lines
drivers/clocksource/exynos_mct.c +1 -0
@@ -219,12 +219,12 @@ static struct clocksource mct_frc = {
        .resume         = exynos4_frc_resume,
 };
 
+#if defined(CONFIG_ARM)

I'd probably suggest adding a comment here explaining why this is kept on ARM and not on AARCH64 as well.

Quoted 13 lines
drivers/clocksource/exynos_mct.c +0 -1
 static u64 notrace exynos4_read_sched_clock(void)
 {
        return exynos4_read_count_32();
 }
 
-#if defined(CONFIG_ARM)
 static struct delay_timer exynos4_delay_timer;
 
 static cycles_t exynos4_read_current_timer(void)
@@ -250,12 +250,13 @@ static int __init exynos4_clocksource_init(bool frc_shared)
        exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
        exynos4_delay_timer.freq = clk_rate;
        register_current_timer_delay(&exynos4_delay_timer);

drivers/clocksource/exynos_mct.c static int __init exynos4_clocksource_init(bool frc_shared) · line 261

Quoted 10 lines
drivers/clocksource/exynos_mct.c +2 -1
+
+       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 #endif
 
        if (clocksource_register_hz(&mct_frc, clk_rate))
                panic("%s: can't register clocksource\n", mct_frc.name);
 
-       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 
        return 0;

Otherwise, this looks ok to me.

thanks
-john

#5 lore raw

Re: [PATCH v1 2/6] clocksource/drivers/exynos_mct: Don't register as a sched_clock on arm64

Quoted 10 lines · John Stultz
Quoted 4 lines · Will McVicker' via kernel-team

When using the Exynos MCT as a sched_clock, accessing the timer value via the MCT register is extremely slow. To improve performance on Arm64 SoCs, use the Arm architected timer instead for timekeeping.

This probably needs some further expansion to explain why we don't want to use it for sched_clock but continue to register the MCT as a clocksource (ie: why not disable MCT entirely?).

Using the MCT as a sched_clock was originally added for Exynos4 SoCs to improve the gettimeofday() syscalls on ChromeOS. For ARM32 this is the best they can do without the Arm architected timer. ChromeOS perf data can be found in [1,2]

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

I think it's valid to still register the MCT as a clocksource to make it available in case someone decides they want to use it, but by default it doesn't make sense to use it as the default clocksource on Exynos-based ARM64 systems with arch_timer support. However, we can't disable the Exynos MCT entirely on ARM64 because we need it as the wakeup source for the arch_timer to support waking up from the "c2" idle state, which is discussed in [3].

[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 11 lines
Quoted 6 lines

Note, ARM32 SoCs don't have an architectured timer and therefore will continue to use the MCT timer. Detailed discussion on this topic can be found at [1].

[1] https://lore.kernel.org/all/[email protected]/

That's a pretty deep thread (more so with the duplicate messages, as you used the "all" instead of a specific list). It might be good to have a bit more of a summary here in the commit message, so folks don't have to dig too deeply themselves.

Ah, sorry about the bad link. The above points should be a good summary of that conversation with regards to this patch.

Quoted 17 lines
Quoted 17 lines

[Original commit from https://android.googlesource.com/kernel/gs/+/630817f7080e92c5e0216095ff52f6eb8dd00727

---
 drivers/clocksource/exynos_mct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/exynos_mct.c +0 -0
index da09f467a6bb..05c50f2f7a7e 100644
@@ -219,12 +219,12 @@ static struct clocksource mct_frc = {
        .resume         = exynos4_frc_resume,
 };
 
Quoted 4 lines

drivers/clocksource/exynos_mct.c static struct clocksource mct_frc = { · line 222

Quoted 1 line
drivers/clocksource/exynos_mct.c +1 -0
+#if defined(CONFIG_ARM)

I'd probably suggest adding a comment here explaining why this is kept on ARM and not on AARCH64 as well.

Sure, I can add my comments above here in v2.

Quoted 21 lines
Quoted 21 lines
drivers/clocksource/exynos_mct.c +2 -1
 static u64 notrace exynos4_read_sched_clock(void)
 {
        return exynos4_read_count_32();
 }
 
-#if defined(CONFIG_ARM)
 static struct delay_timer exynos4_delay_timer;
 
 static cycles_t exynos4_read_current_timer(void)
@@ -250,12 +250,13 @@ static int __init exynos4_clocksource_init(bool frc_shared)
        exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
        exynos4_delay_timer.freq = clk_rate;
        register_current_timer_delay(&exynos4_delay_timer);
+
+       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 #endif
 
        if (clocksource_register_hz(&mct_frc, clk_rate))
                panic("%s: can't register clocksource\n", mct_frc.name);
 
Quoted 8 lines

drivers/clocksource/exynos_mct.c static int __init exynos4_clocksource_init(bool frc_shared) · line 261

Quoted 3 lines
drivers/clocksource/exynos_mct.c +0 -1
-       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 
        return 0;

Otherwise, this looks ok to me.

thanks
-john

Thanks for taking the time to review!

Regards,
Will

Reviewed-by
#6 lore raw

Re: [PATCH v1 2/6] clocksource/drivers/exynos_mct: Don't register as a sched_clock on arm64

Hi Will.

I'm really glad to see our work on Pixel being upstreamed.

Quoted 19 lines · William McVicker
Quoted 10 lines · John Stultz
Quoted 4 lines · Will McVicker' via kernel-team

When using the Exynos MCT as a sched_clock, accessing the timer value via the MCT register is extremely slow. To improve performance on Arm64 SoCs, use the Arm architected timer instead for timekeeping.

This probably needs some further expansion to explain why we don't want to use it for sched_clock but continue to register the MCT as a clocksource (ie: why not disable MCT entirely?).

Using the MCT as a sched_clock was originally added for Exynos4 SoCs to improve the gettimeofday() syscalls on ChromeOS. For ARM32 this is the best they can do without the Arm architected timer. ChromeOS perf data can be found in [1,2]

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

Quoted 9 lines

I think it's valid to still register the MCT as a clocksource to make it available in case someone decides they want to use it, but by default it doesn't make sense to use it as the default clocksource on Exynos-based ARM64 systems with arch_timer support. However, we can't disable the Exynos MCT entirely on ARM64 because we need it as the wakeup source for the arch_timer to support waking up from the "c2" idle state, which is discussed in [3].

[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Exactly right.

Quoted 66 lines
Quoted 11 lines
Quoted 6 lines

Note, ARM32 SoCs don't have an architectured timer and therefore will continue to use the MCT timer. Detailed discussion on this topic can be found at [1].

[1] https://lore.kernel.org/all/[email protected]/

That's a pretty deep thread (more so with the duplicate messages, as you used the "all" instead of a specific list). It might be good to have a bit more of a summary here in the commit message, so folks don't have to dig too deeply themselves.

Ah, sorry about the bad link. The above points should be a good summary of that conversation with regards to this patch.

Quoted 17 lines
Quoted 17 lines

[Original commit from https://android.googlesource.com/kernel/gs/+/630817f7080e92c5e0216095ff52f6eb8dd00727

---
 drivers/clocksource/exynos_mct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/exynos_mct.c +0 -0
index da09f467a6bb..05c50f2f7a7e 100644
@@ -219,12 +219,12 @@ static struct clocksource mct_frc = {
        .resume         = exynos4_frc_resume,
 };
 
Quoted 4 lines

drivers/clocksource/exynos_mct.c static struct clocksource mct_frc = { · line 222

Quoted 1 line
drivers/clocksource/exynos_mct.c +1 -0
+#if defined(CONFIG_ARM)

I'd probably suggest adding a comment here explaining why this is kept on ARM and not on AARCH64 as well.

Sure, I can add my comments above here in v2.

Quoted 27 lines
Quoted 14 lines
drivers/clocksource/exynos_mct.c +0 -1
 static u64 notrace exynos4_read_sched_clock(void)
 {
        return exynos4_read_count_32();
 }
 
-#if defined(CONFIG_ARM)
 static struct delay_timer exynos4_delay_timer;
 
 static cycles_t exynos4_read_current_timer(void)
@@ -250,12 +250,13 @@ static int __init exynos4_clocksource_init(bool frc_shared)
        exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
        exynos4_delay_timer.freq = clk_rate;
        register_current_timer_delay(&exynos4_delay_timer);

drivers/clocksource/exynos_mct.c static int __init exynos4_clocksource_init(bool frc_shared) · line 261

Quoted 10 lines
drivers/clocksource/exynos_mct.c +2 -1
+
+       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 #endif
 
        if (clocksource_register_hz(&mct_frc, clk_rate))
                panic("%s: can't register clocksource\n", mct_frc.name);
 
-       sched_clock_register(exynos4_read_sched_clock, 32, clk_rate);
 
        return 0;

Otherwise, this looks ok to me.

Quoted 8 lines
Quoted 2 lines

thanks
-john

Thanks for taking the time to review!

Regards,
Will

Along with John's comment,

#7 lore raw

PATCH 3/6 clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

In reply to Will McVicker

From: Hosung Kim <[email protected]>

The MCT local timers can be used as a per-cpu event timer. To prevent the timer interrupts from migrating to other CPUs, set the flag IRQF_PERCPU.

[Original commit from https://android.googlesource.com/kernel/gs/+/03267fad19f093bac979ca78309483e9eb3a8d16]
---
 drivers/clocksource/exynos_mct.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clocksource/exynos_mct.c +2 -1
index 05c50f2f7a7e..21ded37137d7 100644
@@ -590,7 +590,8 @@ static int __init exynos4_timer_interrupts(struct device_node *np,
 			irq_set_status_flags(mct_irq, IRQ_NOAUTOEN);
 			if (request_irq(mct_irq,
 					exynos4_mct_tick_isr,
-					IRQF_TIMER | IRQF_NOBALANCING,
+					IRQF_TIMER | IRQF_NOBALANCING |
+					IRQF_PERCPU,
 					pcpu_mevt->name, pcpu_mevt)) {
 				pr_err("exynos-mct: cannot register IRQ (cpu%d)\n",
 									cpu);
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
#8 lore raw

Re: [PATCH v1 3/6] clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

Quoted 4 lines · Will McVicker' via kernel-team

From: Hosung Kim <[email protected]>

The MCT local timers can be used as a per-cpu event timer. To prevent

Can be used, or are used? If it's an option, is this change important in both cases?

Quoted 2 lines

the timer interrupts from migrating to other CPUs, set the flag IRQF_PERCPU.

Might be work expanding this a bit to clarify why the interrupts migrating to other cpus is undesired.

Quoted 3 lines
[Original commit from https://android.googlesource.com/kernel/gs/+/03267fad19f093bac979ca78309483e9eb3a8d16]

thanks!
-john

#9 lore raw

Re: [PATCH v1 3/6] clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

Quoted 7 lines · John Stultz
Quoted 4 lines · Will McVicker' via kernel-team

From: Hosung Kim <[email protected]>

The MCT local timers can be used as a per-cpu event timer. To prevent

Quoted 8 lines

Can be used, or are used? If it's an option, is this change important in both cases?

Quoted 2 lines

the timer interrupts from migrating to other CPUs, set the flag IRQF_PERCPU.

Might be work expanding this a bit to clarify why the interrupts migrating to other cpus is undesired.

Let me dig into this further to figure out if the IP has a limitation where the interrupts need to be handled by the CPU the timer was triggered on or if this is just an optimization.

Any chance you know this @Youngmin?

Thanks,
Will

Quoted 7 lines
Quoted 4 lines
[Original commit from https://android.googlesource.com/kernel/gs/+/03267fad19f093bac979ca78309483e9eb3a8d16]

thanks!
-john

#10 lore raw

Re: [PATCH v1 3/6] clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

Quoted 17 lines · William McVicker
Quoted 7 lines · John Stultz
Quoted 4 lines · Will McVicker' via kernel-team

From: Hosung Kim <[email protected]>

The MCT local timers can be used as a per-cpu event timer. To prevent

Quoted 8 lines

Can be used, or are used? If it's an option, is this change important in both cases?

Quoted 2 lines

the timer interrupts from migrating to other CPUs, set the flag IRQF_PERCPU.

Might be work expanding this a bit to clarify why the interrupts migrating to other cpus is undesired.

Quoted 9 lines

Let me dig into this further to figure out if the IP has a limitation where the interrupts need to be handled by the CPU the timer was triggered on or if this is just an optimization.

Any chance you know this @Youngmin?

Thanks,
Will

Hi Will.

Yes. In downstream, we’ve been using MCT as the clock event timer instead of the ARM timer. Setting this flag allows each CPU to handle its own clock events, such as scheduling interrupts.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
[Original commit from https://android.googlesource.com/kernel/gs/+/03267fad19f093bac979ca78309483e9eb3a8d16]

thanks!
-john

#11 lore raw

Re: [PATCH v1 3/6] clocksource/drivers/exynos_mct: Set local timer interrupts as percpu

Quoted 24 lines · Youngmin Nam
Quoted 23 lines · William McVicker
Quoted 7 lines · John Stultz
Quoted 4 lines · Will McVicker' via kernel-team

From: Hosung Kim <[email protected]>

The MCT local timers can be used as a per-cpu event timer. To prevent

Quoted 8 lines

Can be used, or are used? If it's an option, is this change important in both cases?

Quoted 2 lines

the timer interrupts from migrating to other CPUs, set the flag IRQF_PERCPU.

Might be work expanding this a bit to clarify why the interrupts migrating to other cpus is undesired.

Let me dig into this further to figure out if the IP has a limitation where the interrupts need to be handled by the CPU the timer was triggered on or if this is just an optimization.

Any chance you know this @Youngmin?

Quoted 8 lines
Quoted 3 lines

Thanks,
Will

Hi Will.

Yes. In downstream, we’ve been using MCT as the clock event timer instead of the ARM timer. Setting this flag allows each CPU to handle its own clock events, such as scheduling interrupts.

Thanks for the explanation! I'll integrate this into the commit text.

Regards,
Will

Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
[Original commit from https://android.googlesource.com/kernel/gs/+/03267fad19f093bac979ca78309483e9eb3a8d16]

thanks!
-john

#12 lore raw

PATCH 4/6 arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

In reply to Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
#13 lore raw

Re: [PATCH v1 4/6] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Quoted 45 lines · Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog

Hi Will.

Are you using this property in production?
If so, have you noticed any performance improvements?

Thanks.
Youngmin

#14 lore raw

Re: [PATCH v1 4/6] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Hi Youngmin,

Quoted 48 lines · Youngmin Nam
Quoted 45 lines · Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog

Hi Will.

Quoted 2 lines

Are you using this property in production?
If so, have you noticed any performance improvements?

On Pixel 6, I have only recently switched to using the arch_timer as the default clocksource. I haven't noticed any major perf improvements to the main benchmarks, but also haven't seen any regressions. Based on the ChromeOS perf analysis in [1,2], there was a significant perf difference found.

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

If it helps, I found that Pixel 8 and 9 devices (didn't check Pixel 7) are already using the arch_timer with this 'local-timer-stop' as the default clocksource in the production kernel.

Thanks,
Will

[...]

#15 lore raw

Re: [PATCH v1 4/6] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Quoted 62 lines · William McVicker

Hi Youngmin,

Quoted 48 lines · Youngmin Nam
Quoted 45 lines · Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog

Hi Will.

Quoted 2 lines

Are you using this property in production?
If so, have you noticed any performance improvements?

On Pixel 6, I have only recently switched to using the arch_timer as the default clocksource. I haven't noticed any major perf improvements to the main benchmarks, but also haven't seen any regressions. Based on the ChromeOS perf analysis in [1,2], there was a significant perf difference found.

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

Quoted 9 lines

If it helps, I found that Pixel 8 and 9 devices (didn't check Pixel 7) are already using the arch_timer with this 'local-timer-stop' as the default clocksource in the production kernel.

Thanks,
Will

[...]

Hi Will,

Thanks for sharing the status of Pixel devices.

I agree that using the arch_timer as a clock source device brings significant benefits. The links you shared are definitely related to that.

However, I would also like to know whether arch_timer is used as a clock event device in Pixel production.

Thanks,
Youngmin

#16 lore raw

Re: [PATCH v1 4/6] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Quoted 73 lines · Youngmin Nam
Quoted 62 lines · William McVicker

Hi Youngmin,

Quoted 48 lines · Youngmin Nam
Quoted 45 lines · Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog

Hi Will.

Quoted 2 lines

Are you using this property in production?
If so, have you noticed any performance improvements?

On Pixel 6, I have only recently switched to using the arch_timer as the default clocksource. I haven't noticed any major perf improvements to the main benchmarks, but also haven't seen any regressions. Based on the ChromeOS perf analysis in [1,2], there was a significant perf difference found.

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

Quoted 9 lines

If it helps, I found that Pixel 8 and 9 devices (didn't check Pixel 7) are already using the arch_timer with this 'local-timer-stop' as the default clocksource in the production kernel.

Thanks,
Will

[...]

Quoted 8 lines

Hi Will,

Thanks for sharing the status of Pixel devices.

I agree that using the arch_timer as a clock source device brings significant benefits. The links you shared are definitely related to that.

However, I would also like to know whether arch_timer is used as a clock event device in Pixel production.

For Pixel 8 and 9, the arch_timer is used as both the clocksource and clockevent device which is what my series is proposing for Pixel 6 upstream. The MCT device is solely being used as the alternative clockevents device for waking up from the "c2" state. The reason for using the arch_timer as the clockevents device is because we were seeing hrtimer stability issues where a 10ms interval timer would delay about 300ms-1s before starting the callback. This resulted in several media-related latency issues.

Thanks,
Will

[...]

#17 lore raw

Re: [PATCH v1 4/6] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes

Quoted 91 lines · William McVicker
Quoted 73 lines · Youngmin Nam
Quoted 62 lines · William McVicker

Hi Youngmin,

Quoted 48 lines · Youngmin Nam
Quoted 45 lines · Will McVicker

From: Will Deacon <[email protected]>

In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state.

[Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c]
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/exynos/google/gs101.dtsi +3 -0
index 3de3a758f113..fd0badf24e6f 100644
@@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <70>;
 				exit-latency-us = <160>;
 				min-residency-us = <2000>;
@@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <150>;
 				exit-latency-us = <190>;
 				min-residency-us = <2500>;
@@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep {
 				idle-state-name = "c2";
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x0010000>;
+				local-timer-stop;
 				entry-latency-us = <235>;
 				exit-latency-us = <220>;
 				min-residency-us = <3500>;
Signature · 1 line
2.49.0.472.ge94155a9ec-goog

Hi Will.

Quoted 2 lines

Are you using this property in production?
If so, have you noticed any performance improvements?

On Pixel 6, I have only recently switched to using the arch_timer as the default clocksource. I haven't noticed any major perf improvements to the main benchmarks, but also haven't seen any regressions. Based on the ChromeOS perf analysis in [1,2], there was a significant perf difference found.

[1] https://lore.kernel.org/linux-samsung-soc/CAJFHJrrgWGc4XGQB0ysLufAg3Wouz-aYXu97Sy2Kp=HzK+akVQ@mail.gmail.com/
[2] https://lore.kernel.org/linux-samsung-soc/CAASgrz2Nr69tpfC8ka9gbs2OvjLEGsvgAj4vBCFxhsamuFum7w@mail.gmail.com/

Quoted 9 lines

If it helps, I found that Pixel 8 and 9 devices (didn't check Pixel 7) are already using the arch_timer with this 'local-timer-stop' as the default clocksource in the production kernel.

Thanks,
Will

[...]

Quoted 8 lines

Hi Will,

Thanks for sharing the status of Pixel devices.

I agree that using the arch_timer as a clock source device brings significant benefits. The links you shared are definitely related to that.

However, I would also like to know whether arch_timer is used as a clock event device in Pixel production.

For Pixel 8 and 9, the arch_timer is used as both the clocksource and clockevent device which is what my series is proposing for Pixel 6 upstream. The MCT device is solely being used as the alternative clockevents device for waking up from the "c2" state. The reason for using the arch_timer as the clockevents device is because we were seeing hrtimer stability issues where a 10ms interval timer would delay about 300ms-1s before starting the callback. This resulted in several media-related latency issues.

Quoted 5 lines

Thanks,
Will

[...]

Thank you for sharing your valuable experience. That will be helpful to us.

Thanks,
Youngmin

#18 lore raw

PATCH 5/6 clocksource/drivers/exynos_mct: Add module support

In reply to Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)
drivers/clocksource/Kconfig +2 -1
index 487c85259967..e5d9d8383607 100644
@@ -443,7 +443,8 @@ config ATMEL_TCB_CLKSRC
 	  Support for Timer Counter Blocks on Atmel SoCs.
 
 config CLKSRC_EXYNOS_MCT
-	bool "Exynos multi core timer driver" if COMPILE_TEST
+	tristate "Exynos multi core timer driver"
+	default y if ARCH_EXYNOS
 	depends on ARM || ARM64
 	depends on ARCH_ARTPEC || ARCH_EXYNOS || COMPILE_TEST
 	help
drivers/clocksource/exynos_mct.c +40 -7

92 lines not on this page · raw message

Signature · 1 line
2.49.0.472.ge94155a9ec-goog
maintainer
#19 lore raw

Re: [PATCH v1 5/6] clocksource/drivers/exynos_mct: Add module support

Quoted 15 lines · Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)

[...]

drivers/clocksource/exynos_mct.c static int __init mct_init_dt(struct device_node *np, unsigned int int_type) · line 708

Quoted 6 lines
drivers/clocksource/exynos_mct.c +6 -0
+#ifdef MODULE
+static int exynos4_mct_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (of_machine_is_compatible("samsung,exynos4412-mct"))

Your root node compatible has "samsung,exynos4412-mct"!?

In any case, add a data ptr to of_device_id table and then use the match data rather than comparing compatible strings again.

Quoted 11 lines
drivers/clocksource/exynos_mct.c +11 -0
+		return mct_init_ppi(np);
+
+	return mct_init_spi(np);
+}
+
+static const struct of_device_id exynos4_mct_match_table[] = {
+	{ .compatible = "samsung,exynos4210-mct" },
+	{ .compatible = "samsung,exynos4412-mct" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, exynos4_mct_match_table);
#20 lore raw

Re: [PATCH v1 5/6] clocksource/drivers/exynos_mct: Add module support

Quoted 28 lines · Rob Herring
Quoted 15 lines · Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)

[...]

drivers/clocksource/exynos_mct.c static int __init mct_init_dt(struct device_node *np, unsigned int int_type) · line 708

Quoted 6 lines
drivers/clocksource/exynos_mct.c +6 -0
+#ifdef MODULE
+static int exynos4_mct_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (of_machine_is_compatible("samsung,exynos4412-mct"))

Your root node compatible has "samsung,exynos4412-mct"!?

Quoted 2 lines

In any case, add a data ptr to of_device_id table and then use the match data rather than comparing compatible strings again.

Ah yes, you're right. Thanks for the suggestion! I'll update on v2.

Regards,
Will

[...]

#21 lore raw

Re: [PATCH v1 5/6] clocksource/drivers/exynos_mct: Add module support

In reply to Will McVicker
Quoted 21 lines · Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)
drivers/clocksource/Kconfig +0 -0
index 487c85259967..e5d9d8383607 100644

drivers/clocksource/Kconfig config ATMEL_TCB_CLKSRC · line 449

Quoted 8 lines
drivers/clocksource/Kconfig +2 -1
@@ -443,7 +443,8 @@ config ATMEL_TCB_CLKSRC
 	  Support for Timer Counter Blocks on Atmel SoCs.
 
 config CLKSRC_EXYNOS_MCT
-	bool "Exynos multi core timer driver" if COMPILE_TEST
+	tristate "Exynos multi core timer driver"
+	default y if ARCH_EXYNOS
 	depends on ARM || ARM64
 	depends on ARCH_ARTPEC || ARCH_EXYNOS || COMPILE_TEST

I am not sure if you actually tested it as module. On arm I cannot build it even:

ERROR: modpost: "register_current_timer_delay"
[drivers/clocksource/exynos_mct.ko] undefined!
ERROR: modpost: "sched_clock_register"
[drivers/clocksource/exynos_mct.ko] undefined!

Best regards,
Krzysztof

#22 lore raw

Re: [PATCH v1 5/6] clocksource/drivers/exynos_mct: Add module support

Quoted 33 lines · Krzysztof Kozlowski
Quoted 21 lines · Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)
drivers/clocksource/Kconfig +0 -0
index 487c85259967..e5d9d8383607 100644

drivers/clocksource/Kconfig config ATMEL_TCB_CLKSRC · line 449

Quoted 8 lines
drivers/clocksource/Kconfig +2 -1
@@ -443,7 +443,8 @@ config ATMEL_TCB_CLKSRC
 	  Support for Timer Counter Blocks on Atmel SoCs.
 
 config CLKSRC_EXYNOS_MCT
-	bool "Exynos multi core timer driver" if COMPILE_TEST
+	tristate "Exynos multi core timer driver"
+	default y if ARCH_EXYNOS
 	depends on ARM || ARM64
 	depends on ARCH_ARTPEC || ARCH_EXYNOS || COMPILE_TEST

I am not sure if you actually tested it as module. On arm I cannot build it even:

Quoted 4 lines

ERROR: modpost: "register_current_timer_delay"
[drivers/clocksource/exynos_mct.ko] undefined!
ERROR: modpost: "sched_clock_register"
[drivers/clocksource/exynos_mct.ko] undefined!

I tested with the gs101 ARM64 configuration. You're right it won't work with ARM32. Thanks for catching this! Since ARM32 architectures don't have the arch_timer, I'm not sure if we can actually support Exynos MCT as a module as you wouldn't have any available clocksource during boot. I'll update the Kconfig for v2 to handle this and make sure it works for ARM32. I'm guessing it'll work with something like:

config CLKSRC_EXYNOS_MCT
tristate "Exynos multi core timer driver" if ARM64

Regards,
Will

[...]

#23 lore raw

Re: [PATCH v1 5/6] clocksource/drivers/exynos_mct: Add module support

Quoted 46 lines · William McVicker
Quoted 33 lines · Krzysztof Kozlowski
Quoted 21 lines · Will McVicker

From: Donghoon Yu <[email protected]>

On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer.

[Original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
---
 drivers/clocksource/Kconfig      |  3 +-
 drivers/clocksource/exynos_mct.c | 47 +++++++++++++++++++++++++++-----
 2 files changed, 42 insertions(+), 8 deletions(-)
drivers/clocksource/Kconfig +0 -0
index 487c85259967..e5d9d8383607 100644

drivers/clocksource/Kconfig config ATMEL_TCB_CLKSRC · line 449

Quoted 8 lines
drivers/clocksource/Kconfig +2 -1
@@ -443,7 +443,8 @@ config ATMEL_TCB_CLKSRC
 	  Support for Timer Counter Blocks on Atmel SoCs.
 
 config CLKSRC_EXYNOS_MCT
-	bool "Exynos multi core timer driver" if COMPILE_TEST
+	tristate "Exynos multi core timer driver"
+	default y if ARCH_EXYNOS
 	depends on ARM || ARM64
 	depends on ARCH_ARTPEC || ARCH_EXYNOS || COMPILE_TEST

I am not sure if you actually tested it as module. On arm I cannot build it even:

Quoted 4 lines

ERROR: modpost: "register_current_timer_delay"
[drivers/clocksource/exynos_mct.ko] undefined!
ERROR: modpost: "sched_clock_register"
[drivers/clocksource/exynos_mct.ko] undefined!

I tested with the gs101 ARM64 configuration. You're right it won't work with ARM32. Thanks for catching this! Since ARM32 architectures don't have the arch_timer, I'm not sure if we can actually support Exynos MCT as a module as you wouldn't have any available clocksource during boot. I'll update the Kconfig for v2 to handle this and make sure it works for ARM32. I'm guessing it'll work with something like:

Quoted 9 lines

config CLKSRC_EXYNOS_MCT
tristate "Exynos multi core timer driver" if ARM64

Regards,
Will

[...]

Thanks for working on upstreaming the MCT driver modularization. I'll take another look at your v2 patch

Thanks.
Youngmin

#24 lore raw

PATCH 6/6 arm64: exynos: Drop select CLKSRC_EXYNOS_MCT

In reply to Will McVicker

Since the Exynos MCT driver can be built as a module for some Arm64 SoCs like gs101, drop force-selecting it as a built-in driver by ARCH_EXYNOS and instead depend on default y if ARCH_EXYNOS to select it automatically. This allows platforms like Android to build the driver as a module if desired.

---
 arch/arm64/Kconfig.platforms | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/Kconfig.platforms +0 -1
index 8b76821f190f..325279193e2c 100644
@@ -109,7 +109,6 @@ config ARCH_BLAIZE
 config ARCH_EXYNOS
 	bool "Samsung Exynos SoC family"
 	select COMMON_CLK_SAMSUNG
-	select CLKSRC_EXYNOS_MCT
 	select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
 	select EXYNOS_PMU
 	select PINCTRL
Signature · 1 line
2.49.0.472.ge94155a9ec-goog