From: Frank Li <Frank.li@oss.nxp.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: "Viresh Kumar" <vireshk@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Vinod Koul" <vkoul@kernel.org>, "Frank Li" <Frank.Li@kernel.org>,
"Dan Williams" <djbw@kernel.org>,
"Serge Semin" <fancer.lancer@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
dmaengine@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>
Subject: Re: [PATCH v12 5/7] dmaengine: dw: extract hardware-LLP residue calculation
Date: Wed, 25 Nov 2026 14:50:40 -0600 [thread overview]
Message-ID: <awdKII0K0WKbj7po@SMW015318> (raw)
In-Reply-To: <20261121-submit-dw-dma-synchronize-v1-v12-5-f51eb635209d@gmail.com>
On Sat, Nov 21, 2026 at 02:03:20PM -0700, James Hilliard wrote:
> From: Serge Semin <fancer.lancer@gmail.com>
>
> Move the hardware-LLP residue calculation into
> dwc_get_hard_llp_desc_residue() so it can be reused independently of
> completion handling.
>
> Keep the scanner's LLP snapshot, descriptor updates and early returns
> unchanged. Only one transaction is active, so the helper updates its
> cached residue directly without reporting a completion indication.
>
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> [james: extract the calculation for the single active virt-dma transaction]
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/dw/core.c | 42 +++++++++++++++++++++++++-----------------
> 1 file changed, 25 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index d00d0d53f6ba..150823544f40 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -281,6 +281,30 @@ static inline u32 dwc_get_sent(struct dw_dma_chan *dwc)
> return dw->block2bytes(dwc, ctlhi, ctllo >> 4 & 7);
> }
>
> +static void dwc_get_hard_llp_desc_residue(struct dw_dma_chan *dwc,
> + struct dw_desc *desc, dma_addr_t llp)
> +{
> + struct dw_desc *child;
> +
> + desc->residue = desc->total_len;
> + if (desc->vd.tx.phys == DWC_LLP_LOC(llp))
> + return;
> +
> + if (lli_read(desc, llp) == llp) {
> + desc->residue -= dwc_get_sent(dwc);
> + return;
> + }
> +
> + desc->residue -= desc->len;
> + list_for_each_entry(child, &desc->tx_list, vd.node) {
> + if (lli_read(child, llp) == llp) {
> + desc->residue -= dwc_get_sent(dwc);
> + return;
> + }
> + desc->residue -= child->len;
> + }
> +}
> +
> static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
> {
> struct dw_desc *desc;
> @@ -338,23 +362,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
> if (!desc || test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags))
> return;
>
> - desc->residue = desc->total_len;
> - if (desc->vd.tx.phys == DWC_LLP_LOC(llp))
> - return;
> -
> - if (lli_read(desc, llp) == llp) {
> - desc->residue -= dwc_get_sent(dwc);
> - return;
> - }
> -
> - desc->residue -= desc->len;
> - list_for_each_entry(child, &desc->tx_list, vd.node) {
> - if (lli_read(child, llp) == llp) {
> - desc->residue -= dwc_get_sent(dwc);
> - return;
> - }
> - desc->residue -= child->len;
> - }
> + dwc_get_hard_llp_desc_residue(dwc, desc, llp);
> }
>
> static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_desc *desc)
>
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-11-25 20:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 21:03 [PATCH v12 0/7] dmaengine: dw: serialize completion and termination James Hilliard
2026-11-21 21:03 ` [PATCH v12 1/7] dmaengine: dw: Fix XFER bit set, but channel not idle error James Hilliard
2026-11-21 21:03 ` [PATCH v12 2/7] dmaengine: dw: serialize error recovery with channel termination James Hilliard
2026-11-21 21:03 ` [PATCH v12 3/7] dmaengine: dw: embed a virt-dma channel James Hilliard
2026-11-25 20:38 ` Frank Li
2026-11-21 21:03 ` [PATCH v12 4/7] dmaengine: dw: use virt-dma for descriptor and callback ownership James Hilliard
2026-11-25 20:45 ` Frank Li
2026-11-21 21:03 ` [PATCH v12 5/7] dmaengine: dw: extract hardware-LLP residue calculation James Hilliard
2026-11-25 20:50 ` Frank Li [this message]
2026-11-21 21:03 ` [PATCH v12 6/7] dmaengine: dw: calculate residue in the status getter James Hilliard
2026-11-21 21:03 ` [PATCH v12 7/7] dmaengine: dw: report residue for queued transfers James Hilliard
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=awdKII0K0WKbj7po@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james.hilliard1@gmail.com \
--cc=jirislaby@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=vireshk@kernel.org \
--cc=vkoul@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