diff options
| author | Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> | 2026-05-26 11:46:58 +0300 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-06-04 20:58:31 +0530 |
| commit | e21aa306e82067457f2297ae56af4c91db86c59a (patch) | |
| tree | 32c3c993dddea0c3d52b4d2f80ac09c2d60438aa | |
| parent | 32a69f1487819766d2084ed32b1350b18f971c10 (diff) | |
| download | linux-e21aa306e82067457f2297ae56af4c91db86c59a.tar.gz linux-e21aa306e82067457f2297ae56af4c91db86c59a.zip | |
dmaengine: sh: rz-dmac: Save the start LM descriptor
Save the start LM descriptor to avoid starting from the beginning of the
channel's LM descriptor list in rz_dmac_calculate_residue_bytes_in_vd().
This avoids unnecessary iterations.
Tested-by: John Madieu <john.madieu.xa@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://patch.msgid.link/20260526084710.3491480-7-claudiu.beznea@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
| -rw-r--r-- | drivers/dma/sh/rz-dmac.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index c48858b68dee..d3926ecd63ac 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -58,6 +58,7 @@ struct rz_dmac_desc { /* For slave sg */ struct scatterlist *sg; unsigned int sgcount; + struct rz_lmdesc *start_lmdesc; }; #define to_rz_dmac_desc(d) container_of(d, struct rz_dmac_desc, vd) @@ -343,6 +344,8 @@ static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel) struct rz_dmac_desc *d = channel->desc; u32 chcfg = CHCFG_MEM_COPY; + d->start_lmdesc = lmdesc; + /* prepare descriptor */ lmdesc->sa = d->src; lmdesc->da = d->dest; @@ -377,6 +380,7 @@ static void rz_dmac_prepare_descs_for_slave_sg(struct rz_dmac_chan *channel) } lmdesc = channel->lmdesc.tail; + d->start_lmdesc = lmdesc; for (i = 0, sg = sgl; i < sg_len; i++, sg = sg_next(sg)) { if (d->direction == DMA_DEV_TO_MEM) { @@ -693,9 +697,10 @@ rz_dmac_get_next_lmdesc(struct rz_lmdesc *base, struct rz_lmdesc *lmdesc) return next; } -static u32 rz_dmac_calculate_residue_bytes_in_vd(struct rz_dmac_chan *channel, u32 crla) +static u32 rz_dmac_calculate_residue_bytes_in_vd(struct rz_dmac_chan *channel, + struct rz_dmac_desc *desc, u32 crla) { - struct rz_lmdesc *lmdesc = channel->lmdesc.head; + struct rz_lmdesc *lmdesc = desc->start_lmdesc; struct dma_chan *chan = &channel->vc.chan; struct rz_dmac *dmac = to_rz_dmac(chan->device); u32 residue = 0, i = 0; @@ -794,7 +799,7 @@ static u32 rz_dmac_chan_get_residue(struct rz_dmac_chan *channel, * Calculate number of bytes transferred in processing virtual descriptor. * One virtual descriptor can have many lmdesc. */ - return crtb + rz_dmac_calculate_residue_bytes_in_vd(channel, crla); + return crtb + rz_dmac_calculate_residue_bytes_in_vd(channel, current_desc, crla); } static enum dma_status rz_dmac_tx_status(struct dma_chan *chan, |
