From: Yishai Hadas The PCI core initialises every PCI device with a DMA segment boundary mask of 0xffffffff in pci_device_add(), which forbids any segment from crossing a 4GB-aligned address regardless of its length. mlx5_core raises the default maximum segment size to 2GB but never overrides the boundary, although the device has no such limitation. Consumers such as ib_umem_get() coalesce physically contiguous pages up to the maximum segment size without consulting the boundary mask. Registering a large MR can therefore produce a segment that crosses a 4GB-aligned address, which the DMA API debug checker reports: DMA-API: mlx5_core 0000:08:00.0: mapping sg segment across boundary [start=0x00000002ffe27000] [end=0x000000030020efff] [boundary=0x00000000ffffffff] The segment is about 4MB long, well below the 2GB maximum, but it spans the 12GB (0x300000000) boundary: the upper halves of start and end are 0x2 and 0x3. Set the segment boundary mask to ULONG_MAX so the DMA constraints declared for the device match what the hardware supports. Signed-off-by: Yishai Hadas Reviewed-by: Moshe Shemesh Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 079e91c98041..b3f4d319d29e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -190,6 +190,7 @@ static int set_dma_caps(struct pci_dev *pdev) } dma_set_max_seg_size(&pdev->dev, 2u * 1024 * 1024 * 1024); + dma_set_seg_boundary(&pdev->dev, ULONG_MAX); return err; } -- 2.44.0