linux/drivers/ntb
Dave Jiang 061a785a11 ntb: Force physically contiguous allocation of rx ring buffers
Physical addresses under IOVA on x86 platform are mapped contiguously
as a side effect before the patch that removed CONFIG_DMA_REMAP. The
NTB rx buffer ring is a single chunk DMA buffer that is allocated
against the NTB PCI device. If the receive side is using a DMA device,
then the buffers are remapped against the DMA device before being
submitted via the dmaengine API. This scheme becomes a problem when
the physical memory is discontiguous. When dma_map_page() is called
on the kernel virtual address from the dma_alloc_coherent() call, the
new IOVA mapping no longer points to all the physical memory allocated
due to being discontiguous. Change dma_alloc_coherent() to dma_alloc_attrs()
in order to force DMA_ATTR_FORCE_CONTIGUOUS attribute. This is the best
fix for the circumstance. A potential future solution may be having the DMA
mapping API providing a way to alias an existing IOVA mapping to a new
device perhaps.

This fix is not to fix the patch pointed to by the fixes tag, but to fix
the issue arised in the ntb_transport driver on x86 platforms after the
said patch is applied.

Reported-by: Jerry Dai <jerry.dai@intel.com>
Fixes: f5ff79fddf ("dma-mapping: remove CONFIG_DMA_REMAP")
Tested-by: Jerry Dai <jerry.dai@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
2024-09-20 10:51:25 -04:00
..
hw ntb: ntb_hw_switchtec: Fix use after free vulnerability in switchtec_ntb_remove due to race condition 2024-09-20 10:50:38 -04:00
test ntb_perf: Fix printk format 2024-09-20 10:50:38 -04:00
core.c ntb: Constify struct bus_type 2024-09-20 10:50:38 -04:00
Kconfig New feature to add support for NTB virtual MSI interrupts, the ability 2019-07-21 09:46:59 -07:00
Makefile New feature to add support for NTB virtual MSI interrupts, the ability 2019-07-21 09:46:59 -07:00
msi.c NTB/msi: Use struct_size() helper in devm_kzalloc() 2022-01-23 16:15:15 -05:00
ntb_transport.c ntb: Force physically contiguous allocation of rx ring buffers 2024-09-20 10:51:25 -04:00