LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Hsin-Yi Wang <hsinyi@chromium.org>
To: Fengquan Chen <Fengquan.Chen@mediatek.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Matthias Brugger <matthias.bgg@gmail.com>,
lkml <linux-kernel@vger.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
dehui.sun@mediatek.com
Subject: Re: [PATCH] [v4, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown
Date: Fri, 16 Apr 2021 18:47:39 +0800 [thread overview]
Message-ID: <CAJMQK-jyUzAQu_Yi5zJSRREC5fzPvQoTFpSVyKB8YBi1cK2j7g@mail.gmail.com> (raw)
In-Reply-To: <1617960162-1988-2-git-send-email-Fengquan.Chen@mediatek.com>
On Fri, Apr 9, 2021 at 5:22 PM Fengquan Chen <Fengquan.Chen@mediatek.com> wrote:
>
> mtk_syst_clkevt_shutdown is called after irq disabled in suspend flow,
> clear any pending systimer irq when shutdown to avoid suspend aborted
> due to timer irq pending
>
> Also as for systimer in mediatek socs, there must be firstly enable
> timer before clear systimer irq
>
> Fixes: e3af677607d9("clocksource/drivers/timer-mediatek: Add support for system timer")
> Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.com>
>
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Tested on a mt8183 device. This patch solves an issue that device
would hang on resume during genpd_resume_noirq:
[ 724.342834] mtk-smi-larb 17010000.larb: genpd_resume_noirq+0x0/0xd0
returned 0 after 976593 usecs
[ 724.351721] mtk-smi-larb 1a001000.larb: calling
genpd_resume_noirq+0x0/0xd0 @ 6629, parent: soc
[ 736.845047] Kernel panic - not syncing: Watchdog detected hard
LOCKUP on cpu 3
[ 736.852268] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G W
5.10.26 #17
[ 736.859743] Hardware name: MediaTek krane sku176 board (DT)
[ 736.865309] Call trace:
[ 736.867756] dump_backtrace+0x0/0x1bc
[ 736.871415] show_stack+0x20/0x2c
[ 736.874728] dump_stack+0xc0/0x11c
[ 736.878124] panic+0x174/0x378
[ 736.881178] watchdog_check_hardlockup+0x11c/0x124
[ 736.885963] watchdog_timer_fn+0x70/0x274
<snip>
> ---
> drivers/clocksource/timer-mediatek.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
> index 9318edc..6461fd3 100644
> --- a/drivers/clocksource/timer-mediatek.c
> +++ b/drivers/clocksource/timer-mediatek.c
> @@ -60,9 +60,9 @@
> * SYST_CON_EN: Clock enable. Shall be set to
> * - Start timer countdown.
> * - Allow timeout ticks being updated.
> - * - Allow changing interrupt functions.
> + * - Allow changing interrupt status,like clear irq pending.
> *
> - * SYST_CON_IRQ_EN: Set to allow interrupt.
> + * SYST_CON_IRQ_EN: Set to enable interrupt.
> *
> * SYST_CON_IRQ_CLR: Set to clear interrupt.
> */
> @@ -75,6 +75,7 @@
> static void mtk_syst_ack_irq(struct timer_of *to)
> {
> /* Clear and disable interrupt */
> + writel(SYST_CON_EN, SYST_CON_REG(to));
> writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to));
> }
>
> @@ -111,6 +112,9 @@ static int mtk_syst_clkevt_next_event(unsigned long ticks,
>
> static int mtk_syst_clkevt_shutdown(struct clock_event_device *clkevt)
> {
> + /* Clear any irq */
> + mtk_syst_ack_irq(to_timer_of(clkevt));
> +
> /* Disable timer */
> writel(0, SYST_CON_REG(to_timer_of(clkevt)));
>
> --
> 1.8.1.1.dirty
>
next prev parent reply other threads:[~2021-04-16 10:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 9:22 Fengquan Chen
2021-04-09 9:22 ` [PATCH] " Fengquan Chen
2021-04-16 10:47 ` Hsin-Yi Wang [this message]
2021-04-19 8:44 ` Daniel Lezcano
2021-04-21 10:27 ` Fengquan Chen
2021-07-26 10:01 ` Fengquan Chen
2021-08-26 16:25 ` [tip: timers/core] clocksource/drivers/mediatek: Optimize " tip-bot2 for Fengquan Chen
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=CAJMQK-jyUzAQu_Yi5zJSRREC5fzPvQoTFpSVyKB8YBi1cK2j7g@mail.gmail.com \
--to=hsinyi@chromium.org \
--cc=Fengquan.Chen@mediatek.com \
--cc=daniel.lezcano@linaro.org \
--cc=dehui.sun@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=tglx@linutronix.de \
--subject='Re: [PATCH] [v4, 1/1] clocksource/drivers/timer-mediatek: optimize systimer irq clear flow on shutdown' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).