From: Frank Li <Frank.li@oss.nxp.com>
To: "Markus Schneider-Pargmann (TI)" <msp@baylibre.com>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Tony Lindgren <tony@atomide.com>, Daniel Mack <zonque@gmail.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
Julien Panis <jpanis@baylibre.com>, "Mendez, Judith" <jm@ti.com>,
"Francis, Sebin" <sebin.francis@ti.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 2/4] dmaengine: ti: cppi41: Fix register access in suspend_late
Date: Wed, 4 Nov 2026 11:47:16 -0600 [thread overview]
Message-ID: <autvpCjyMBtH0KJo@SMW015318> (raw)
In-Reply-To: <20261103-v7-3-topic-am335lpm-cppi41-v1-2-d7213446c5f5@baylibre.com>
On Tue, Nov 03, 2026 at 08:37:29PM +0100, Markus Schneider-Pargmann (TI) wrote:
> [You don't often get email from msp@baylibre.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> cppi41_suspend() and cppi41_resume() access registers. However the
> device may be runtime suspended in which case it is not allowed to
> access the registers.
>
> On suspend do not run disable_sched() when it is runtime suspended. This
> avoids accessing the registers and crashing the kernel during suspend.
>
> Resume when runtime suspended is delayed until cppi41_runtime_resume()
> is called using the variable ctx_lost. This keeps any access while the
> device is runtime suspended.
>
> Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Schneider-Pargmann (TI) <msp@baylibre.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
> index 458d20b12462..f5a824418fe7 100644
> --- a/drivers/dma/ti/cppi41.c
> +++ b/drivers/dma/ti/cppi41.c
> @@ -146,6 +146,9 @@ struct cppi41_dd {
> struct list_head pending; /* Pending queued transfers */
> spinlock_t lock; /* Lock for pending list */
>
> + /* Register context may have been lost during system suspend */
> + bool ctx_lost;
> +
> bool is_suspended;
> };
>
> @@ -1171,7 +1174,10 @@ static int __maybe_unused cppi41_suspend(struct device *dev)
> {
> struct cppi41_dd *cdd = dev_get_drvdata(dev);
>
> - disable_sched(cdd);
> + if (!pm_runtime_status_suspended(dev))
> + disable_sched(cdd);
> +
> + cdd->ctx_lost = true;
>
> return 0;
> }
> @@ -1182,6 +1188,9 @@ static int __maybe_unused cppi41_resume(struct device *dev)
> struct cppi41_channel *c;
> int i;
>
> + if (pm_runtime_status_suspended(dev))
> + return 0;
> +
> for (i = 0; i < DESCS_AREAS; i++)
> cppi_writel(cdd->descs_phys, cdd->qmgr_mem + QMGR_MEMBASE(i));
>
> @@ -1196,6 +1205,8 @@ static int __maybe_unused cppi41_resume(struct device *dev)
> cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE);
> cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE);
>
> + cdd->ctx_lost = false;
> +
> return 0;
> }
>
> @@ -1217,6 +1228,9 @@ static int __maybe_unused cppi41_runtime_resume(struct device *dev)
> struct cppi41_dd *cdd = dev_get_drvdata(dev);
> unsigned long flags;
>
> + if (cdd->ctx_lost)
> + cppi41_resume(dev);
> +
> spin_lock_irqsave(&cdd->lock, flags);
> cdd->is_suspended = false;
> cppi41_run_queue(cdd);
>
> --
> 2.55.0
>
next prev parent reply other threads:[~2026-11-04 17:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 19:37 [PATCH 0/4] dmaengine: ti: cppi41: Fix suspend/resume issues Markus Schneider-Pargmann (TI)
2026-11-03 19:37 ` [PATCH 1/4] dmaengine: ti: cppi41: Use td_queue to restore DMA_TDFDQ Markus Schneider-Pargmann (TI)
2026-11-04 8:56 ` Adivi, Sai Sree Kartheek
2026-11-04 17:42 ` Frank Li
2026-11-04 19:50 ` Markus Schneider-Pargmann
2026-11-03 19:37 ` [PATCH 2/4] dmaengine: ti: cppi41: Fix register access in suspend_late Markus Schneider-Pargmann (TI)
2026-11-04 8:58 ` Adivi, Sai Sree Kartheek
2026-11-04 17:47 ` Frank Li [this message]
2026-11-03 19:37 ` [PATCH 3/4] dmaengine: ti: cppi41: Restore QMGR_MEMCTRL in resume Markus Schneider-Pargmann (TI)
2026-11-04 9:00 ` Adivi, Sai Sree Kartheek
2026-11-04 17:54 ` Frank Li
2026-11-03 19:37 ` [PATCH 4/4] dmaengine: ti: cppi41: Share register setup with resume Markus Schneider-Pargmann (TI)
2026-11-04 9:02 ` Adivi, Sai Sree Kartheek
2026-11-04 17:58 ` Frank Li
2026-11-04 16:32 ` [PATCH 0/4] dmaengine: ti: cppi41: Fix suspend/resume issues Judith Mendez
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=autvpCjyMBtH0KJo@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=jm@ti.com \
--cc=jpanis@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=msp@baylibre.com \
--cc=sebin.francis@ti.com \
--cc=stable@vger.kernel.org \
--cc=tony@atomide.com \
--cc=vkoul@kernel.org \
--cc=zonque@gmail.com \
/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®