net/mlx5: Declare no DMA segment boundary restriction
Subsystems (4)
Tariq Toukan
maintainercover net/mlx5: Declare no DMA segment boundary restriction
Hi,
This series by Yishai declares that the mlx5 devices have no DMA segment boundary restriction.
Regards,
Tariq
Yishai Hadas (2):
net/mlx5: Declare no DMA segment boundary restriction net/mlx5: Declare no DMA segment boundary for data direct device
drivers/net/ethernet/mellanox/mlx5/core/data_direct.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 2 files changed, 2 insertions(+)
base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e
Signature · 1 line
2.44.0
Tariq Toukan
maintainerPATCH 1/2 net/mlx5: Declare no DMA segment boundary restriction
From: Yishai Hadas <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -0
@@ -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; }
Signature · 1 line
2.44.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 21 lines
From: Yishai Hadas <[email protected]>
The PCI core initialises every PCI device with a DMA segment boundary mask of
0xffffffffinpci_device_add(), which forbids any segment from crossing a 4GB-aligned address regardless of its length.mlx5_coreraises 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_core0000: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 are0x2and0x3.
Quoted 6 lines
Set the segment boundary mask to
ULONG_MAXso the DMA constraints declared for the device match what the hardware supports.Signed-off-by Yishai Hadas <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 21 lines
From: Yishai Hadas <[email protected]>
The PCI core initialises every PCI device with a DMA segment boundary mask of
0xffffffffinpci_device_add(), which forbids any segment from crossing a 4GB-aligned address regardless of its length.mlx5_coreraises 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_core0000: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 are0x2and0x3.
Quoted 6 lines
Set the segment boundary mask to
ULONG_MAXso the DMA constraints declared for the device match what the hardware supports.Signed-off-by Yishai Hadas <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Tariq Toukan
maintainerPATCH 2/2 net/mlx5: Declare no DMA segment boundary for data direct device
In reply to Tariq ToukanFrom: Yishai Hadas <[email protected]>
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. The data direct device raises the default maximum segment size to 2GB but keeps that boundary, although it has no such limitation.
Declare that explicitly, in line with mlx5_core, to avoid a mismatch between the declared constraints and the hardware capabilities.
--- drivers/net/ethernet/mellanox/mlx5/core/data_direct.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/data_direct.c +1 -0
@@ -103,6 +103,7 @@ static int mlx5_data_direct_set_dma_caps(struct pci_dev *pdev) }dma_set_max_seg_size (&pdev->dev,SZ_2G ); +dma_set_seg_boundary (&pdev->dev,ULONG_MAX );return 0 ; }
Signature · 1 line
2.44.0
[email protected]
AI reviewRe: [PATCH net-next 2/2] net/mlx5: Declare no DMA segment boundary for data direct device
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
From: Yishai Hadas <[email protected]>
The PCI core initialises every PCI device with a DMA segment boundary mask of
0xffffffffinpci_device_add(), which forbids any segment from crossing a 4GB-aligned address regardless of its length. The data direct device raises the default maximum segment size to 2GB but keeps that boundary, although it has no such limitation.
Quoted 6 lines
Declare that explicitly, in line with
mlx5_core, to avoid a mismatch between the declared constraints and the hardware capabilities.Signed-off-by Yishai Hadas <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH net-next 2/2] net/mlx5: Declare no DMA segment boundary for data direct device
In reply to Tariq ToukanQuoted 8 lines
From: Yishai Hadas <[email protected]>
The PCI core initialises every PCI device with a DMA segment boundary mask of
0xffffffffinpci_device_add(), which forbids any segment from crossing a 4GB-aligned address regardless of its length. The data direct device raises the default maximum segment size to 2GB but keeps that boundary, although it has no such limitation.
Quoted 6 lines
Declare that explicitly, in line with
mlx5_core, to avoid a mismatch between the declared constraints and the hardware capabilities.Signed-off-by Yishai Hadas <[email protected]>Reviewed-by Moshe Shemesh <[email protected]>Signed-off-by Tariq Toukan <[email protected]>
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Fri, 20 Nov 2026 10:18:17 +0200 you wrote:
Hi,
This series by Yishai declares that the mlx5 devices have no DMA segment boundary restriction.
Regards,
Tariq[...]
Here is the summary with links:
- [net-next,1/2] net/mlx5: Declare no DMA segment boundary restriction
https://git.kernel.org/netdev/net-next/c/0ef669aa10e6 - [net-next,2/2] net/mlx5: Declare no DMA segment boundary for data direct device https://git.kernel.org/netdev/net-next/c/7e25d974eb36
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html