summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2026-05-01 09:35:06 +0300
committerMarek Szyprowski <m.szyprowski@samsung.com>2026-05-08 23:28:19 +0300
commit9d625aa2ebd445868955719e0abcf695b43f9318 (patch)
treeff3c7028a74a45f5a2dd443dc73ef39795604745
parentda6d997ac556479c112554ab5d95cbd04683eb11 (diff)
downloadlinux-9d625aa2ebd445868955719e0abcf695b43f9318.tar.xz
ntb: Use consistent DMA attributes when freeing DMA mappings
The counterpart of dma_alloc_attrs() is dma_free_attrs(), which must receive the same DMA attributes used during allocation. The code previously used dma_free_coherent(), which does not accept or apply any DMA attributes. Fixes: 061a785a114f ("ntb: Force physically contiguous allocation of rx ring buffers") Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20260501-dma-attrs-debug-v2-2-8dbac75cd501@nvidia.com
-rw-r--r--drivers/ntb/ntb_transport.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 771eb7d9f435..f59f926d4bfa 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -766,8 +766,8 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw)
return;
ntb_mw_clear_trans(nt->ndev, PIDX, num_mw);
- dma_free_coherent(dma_dev, mw->alloc_size,
- mw->alloc_addr, mw->original_dma_addr);
+ dma_free_attrs(dma_dev, mw->alloc_size, mw->alloc_addr,
+ mw->original_dma_addr, DMA_ATTR_FORCE_CONTIGUOUS);
mw->xlat_size = 0;
mw->buff_size = 0;
mw->alloc_size = 0;
@@ -828,8 +828,8 @@ static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw,
return 0;
err:
- dma_free_coherent(ntb_dev, mw->alloc_size, alloc_addr, dma_addr);
-
+ dma_free_attrs(ntb_dev, mw->alloc_size, alloc_addr, dma_addr,
+ DMA_ATTR_FORCE_CONTIGUOUS);
return rc;
}