dmaengine: dw-edma: Don't permit non-inc interleaved xfers
The DW eDMA controller always increments both source and destination
addresses. Permitting DMA interleaved transfers with no src_inc/dst_inc
flags set may lead to unexpected behaviour for the device users.
Terminate interleaved transfers if at least one of the
dma_interleaved_template.{src_inc,dst_inc} flag is initialized to "false".
Note that in addition, we need to increase the source and destination
addresses after each iteration.
Link: https://lore.kernel.org/r/20230113171409.30470-6-Sergey.Semin@baikalelectronics.ru
Fixes: 85e7518f42
("dmaengine: dw-edma: Add device_prep_interleave_dma() support")
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Родитель
13b6299cf6
Коммит
c8ed491822
|
@ -385,6 +385,8 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
|
|||
return NULL;
|
||||
if (xfer->xfer.il->numf > 0 && xfer->xfer.il->frame_size > 0)
|
||||
return NULL;
|
||||
if (!xfer->xfer.il->src_inc || !xfer->xfer.il->dst_inc)
|
||||
return NULL;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -484,15 +486,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer)
|
|||
struct dma_interleaved_template *il = xfer->xfer.il;
|
||||
struct data_chunk *dc = &il->sgl[i];
|
||||
|
||||
if (il->src_sgl) {
|
||||
src_addr += burst->sz;
|
||||
src_addr += burst->sz;
|
||||
if (il->src_sgl)
|
||||
src_addr += dmaengine_get_src_icg(il, dc);
|
||||
}
|
||||
|
||||
if (il->dst_sgl) {
|
||||
dst_addr += burst->sz;
|
||||
dst_addr += burst->sz;
|
||||
if (il->dst_sgl)
|
||||
dst_addr += dmaengine_get_dst_icg(il, dc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче