From: "clocksource-bot for Ryan Brue" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Ryan Brue <ryanbrue.dev@gmail.com>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
"Chen-Yu Tsai" <wenst@chromium.org>,
Luca Leonardo Scorcia <l.scorcia@gmail.com>
Subject: [clocksource: timers/drivers/next] clocksource/drivers/timer-mediatek: Enable the GPT irq before registering
Date: Tue, 01 Dec 2026 10:28:13 -0000 [thread overview]
Message-ID: <179612089344.1190409.2623314923819189935.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20261125-timer-mediatek-gpt-irq-order-v2-1-e9e793bd87d4@gmail.com>
The following commit has been merged into the timers/drivers/next branch of clocksource:
Commit-ID: 805b1cae4d3d8f21baf1fef68b29b833001c969b
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git//805b1cae4d3d8f21baf1fef68b29b833001c969b
Author: Ryan Brue <ryanbrue.dev@gmail.com>
AuthorDate: Wed, 25 Nov 2026 23:13:50 -06:00
Committer: Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Tue, 01 Dec 2026 11:10:12 +01:00
clocksource/drivers/timer-mediatek: Enable the GPT irq before registering
Since the driver probes as a platform device, the GPT clock event is
registered late in boot, when PSCI CPU idle may already have put CPUs
into a state that stops their local timer. Those CPUs wait in the
oneshot broadcast mask on the hrtimer broadcast, and
tick_install_broadcast_device() arms the new broadcast device to expire
at once so that it wakes them.
mtk_gpt_init() sets the timer's bit in GPT_IRQ_EN only after
clockevents_config_and_register(). The forced event fires while the bit
is clear, the status register stays clear, and the waiting CPUs are
never woken. On an MT8173 tablet with the CPU_SLEEP_0 idle state in
use, this hung the boot in 20 of 40 boots; with this change it booted
16 of 16.
Enable the interrupt before registering the clock event. The IRQ line
stays disabled until enable_irq(), so the handler still can't run before
the clock event is set up. With the bit set, the timer that
mtk_gpt_setup() leaves running could latch an interrupt that
registration doesn't acknowledge, the kind of pending interrupt that
commit fc686d0037d7 ("clockevents/drivers/mtk: Fix spurious interrupt
leading to crash") acknowledges in mtk_gpt_enable_irq(). So stop the
timer before enabling the interrupt, until the core programs an event.
Fixes: 7a097aba7255 ("clocksource/drivers/timer-mediatek: Convert to OF probing")
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Tested-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> # MT8167 Sony PSC Mini
Tested-by: Chen-Yu Tsai <wenst@chromium.org> # MT8173 Hana (Telesu)
Link: https://patch.msgid.link/20261125-timer-mediatek-gpt-irq-order-v2-1-e9e793bd87d4@gmail.com
---
drivers/clocksource/timer-mediatek.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 764c30c..48a9ebf 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -352,10 +352,12 @@ static int mtk_gpt_init(struct platform_device *pdev)
/* Configure clock event */
mtk_gpt_setup(&to, TIMER_CLK_EVT, GPT_CTRL_OP_REPEAT);
+ /* Stop it so that nothing is pending when its irq is enabled */
+ mtk_gpt_clkevt_time_stop(&to, TIMER_CLK_EVT);
+ mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
TIMER_SYNC_TICKS, 0xffffffff);
- mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
enable_irq(timer_of_irq(&to));
return 0;
prev parent reply other threads:[~2026-12-01 10:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 5:13 [PATCH v2] " Ryan Brue
2026-11-26 8:47 ` Chen-Yu Tsai
2026-11-26 9:33 ` Luca Leonardo Scorcia
2026-11-27 9:27 ` [clocksource: timers/drivers/next] " clocksource-bot for Ryan Brue
2026-12-01 10:28 ` clocksource-bot for Ryan Brue [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179612089344.1190409.2623314923819189935.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=daniel.lezcano@kernel.org \
--cc=l.scorcia@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ryanbrue.dev@gmail.com \
--cc=wenst@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®