]> git.ipfire.org Git - thirdparty/linux.git/commit
RDMA/irdma: Do not directly rely on IB_PD_UNSAFE_GLOBAL_RKEY
authorJacob Moroni <jmoroni@google.com>
Tue, 25 Nov 2025 02:53:47 +0000 (20:53 -0600)
committerLeon Romanovsky <leon@kernel.org>
Wed, 26 Nov 2025 07:26:05 +0000 (02:26 -0500)
commit71d3bdae5eab21cf8991a6f3cd914caa31d5a51f
treed32fb109e19134d3900bb649b9394c8bd395488d
parent35bd787babd1f5a42641d0b1513edbed5d4e1624
RDMA/irdma: Do not directly rely on IB_PD_UNSAFE_GLOBAL_RKEY

The HW disables bounds checking for MRs with a length of zero, so
the driver will only allow a zero length MR if the "all_memory"
flag is set, and this flag is only set if IB_PD_UNSAFE_GLOBAL_RKEY
is set for the PD.

This means that the "get_dma_mr" method will currently fail unless
the IB_PD_UNSAFE_GLOBAL_RKEY flag is set. This has not been an issue
because the "get_dma_mr" method is only ever invoked if the device
does not support the local DMA key or if IB_PD_UNSAFE_GLOBAL_RKEY
is set, and so far, all IRDMA HW supports the local DMA lkey.

However, some new HW does not support the local DMA lkey, so the
"get_dma_mr" method needs to work without IB_PD_UNSAFE_GLOBAL_RKEY
being set.

To support HW that does not allow the local DMA lkey, the logic has
been changed to pass an explicit flag to indicate when a dma_mr is
being created so that the zero length will be allowed.

Also, the "all_memory" flag has been forced to false for normal MR
allocation since these MRs are never supposed to provide global
unsafe rkey semantics anyway; only the MR created with "get_dma_mr"
should support this.

Fixes: bb6d73d9add6 ("RDMA/irdma: Prevent zero-length STAG registration")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Link: https://patch.msgid.link/20251125025350.180-7-tatyana.e.nikolova@intel.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/irdma/cm.c
drivers/infiniband/hw/irdma/main.h
drivers/infiniband/hw/irdma/verbs.c
drivers/infiniband/hw/irdma/verbs.h