kernel_samsung_a53x/drivers/dma
Serge Semin 2dc17100c5 dmaengine: dw: Add peripheral bus width verification
[ Upstream commit b336268dde75cb09bd795cb24893d52152a9191f ]

Currently the src_addr_width and dst_addr_width fields of the
dma_slave_config structure are mapped to the CTLx.SRC_TR_WIDTH and
CTLx.DST_TR_WIDTH fields of the peripheral bus side in order to have the
properly aligned data passed to the target device. It's done just by
converting the passed peripheral bus width to the encoded value using the
__ffs() function. This implementation has several problematic sides:

1. __ffs() is undefined if no bit exist in the passed value. Thus if the
specified addr-width is DMA_SLAVE_BUSWIDTH_UNDEFINED, __ffs() may return
unexpected value depending on the platform-specific implementation.

2. DW AHB DMA-engine permits having the power-of-2 transfer width limited
by the DMAH_Mk_HDATA_WIDTH IP-core synthesize parameter. Specifying
bus-width out of that constraints scope will definitely cause unexpected
result since the destination reg will be only partly touched than the
client driver implied.

Let's fix all of that by adding the peripheral bus width verification
method and calling it in dwc_config() which is supposed to be executed
before preparing any transfer. The new method will make sure that the
passed source or destination address width is valid and if undefined then
the driver will just fallback to the 1-byte width transfer.

Fixes: 029a40e97d0d ("dmaengine: dw: provide DMA capabilities")
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20240802075100.6475-2-fancer.lancer@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:20:54 +01:00
..
bestcomm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dw dmaengine: dw: Add peripheral bus width verification 2024-11-23 23:20:54 +01:00
dw-axi-dmac Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dw-edma Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-dpaa2-qdma dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools 2024-11-18 12:13:23 +01:00
hsu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idxd Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioat dmaengine: ioatdma: Fix missing kmem_cache_destroy() 2024-11-19 14:19:09 +01:00
ipu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mediatek dmaengine: mediatek: Fix deadlock caused by synchronize_irq() 2024-11-08 11:25:53 +01:00
ppc4xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qcom Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sf-pdma Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sh dmaengine: shdma: increase size of 'dev_id' 2024-11-18 22:25:32 +01:00
ti dmaengine: ti: edma: Add some null pointer checks to the edma_probe 2024-11-18 22:25:33 +01:00
xilinx dma: xilinx_dpdma: Fix locking 2024-11-19 11:32:40 +01:00
acpi-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
altera-msgdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
amba-pl08x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
at_hdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
at_hdmac_regs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
at_xdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm-sba-raid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm2835-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
coh901318.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
coh901318.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
coh901318_lli.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dma-axi-dmac.c dmaengine: axi-dmac: fix possible race in remove() 2024-11-19 14:19:04 +01:00
dma-jz4780.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmaengine.c dmaengine: fix NULL pointer in channel unregistration function 2024-11-18 12:12:55 +01:00
dmaengine.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmatest.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ep93xx_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-edma-common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-edma-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-edma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-qdma.c dmaengine: fsl-qdma: init irq after reg initialization 2024-11-18 23:18:29 +01:00
fsl_raid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl_raid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsldma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsldma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hisi_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idma64.c dmaengine: idma64: Add check for dma_set_max_seg_size 2024-11-19 12:27:00 +01:00
idma64.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
img-mdc-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx-sdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iop-adma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
iop-adma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
k3dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA 2024-11-19 08:44:51 +01:00
lpc18xx-dmamux.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mcf-edma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
milbeaut-hdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
milbeaut-xdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmp_pdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmp_tdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
moxart-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mpc512x_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mv_xor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mv_xor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mv_xor_v2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxs-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nbpfaxi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
of-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
owl-dma.c dmaengine: owl: fix register access functions 2024-11-19 11:32:40 +01:00
pch_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pl330.c dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-11-19 11:32:41 +01:00
plx_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pxa_dma.c dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() 2024-11-18 11:43:05 +01:00
s3c24xx-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sa11x0-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
samsung-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sirf-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sprd-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
st_fdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
st_fdma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ste_dma40.c dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe 2024-11-18 10:58:46 +01:00
ste_dma40_ll.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ste_dma40_ll.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stm32-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stm32-dmamux.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stm32-mdma.c dmaengine: stm32-mdma: correct desc prep when channel running 2024-11-18 11:43:25 +01:00
sun4i-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sun6i-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tegra20-apb-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tegra210-adma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timb_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
TODO Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
txx9dmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
txx9dmac.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uniphier-mdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uniphier-xdmac.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virt-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virt-dma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xgene-dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zx_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00