All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] RDMA/mlx5: Skip vport context query on FW without ib_virt" failed to apply to 6.1-stable tree
@ 2026-12-02 13:38 gregkh
  2026-12-04  4:20 ` [PATCH 6.1.y] RDMA/mlx5: Skip vport context query on FW without ib_virt support Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-12-02 13:38 UTC (permalink / raw)
  To: moshe, edwards, leon, tonyb; +Cc: stable


The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x e7732ec135b501e87ab060d992b3b5f2ec4396c9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120252-growing-fifth-4da3@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e7732ec135b501e87ab060d992b3b5f2ec4396c9 Mon Sep 17 00:00:00 2001
From: Moshe Shemesh <moshe@nvidia.com>
Date: Thu, 12 Nov 2026 15:27:19 +0200
Subject: [PATCH] RDMA/mlx5: Skip vport context query on FW without ib_virt
 support

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 <tonyb@cybernetics.com>
Closes: https://lore.kernel.org/all/064dfa67-8fd4-40f0-b925-6d1e0cd42e6a@cybernetics.com/
Tested-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Link: https://patch.msgid.link/20261112-moshe-ib-virt-guard-v1-1-6d2caf8bdb1b@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 65455aedd559..2ab38068db83 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);
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 6.1.y] RDMA/mlx5: Skip vport context query on FW without ib_virt support
  2026-12-02 13:38 FAILED: patch "[PATCH] RDMA/mlx5: Skip vport context query on FW without ib_virt" failed to apply to 6.1-stable tree gregkh
@ 2026-12-04  4:20 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-12-04  4:20 UTC (permalink / raw)
  To: stable
  Cc: Moshe Shemesh, Tony Battersby, Edward Srouji, Leon Romanovsky,
	Sasha Levin

From: Moshe Shemesh <moshe@nvidia.com>

[ Upstream commit e7732ec135b501e87ab060d992b3b5f2ec4396c9 ]

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 <tonyb@cybernetics.com>
Closes: https://lore.kernel.org/all/064dfa67-8fd4-40f0-b925-6d1e0cd42e6a@cybernetics.com/
Tested-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Link: https://patch.msgid.link/20261112-moshe-ib-virt-guard-v1-1-6d2caf8bdb1b@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Context lines adjusted: the backport's surrounding code calls mlx5_query_hca_vport_context() directly, without the upstream smi_to_native_portnum() port translation. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 a1a6aca8aff1b..598f356623648 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -2928,7 +2928,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)) {
 		err = mlx5_query_hca_vport_context(dev->mdev, 0, port_num, 0,
 						   &rep);
 		if (err)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  4:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 13:38 FAILED: patch "[PATCH] RDMA/mlx5: Skip vport context query on FW without ib_virt" failed to apply to 6.1-stable tree gregkh
2026-12-04  4:20 ` [PATCH 6.1.y] RDMA/mlx5: Skip vport context query on FW without ib_virt support Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.