[PATCH 0/2] RDMA: Remove obsolete 32-bit DMA mask fallbacks

Ruizhe Zhou posted 2 patches 1 month, 2 weeks ago
drivers/infiniband/hw/hfi1/pcie.c        | 14 +++-----------
drivers/infiniband/hw/mlx5/data_direct.c | 10 +++-------
2 files changed, 6 insertions(+), 18 deletions(-)
[PATCH 0/2] RDMA: Remove obsolete 32-bit DMA mask fallbacks
Posted by Ruizhe Zhou 1 month, 2 weeks ago
hfi1 and mlx5 data direct both set a 64-bit DMA mask and retry with a
32-bit mask if the first call fails. This treats the return value of
dma_set_mask_and_coherent() as an indication that the platform requires
a narrower DMA width.

That is not a correct interpretation of dma_set_mask_and_coherent().
The mask describes the DMA addresses the device can accept and constrains
subsequent mappings to that range. A 64-bit mask includes every address
permitted by a 32-bit mask, including addresses from a platform that only
produces 32-bit DMA addresses. Retrying with 32 bits therefore adds a stricter
constraint and cannot correct a failure to establish the 64-bit mask.
The DMA API HOWTO explicitly calls this fallback pattern incorrect [1].
See [2] and [3] for details.

This series removes both fallbacks while retaining the return-value
checks. DMA setup errors are still reported and still abort device
initialization.

Testing was compile-only. No hardware testing was performed.

[1] DMA API HOWTO, "DMA addressing capabilities"
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities

[2] DMA direct addressability change, commit 91ef26f91417
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=91ef26f914171cf753330f13724fd9142b5b1640

[3] DMA HOWTO correction, commit f7ae20f2fc4e
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7ae20f2fc4e

Ruizhe Zhou (2):
  RDMA/hfi1: Remove obsolete 32-bit DMA mask fallback
  RDMA/mlx5: Remove obsolete 32-bit DMA mask fallback

 drivers/infiniband/hw/hfi1/pcie.c        | 14 +++-----------
 drivers/infiniband/hw/mlx5/data_direct.c | 10 +++-------
 2 files changed, 6 insertions(+), 18 deletions(-)


base-commit: a12d9145145b21c50531afb6e3f711b1f34e1465
--
2.27.0
Re: [PATCH 0/2] RDMA: Remove obsolete 32-bit DMA mask fallbacks
Posted by Leon Romanovsky 3 weeks, 6 days ago
On Wed, 12 Aug 2026 11:36:45 +0800, Ruizhe Zhou wrote:
> hfi1 and mlx5 data direct both set a 64-bit DMA mask and retry with a
> 32-bit mask if the first call fails. This treats the return value of
> dma_set_mask_and_coherent() as an indication that the platform requires
> a narrower DMA width.
> 
> That is not a correct interpretation of dma_set_mask_and_coherent().
> The mask describes the DMA addresses the device can accept and constrains
> subsequent mappings to that range. A 64-bit mask includes every address
> permitted by a 32-bit mask, including addresses from a platform that only
> produces 32-bit DMA addresses. Retrying with 32 bits therefore adds a stricter
> constraint and cannot correct a failure to establish the 64-bit mask.
> The DMA API HOWTO explicitly calls this fallback pattern incorrect [1].
> See [2] and [3] for details.
> 
> [...]

Applied, thanks!

[1/2] RDMA/hfi1: Remove obsolete 32-bit DMA mask fallback
      https://git.kernel.org/rdma/rdma/c/901c15a2099d43
[2/2] RDMA/mlx5: Remove obsolete 32-bit DMA mask fallback
      https://git.kernel.org/rdma/rdma/c/08a978db86e877

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>