mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "clocksource-bot for Luca Leonardo Scorcia" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Luca Leonardo Scorcia <l.scorcia@gmail.com>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	daniel.lezcano@oss.qualcomm.com
Subject: [clocksource: timers/drivers/next] clocksource/drivers/timer-mediatek: Fix random crash at boot
Date: Wed, 14 Oct 2026 20:20:44 -0000	[thread overview]
Message-ID: <179200924459.2666337.2191849978590778262.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20261002072115.169250-2-l.scorcia@gmail.com>

The following commit has been merged into the timers/drivers/next branch of clocksource:

Commit-ID:     8496a1d234e8cf9cb15c4282cb3a11c6550bd242
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git//8496a1d234e8cf9cb15c4282cb3a11c6550bd242
Author:        Luca Leonardo Scorcia <l.scorcia@gmail.com>
AuthorDate:    Fri, 02 Oct 2026 09:19:26 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Tue, 13 Oct 2026 13:17:13 +02:00

clocksource/drivers/timer-mediatek: Fix random crash at boot

MediaTek bootloaders generally enable APXGPT timers at boot. This means
that a timer IRQ can sometimes happen between the IRQ line request and the
configuration of the clock event handler. This leads to a hard crash with
an instruction abort, branch to pc 0x0 in mtk_gpt_interrupt handler as
clkevt is null.

To avoid this issue request the IRQ with IRQF_NO_AUTOEN and enable it
explicitly after the clock event is configured.

Issue was reported and fix tested on the Lenovo Tab E7 (TB-7104F, mt8167).

Fixes: a0858f937960 ("clocksource/drivers/timer-mediatek: Convert the driver to timer-of")
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20261002072115.169250-2-l.scorcia@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 7bcb4a3..e20075b 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -277,7 +277,7 @@ static struct timer_of to = {
 	},
 
 	.of_irq = {
-		.flags = IRQF_TIMER | IRQF_IRQPOLL,
+		.flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_NO_AUTOEN,
 	},
 };
 
@@ -298,6 +298,7 @@ static int __init mtk_syst_init(struct device_node *node)
 
 	clockevents_config_and_register(&to.clkevt, timer_of_rate(&to),
 					TIMER_SYNC_TICKS, 0xffffffff);
+	enable_irq(timer_of_irq(&to));
 
 	return 0;
 }
@@ -334,6 +335,7 @@ static int __init mtk_gpt_init(struct device_node *node)
 					TIMER_SYNC_TICKS, 0xffffffff);
 
 	mtk_gpt_enable_irq(&to, TIMER_CLK_EVT);
+	enable_irq(timer_of_irq(&to));
 
 	return 0;
 }

  reply	other threads:[~2026-10-14 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  7:19 [PATCH 0/3] Convert MediaTek GPT timers to OF probing Luca Leonardo Scorcia
2026-10-02  7:19 ` [PATCH 1/3] clocksource/drivers/timer-mediatek: Fix random crash at boot Luca Leonardo Scorcia
2026-10-14 20:20   ` clocksource-bot for Luca Leonardo Scorcia [this message]
2026-10-02  7:19 ` [PATCH 2/3] clocksource/drivers/timer-mediatek: Convert to OF probing Luca Leonardo Scorcia
2026-10-14 20:20   ` [clocksource: timers/drivers/next] " clocksource-bot for Luca Leonardo Scorcia
2026-11-09  9:50   ` [PATCH 2/3] " Chen-Yu Tsai
2026-10-02  7:19 ` [PATCH 3/3] clocksource/drivers/timer-mediatek: Request and enable the bus clock Luca Leonardo Scorcia
2026-10-14 20:20   ` [clocksource: timers/drivers/next] " clocksource-bot for Luca Leonardo Scorcia
2026-10-02  7:46 ` [PATCH 0/3] Convert MediaTek GPT timers to OF probing Roman Vivchar

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=179200924459.2666337.2191849978590778262.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=l.scorcia@gmail.com \
    --cc=linux-kernel@vger.kernel.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®