|
|
Log in / Subscribe / Register

vfio/dma-buf: add TPH support for peer-to-peer access

From:  Zhiping Zhang <zhipingz-AT-meta.com>
To:  Alex Williamson <alex-AT-shazbot.org>, Jason Gunthorpe <jgg-AT-ziepe.ca>, Leon Romanovsky <leon-AT-kernel.org>, Sumit Semwal <sumit.semwal-AT-linaro.org>, Christian Konig <christian.koenig-AT-amd.com>
Subject:  [PATCH v5 0/4] vfio/dma-buf: add TPH support for peer-to-peer access
Date:  Tue, 26 May 2026 07:43:52 -0700
Message-ID:  <20260526144401.1485788-1-zhipingz@meta.com>
Cc:  Bjorn Helgaas <helgaas-AT-kernel.org>, <kvm-AT-vger.kernel.org>, <linux-rdma-AT-vger.kernel.org>, <linux-pci-AT-vger.kernel.org>, <netdev-AT-vger.kernel.org>, <dri-devel-AT-lists.freedesktop.org>, Keith Busch <kbusch-AT-kernel.org>, Yochai Cohen <yochai-AT-nvidia.com>, Yishai Hadas <yishaih-AT-nvidia.com>, Zhiping Zhang <zhipingz-AT-meta.com>
Archive-link:  Article

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 exposes the enabled TPH requester type through a small PCI/TPH
helper so callers don't reach into pci_dev internals.
Patch 2 adds the optional dma_buf_ops::get_tph callback to the dma-buf
framework so importers can fetch TPH metadata from an exporter.
Patch 3 implements get_tph in vfio-pci and adds the new uAPI
(VFIO_DEVICE_FEATURE_DMA_BUF_TPH) for userspace to attach the metadata.
Patch 4 wires up the mlx5 RDMA driver as a consumer.

Previous link:
v4: https://lore.kernel.org/linux-pci/20260519201401.1558410-...
v3: https://lore.kernel.org/linux-pci/20260512184755.4137227-...
v2: https://lore.kernel.org/linux-pci/20260430200704.352228-1...

Zhiping Zhang (4):
  PCI/TPH: expose the enabled TPH requester type
  dma-buf: add optional get_tph() callback
  vfio/pci: implement get_tph and DMA_BUF_TPH feature
  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            | 110 +++++++++++++++++-
 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                     |  37 ++++++
 11 files changed, 311 insertions(+), 13 deletions(-)

-- 
2.53.0-Meta



Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds