From: Moshe Shemesh Since commit b02289b3d60f ("RDMA: Validate grh_required when handling AVs"), mlx5_port_immutable() unconditionally issues QUERY_HCA_VPORT_CONTEXT on InfiniBand ports to read grh_required. Devices that do not support the InfiniBand virtualization interface (ib_virt cleared) are not guaranteed to implement this command. For example, Connect-IB with FW 10.10.5020 rejects it and mlx5_ib fails to probe: mlx5_core 0000:01:00.0: mlx5_cmd_out_err:810:(pid 731): QUERY_HCA_VPORT_CONTEXT(0x762) op_mod(0x0) failed, status bad operation(0x2), syndrome (0x3590f5), err(-22) infiniband mlx5_0: Couldn't create per-port data mlx5_ib.rdma: probe of mlx5_core.rdma.0 failed with error -12 All other HCA vport context users in mlx5_ib are already gated on ib_virt, either directly, as in set_has_smi_cap(), mlx5_ib_get_plane_num() and mlx5_ib_modify_port(), or via mlx5_use_mad_ifc(), which selects MAD_IFC for port queries when ib_virt is not supported. Skipping the query loses nothing. grh_required indicates a GID-based vport, which only exists with InfiniBand virtualization. Without ib_virt the port is always LID-based and the field is zero, even on firmware that accepts the command. This also matches the behavior before b02289b3d60f, when grh_required was filled in only by mlx5_query_hca_port() and was never set on the MAD_IFC path. Fixes: b02289b3d60f ("RDMA: Validate grh_required when handling AVs") Cc: stable@vger.kernel.org Reported-by: Tony Battersby Closes: https://lore.kernel.org/all/064dfa67-8fd4-40f0-b925-6d1e0cd42e6a@cybernetics.com/ Tested-by: Tony Battersby Signed-off-by: Moshe Shemesh Signed-off-by: Edward Srouji --- drivers/infiniband/hw/mlx5/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 65455aedd559b6291831492e92a68b24a6bd361e..2ab38068db838880419f1f9d446c6527bc567c59 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3536,7 +3536,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u32 port_num, if (err) return err; - if (ll == IB_LINK_LAYER_INFINIBAND) { + if (ll == IB_LINK_LAYER_INFINIBAND && + MLX5_CAP_GEN(dev->mdev, ib_virt)) { if (ibdev->type == RDMA_DEVICE_TYPE_SMI) port_num = smi_to_native_portnum(dev, port_num); --- base-commit: 915fb85a378e02f22c9bc3c9c9166582d276629e change-id: 20261111-moshe-ib-virt-guard-ecedee769166 Best regards, -- Edward Srouji