From: Zhiping Zhang <zhipingz@meta.com>
To: Alex Williamson <alex@shazbot.org>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>, <kvm@vger.kernel.org>,
<linux-rdma@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<netdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
Keith Busch <kbusch@kernel.org>, Yochai Cohen <yochai@nvidia.com>,
Yishai Hadas <yishaih@nvidia.com>,
Zhiping Zhang <zhipingz@meta.com>
Subject: [PATCH v4 0/3] vfio/dma-buf: add TPH support for peer-to-peer access
Date: Tue, 19 May 2026 13:13:48 -0700 [thread overview]
Message-ID: <20260519201401.1558410-1-zhipingz@meta.com> (raw)
This series adds TLP Processing Hints (TPH) support to the VFIO dma-buf
export path, allowing importing drivers (e.g. mlx5) to use the
exporter's steering tag when performing peer-to-peer DMA into a
VFIO-owned device.
Patch 1 adds the dma-buf get_tph callback and the new vfio uAPI.
Patch 2 exposes the enabled TPH requester type through a small PCI/TPH
helper so callers don't reach into pci_dev internals.
Patch 3 wires up the mlx5 RDMA driver as a consumer.
Changes since v3:
- vfio: TPH SET is now write-once per dma-buf; a second
VFIO_DEVICE_FEATURE_DMA_BUF_TPH on the same dma-buf returns -EBUSY.
- vfio: annotate priv->vdev with READ_ONCE/WRITE_ONCE across the
cleanup, release, and feature-set paths to make the existing
cleanup/release coordination explicit.
- vfio uAPI: shrink steering_tag from __u16 to __u8 to match the
8-bit ST width, and drop the trailing reserved[3] in
struct vfio_device_feature_dma_buf_tph (struct is now 12 bytes).
- Split the new PCI/TPH helper into its own patch (now patch 2) and
rename it from pcie_tph_get_st_width() to
pcie_tph_enabled_req_type(), exposing the enabled requester mode
rather than just the ST width.
- mlx5: release the allocated ST index before the MR is pushed back
to the FRMR pool, so a reused MR cannot reference a freed firmware
ST entry.
- mlx5: free mlx5_st_idx_data when its refcount reaches zero, fixing
a leak that accumulated across repeated alloc/dealloc cycles.
- Initialize ret in mlx5_st_create() and mlx5_st_alloc_index_by_tag()
to silence -Wsometimes-uninitialized warnings reported by the
kernel test robot under clang.
Previous link:
v3: https://lore.kernel.org/linux-pci/20260512184755.4137227-1-zhipingz@meta.com/
v2: https://lore.kernel.org/linux-pci/20260430200704.352228-1-zhipingz@meta.com/
Zhiping Zhang (3):
vfio: add dma-buf get_tph callback and DMA_BUF_TPH feature
PCI/TPH: expose the enabled TPH requester type
RDMA/mlx5: get tph for p2p access when registering dma-buf mr
drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 +
drivers/infiniband/hw/mlx5/mr.c | 86 ++++++++++-
.../net/ethernet/mellanox/mlx5/core/lib/st.c | 28 ++--
drivers/pci/tph.c | 12 ++
drivers/vfio/pci/vfio_pci_core.c | 3 +
drivers/vfio/pci/vfio_pci_dmabuf.c | 134 +++++++++++++++++-
drivers/vfio/pci/vfio_pci_priv.h | 12 ++
include/linux/dma-buf.h | 21 +++
include/linux/mlx5/driver.h | 7 +
include/linux/pci-tph.h | 2 +
include/uapi/linux/vfio.h | 35 +++++
11 files changed, 327 insertions(+), 19 deletions(-)
--
2.53.0-Meta
next reply other threads:[~2026-05-19 20:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 20:13 Zhiping Zhang [this message]
2026-05-19 20:13 ` [PATCH v4 1/3] vfio: add dma-buf get_tph callback and DMA_BUF_TPH feature Zhiping Zhang
2026-05-21 22:04 ` Alex Williamson
2026-05-21 22:24 ` Alex Williamson
2026-05-23 1:03 ` Zhiping Zhang
2026-05-22 23:53 ` Zhiping Zhang
2026-05-25 12:27 ` Claude review: " Claude Code Review Bot
2026-05-19 20:13 ` [PATCH v4 2/3] PCI/TPH: expose the enabled TPH requester type Zhiping Zhang
2026-05-25 12:27 ` Claude review: " Claude Code Review Bot
2026-05-19 20:13 ` [PATCH v4 3/3] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-05-25 12:27 ` Claude review: " Claude Code Review Bot
2026-05-25 12:27 ` Claude review: vfio/dma-buf: add TPH support for peer-to-peer access Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519201401.1558410-1-zhipingz@meta.com \
--to=zhipingz@meta.com \
--cc=alex@shazbot.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=helgaas@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kbusch@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yishaih@nvidia.com \
--cc=yochai@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox