From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Cc: "Vivek Kasireddy" <vivek.kasireddy@intel.com>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Leon Romanovsky" <leonro@nvidia.com>,
"Christian Koenig" <christian.koenig@amd.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Simona Vetter" <simona.vetter@ffwll.ch>,
"Matthew Brost" <matthew.brost@intel.com>,
"Dongwon Kim" <dongwon.kim@intel.com>
Subject: [RFC 0/8] dma-buf: Add support for mapping dmabufs via interconnects
Date: Tue, 14 Oct 2025 00:08:50 -0700 [thread overview]
Message-ID: <20251014071243.811884-1-vivek.kasireddy@intel.com> (raw)
In a typical dma-buf use case, a dmabuf exporter makes its buffer
buffer available to an importer by mapping it using DMA APIs
such as dma_map_sgtable() or dma_map_resource(). However, this
is not desirable in some cases where the exporter and importer
are directly connected via a physical or virtual link (or
interconnect) and the importer can access the buffer without
having it DMA mapped.
So, to address this scenario, this patch series adds APIs to map/
unmap dmabufs via interconnects and also provides a helper to
identify the first common interconnect between the exporter and
importer. Furthermore, this patch series also adds support for
IOV interconnect in the vfio-pci driver and Intel Xe driver.
The IOV interconnect is a virtual interconnect between an SRIOV
physical function (PF) and its virtual functions (VFs). And, for
the IOV interconnect, the addresses associated with a buffer are
shared using an xarray (instead of an sg_table) that is populated
with entries of type struct range.
The dma-buf patches in this series are based on ideas/suggestions
provided by Jason Gunthorpe, Christian Koenig and Thomas Hellström.
Note that the Xe driver patches in this series need to be rebased
in the next version to include feedback from the previous round
of review.
Patchset overview:
Patch 1-3: Add dma-buf APIs to map/unmap and match
Patch 4: Add support for IOV interconnect in vfio-pci driver
Patch 5: Add support for IOV interconnect in Xe driver
Patch 6-8: Create and use a new dma_addr array for LMEM based
dmabuf BOs to store translated addresses (DPAs)
This series is rebased on top of the following repo:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=dmabuf-vfio-v5
Associated Qemu patch series:
https://lore.kernel.org/qemu-devel/20251003234138.85820-1-vivek.kasireddy@intel.com/
Associated vfio-pci patch series:
https://lore.kernel.org/dri-devel/cover.1760368250.git.leon@kernel.org/
This series is tested using the following method:
- Run Qemu with the following relevant options:
qemu-system-x86_64 -m 4096m ....
-device ioh3420,id=root_port1,bus=pcie.0
-device x3130-upstream,id=upstream1,bus=root_port1
-device xio3130-downstream,id=downstream1,bus=upstream1,chassis=9
-device xio3130-downstream,id=downstream2,bus=upstream1,chassis=10
-device vfio-pci,host=0000:03:00.1,bus=downstream1
-device virtio-gpu,max_outputs=1,blob=true,xres=1920,yres=1080,bus=downstream2
-display gtk,gl=on
-object memory-backend-memfd,id=mem1,size=4096M
-machine q35,accel=kvm,memory-backend=mem1 ...
- Run Gnome Wayland with the following options in the Guest VM:
# cat /usr/lib/udev/rules.d/61-mutter-primary-gpu.rules
ENV{DEVNAME}=="/dev/dri/card1", TAG+="mutter-device-preferred-primary", TAG+="mutter-device-disable-kms-modifiers"
# XDG_SESSION_TYPE=wayland dbus-run-session -- /usr/bin/gnome-shell --wayland --no-x11 &
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Leon Romanovsky <leonro@nvidia.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Simona Vetter <simona.vetter@ffwll.ch>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Vivek Kasireddy (8):
dma-buf: Add support for map/unmap APIs for interconnects
dma-buf: Add a helper to match interconnects between exporter/importer
dma-buf: Add support for IOV interconnect
vfio/pci/dmabuf: Add support for IOV interconnect
drm/xe/dma_buf: Add support for IOV interconnect
drm/xe/pf: Add a helper function to get a VF's backing object in LMEM
drm/xe/bo: Create new dma_addr array for dmabuf BOs associated with
VFs
drm/xe/pt: Add an additional check for dmabuf BOs while doing bind
drivers/dma-buf/dma-buf.c | 113 +++++++++++++++-
drivers/gpu/drm/xe/xe_bo.c | 148 +++++++++++++++++++--
drivers/gpu/drm/xe/xe_bo_types.h | 12 ++
drivers/gpu/drm/xe/xe_dma_buf.c | 19 ++-
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 23 ++++
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h | 1 +
drivers/gpu/drm/xe/xe_pt.c | 8 ++
drivers/gpu/drm/xe/xe_sriov_pf_types.h | 19 +++
drivers/vfio/pci/vfio_pci_dmabuf.c | 141 +++++++++++++++++++-
include/linux/dma-buf-interconnect.h | 51 +++++++
include/linux/dma-buf.h | 20 +++
11 files changed, 540 insertions(+), 15 deletions(-)
create mode 100644 include/linux/dma-buf-interconnect.h
--
2.50.1
next reply other threads:[~2025-10-14 7:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 7:08 Vivek Kasireddy [this message]
2025-10-14 7:08 ` [RFC 1/8] dma-buf: Add support for map/unmap APIs for interconnects Vivek Kasireddy
2025-10-20 9:34 ` Thomas Hellström
2025-10-21 5:45 ` Kasireddy, Vivek
2025-10-28 13:58 ` Christian König
2025-10-28 14:05 ` Jason Gunthorpe
2025-10-28 14:14 ` Christian König
2025-10-28 14:44 ` Jason Gunthorpe
2025-10-14 7:08 ` [RFC 2/8] dma-buf: Add a helper to match interconnects between exporter/importer Vivek Kasireddy
2025-10-17 15:58 ` Kasireddy, Vivek
2025-10-14 7:08 ` [RFC 3/8] dma-buf: Add support for IOV interconnect Vivek Kasireddy
2025-10-14 7:08 ` [RFC 4/8] vfio/pci/dmabuf: " Vivek Kasireddy
2025-10-14 7:08 ` [RFC 5/8] drm/xe/dma_buf: " Vivek Kasireddy
2025-10-14 7:08 ` [RFC 6/8] drm/xe/pf: Add a helper function to get a VF's backing object in LMEM Vivek Kasireddy
2025-10-14 7:08 ` [RFC 7/8] drm/xe/bo: Create new dma_addr array for dmabuf BOs associated with VFs Vivek Kasireddy
2025-10-14 7:08 ` [RFC 8/8] drm/xe/pt: Add an additional check for dmabuf BOs while doing bind Vivek Kasireddy
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=20251014071243.811884-1-vivek.kasireddy@intel.com \
--to=vivek.kasireddy@intel.com \
--cc=christian.koenig@amd.com \
--cc=dongwon.kim@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=simona.vetter@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=thomas.hellstrom@linux.intel.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