From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796120898; b=Q5Gqq9cRDDUJV5IoxXAFYhCDj2Bl7JvAywoljQmLLAS6rzlM64fgciCw4jJ17yB6iuSA 8/u/aHbsLqRQtX75U2JlWLMvsYa6uatAS0cgL0p4SFJGUZ7tGismfoxNNdz7sVoPvYRHQ xNh2suXhnWwAhZm9aXluqsOnhdCd1LT0LC8Y+O2F72YFpXyjhseP9UoAfDLOK5SL84qEV 2rpJswQhkEE+gE885bW+Gy6lTn8NFRSZ3CjQpwneZ3CoHU/J4zpOy2zLAXQKgj/fHLqkT eqbKF4igqARQlKFVR40JEPnAbW5g1dX56OdMlULEDCOijP3mhzTd33Acu15r4gEZIIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796120898; h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:Sender:Reply-to: To:Subject:Cc:In-Reply-To:References:MIME-Version:Message-ID:Robot-ID: Robot-Unsubscribe:Precedence:Content-Type:Content-Transfer-Encoding; bh=w4xrv3V2cl9oY+Tb13PKW1MZpxbKJFmVTuO59SqXRu4=; b=BIyzZer2O86fWn39Dqo39pXw1ZryDWszy3LOvLvzhsP1H+XaavAMdcfZ+uyb7M4C4T0V 0I9QycoE9sgwB1GV/yNkDHzHSPDIcO5DCYwPvPjo0DvhWygl0e2naZ3t/TrVgJTfLb+5D 4+QiWKmXMTsn7IYzWVkr8jP5x41uI/LCFckSbsNmdi3egueHw6W/FS7okaRwv2ug1p2rL tIvTbmVn7iXVaJ+0a8YIgkNwqEnoTKCg6HLMHCtTeiroLFp7ueT3wlNE93aQT8sMVLIkz dvwx/GxgUUFhO+CD+uWQdrwNW6Cj71SY7NMv0gpxWdr503YpJ8C5l+BdU2TXczUeh6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=gfnUSjt0; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=RnU2L6bO; arc=none smtp.remote-ip=193.142.43.55 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 018F8606A32D for ; Tue, 1 Dec 2026 10:28:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 018F8606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=gfnUSjt0; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=RnU2L6bO Date: Tue, 01 Dec 2026 10:28:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1796120895; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w4xrv3V2cl9oY+Tb13PKW1MZpxbKJFmVTuO59SqXRu4=; b=gfnUSjt0UvvZIkQdbEYD7VQCRO82NgOM/Eq1XHATq+EAUQiSJ5ufVwu1+RzlvoZ3j7Uqop VgO+hkJZWMBRLgjFhaaThEx2LEUyYy6IcukGJgdC66Pr3Q+8stqsoHXbjNz0DY5lHOi4t1 tmkpjx6kmmpwObigRcZWSe7iGryOgaR5aMhWLdWdvrum/mb31RKvGrLwdnx5Mw4+KuxD0w EWYQMJPoPCaW9yhHdz+zXRqBJimIOMFyyh1pDy24RHG9jvhgyFMxHCuThT/ATfhE4bFdax my1voairSddZyH5iK5YdBPB6Z2/SU+3c6hH7eTqDBaaIOb06PSI/tRDTrgj40A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1796120895; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w4xrv3V2cl9oY+Tb13PKW1MZpxbKJFmVTuO59SqXRu4=; b=RnU2L6bOp6Bn9IneQ87BmiyOdt7N8f6eBYvVfif59wjHtNnKMn8nhKyJq/GCcTsVKGzUul 5X78tl0n3oIVuzCg== From: "clocksource-bot for Ryan Brue" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [clocksource: timers/drivers/next] clocksource/drivers/timer-mediatek: Enable the GPT irq before registering Cc: Ryan Brue , Daniel Lezcano , "Chen-Yu Tsai" , Luca Leonardo Scorcia In-Reply-To: <20261125-timer-mediatek-gpt-irq-order-v2-1-e9e793bd87d4@gmail.com> References: <20261125-timer-mediatek-gpt-irq-order-v2-1-e9e793bd87d4@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-ID: <179612089344.1190409.2623314923819189935.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/drivers/next branch of c= locksource: Commit-ID: 805b1cae4d3d8f21baf1fef68b29b833001c969b Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano= /linux.git//805b1cae4d3d8f21baf1fef68b29b833001c969b Author: Ryan Brue AuthorDate: Wed, 25 Nov 2026 23:13:50 -06:00 Committer: Daniel Lezcano 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 probi= ng") Signed-off-by: Ryan Brue Signed-off-by: Daniel Lezcano Reviewed-by: Chen-Yu Tsai Tested-by: Luca Leonardo Scorcia # MT8167 Sony PSC Mini Tested-by: Chen-Yu Tsai # MT8173 Hana (Telesu) Link: https://patch.msgid.link/20261125-timer-mediatek-gpt-irq-order-v2-1-e9e= 793bd87d4@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) =20 /* 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); =20 - mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); enable_irq(timer_of_irq(&to)); =20 return 0;