On Thu, Feb 26, 2026 at 10:21:28AM -0500, Frank Li wrote:
> On Thu, Feb 26, 2026 at 11:16:26AM +0900, Koichiro Den wrote:
> > On Wed, Feb 25, 2026 at 10:43:32AM -0500, Frank Li wrote:
> > > On Wed, Feb 25, 2026 at 05:30:33PM +0900, Koichiro Den wrote:
> > > > On Fri, Jan 09, 2026 at 10:28:24AM -0500, Frank Li wrote:
> > > > > dw_edma_channel_setup() calculates ll_max based on the size of the
> > > > > ll_region, but the value is later overwritten with -1, preventing the
> > > > > code from ever reaching the calculated ll_max.
> > > > >
> > > > > Typically ll_max is around 170 for a 4 KB page and four DMA R/W
> > > > > channels.
> > > > > It is uncommon for a single DMA request to reach this limit, so the
> > > > > issue
> > > > > has not been observed in practice. However, if it occurs, the driver
> > > > > may
> > > > > overwrite adjacent memory before reporting an error.
> > > > >
> > > > > Remove the incorrect assignment so the calculated ll_max is honored
> > > > >
> > > > > Fixes: 31fb8c1ff962d ("dmaengine: dw-edma: Improve the linked list
> > > > > and data blocks definition")
> > > > > Signed-off-by: Frank Li <[email protected]>
> > > > > ---
> > > > > drivers/dma/dw-edma/dw-edma-core.c | 1 -
> > > > > 1 file changed, 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/dma/dw-edma/dw-edma-core.c
> > > > > b/drivers/dma/dw-edma/dw-edma-core.c
> > > > > index
> > > > > c6b014949afe82f10362711fc8a956fe60a72835..b154bdd7f2897d9a28df698a425afc1b1c93698b
> > > > > 100644
> > > > > --- a/drivers/dma/dw-edma/dw-edma-core.c
> > > > > +++ b/drivers/dma/dw-edma/dw-edma-core.c
> > > > > @@ -770,7 +770,6 @@ static int dw_edma_channel_setup(struct dw_edma
> > > > > *dw, u32 wr_alloc, u32 rd_alloc)
> > > > > chan->ll_max = (chip->ll_region_wr[chan->id].sz
> > > > > / EDMA_LL_SZ);
> > > > > else
> > > > > chan->ll_max = (chip->ll_region_rd[chan->id].sz
> > > > > / EDMA_LL_SZ);
> > > > > - chan->ll_max -= 1;
> > > >
> > > > Just curious: wasn't this to reserve one slot for the final link
> > > > element?
> > >
> > > when calculate avaible entry, always use chan-ll_max -1. ll_max indicate
> > > memory size, final link element actually occupted a space.
> >
> > After the entire series is applied (esp. [PATCH v2 10/11] + [PATCH v2
> > 11/11]),
> > yes, that makes sense to me. My concern was that before the semantics of
> > "ll_max" changes, this "-1" was required. In other words, this seemed to me
> > not
> > a fix but a preparatory patch. Please correct me if I'm misunderstainding.
>
> Thanks, I found I make mistake, wrong think it as "chan->ll_max = -1".
> I will squash this change to patch 10.
Thanks for the confirmation. I agree with the idea of squashing.
Best regards,
Koichiro
>
> Frank
>
> >
> > Thanks,
> > Koichiro
> >
> > >
> > > Frank
> > > >
> > > > Best regards,
> > > > Koichiro
> > > >
> > > > >
> > > > > dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n",
> > > > > str_write_read(chan->dir == EDMA_DIR_WRITE),
> > > > >
> > > > > --
> > > > > 2.34.1
> > > > >