[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260103053842.984489-1-zhipingz@meta.com>
Date: Fri, 2 Jan 2026 21:38:35 -0800
From: Zhiping Zhang <zhipingz@...a.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: Leon Romanovsky <leon@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
<linux-rdma@...r.kernel.org>, <linux-pci@...r.kernel.org>,
<netdev@...r.kernel.org>, Keith Busch <kbusch@...nel.org>,
Yochai Cohen
<yochai@...dia.com>, Yishai Hadas <yishaih@...dia.com>,
Zhiping Zhang
<zhipingz@...a.com>
Subject: [RFC 2/2] [fix] mlx5: modifications for use cases other than CPU
In order to set the tag value properly besides the CPU use case, we need
to also fix and modify the few checks on CPU_ID in mlx5 RDMA code.
Signed-off-by: Zhiping Zhang <zhipingz@...a.com>
> [RFC 2/2] RDMA: Set steering-tag value directly for P2P memory access
>
> Currently, the steering tag can be used for a CPU on the motherboard; the
> ACPI check is in place to query and obtain the supported steering tag. This
> same check is not possible for the accelerator devices because they are
> designed to be plug-and-play to and ownership can not be always confirmed.
>
> We intend to use the steering tag to improve RDMA NIC memory access on a GPU
> or accelerator device via PCIe peer-to-peer. An application can construct a
> dma handler (DMAH) with the device memory type and a direct steering-tag
> value, and this DMAH can be used to register a RDMA memory region with DMABUF
> for the RDMA NIC to access the device memory. The steering tag contains
> additional instructions or hints to the GPU or accelerator device for
> advanced memory operations, such as, read cache selection.
>
> Signed-off-by: Zhiping Zhang <zhipingz@...a.com>
---
drivers/infiniband/hw/mlx5/dmah.c | 3 ++-
drivers/infiniband/hw/mlx5/mr.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/dmah.c b/drivers/infiniband/hw/mlx5/dmah.c
index 98c8d3313653..c0d8532f94ac 100644
--- a/drivers/infiniband/hw/mlx5/dmah.c
+++ b/drivers/infiniband/hw/mlx5/dmah.c
@@ -41,7 +41,8 @@ static int mlx5_ib_dealloc_dmah(struct ib_dmah *ibdmah,
struct mlx5_ib_dmah *dmah = to_mdmah(ibdmah);
struct mlx5_core_dev *mdev = to_mdev(ibdmah->device)->mdev;
- if (ibdmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS))
+ if (ibdmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS) ||
+ ibdmah->valid_fields & BIT(IB_DMAH_DIRECT_ST_VAL_EXISTS))
return mlx5_st_dealloc_index(mdev, dmah->st_index);
return 0;
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index d4917d5c2efa..fb0e0c5826c2 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1470,7 +1470,8 @@ static struct ib_mr *create_real_mr(struct ib_pd *pd, struct ib_umem *umem,
struct mlx5_ib_dmah *mdmah = to_mdmah(dmah);
ph = dmah->ph;
- if (dmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS))
+ if (dmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS) ||
+ dmah->valid_fields & BIT(IB_DMAH_DIRECT_ST_VAL_EXISTS))
st_index = mdmah->st_index;
}
@@ -1660,7 +1661,8 @@ reg_user_mr_dmabuf(struct ib_pd *pd, struct device *dma_device,
struct mlx5_ib_dmah *mdmah = to_mdmah(dmah);
ph = dmah->ph;
- if (dmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS))
+ if (dmah->valid_fields & BIT(IB_DMAH_CPU_ID_EXISTS) ||
+ dmah->valid_fields & BIT(IB_DMAH_DIRECT_ST_VAL_EXISTS))
st_index = mdmah->st_index;
}
--
2.47.3
Powered by blists - more mailing lists