From: Leon Romanovsky <leon@kernel.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "Leon Romanovsky" <leonro@nvidia.com>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Christian König" <christian.koenig@amd.com>,
dri-devel@lists.freedesktop.org, iommu@lists.linux.dev,
"Jens Axboe" <axboe@kernel.dk>, "Joerg Roedel" <joro@8bytes.org>,
kvm@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linux-mm@kvack.org,
linux-pci@vger.kernel.org,
"Logan Gunthorpe" <logang@deltatee.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Robin Murphy" <robin.murphy@arm.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Vivek Kasireddy" <vivek.kasireddy@intel.com>,
"Will Deacon" <will@kernel.org>
Subject: [PATCH v5 8/9] vfio/pci: Enable peer-to-peer DMA transactions by default
Date: Mon, 13 Oct 2025 18:26:10 +0300 [thread overview]
Message-ID: <a04c44aa4625a6edfadaf9c9e2c2afb460ad1857.1760368250.git.leon@kernel.org> (raw)
In-Reply-To: <cover.1760368250.git.leon@kernel.org>
From: Leon Romanovsky <leonro@nvidia.com>
Make sure that all VFIO PCI devices have peer-to-peer capabilities
enables, so we would be able to export their MMIO memory through DMABUF,
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/vfio/pci/vfio_pci_core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index ca9a95716a85..fe247d0e2831 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -28,6 +28,7 @@
#include <linux/nospec.h>
#include <linux/sched/mm.h>
#include <linux/iommufd.h>
+#include <linux/pci-p2pdma.h>
#if IS_ENABLED(CONFIG_EEH)
#include <asm/eeh.h>
#endif
@@ -2081,6 +2082,7 @@ int vfio_pci_core_init_dev(struct vfio_device *core_vdev)
{
struct vfio_pci_core_device *vdev =
container_of(core_vdev, struct vfio_pci_core_device, vdev);
+ int ret;
vdev->pdev = to_pci_dev(core_vdev->dev);
vdev->irq_type = VFIO_PCI_NUM_IRQS;
@@ -2090,6 +2092,9 @@ int vfio_pci_core_init_dev(struct vfio_device *core_vdev)
INIT_LIST_HEAD(&vdev->dummy_resources_list);
INIT_LIST_HEAD(&vdev->ioeventfds_list);
INIT_LIST_HEAD(&vdev->sriov_pfs_item);
+ ret = pcim_p2pdma_init(vdev->pdev);
+ if (ret != -EOPNOTSUPP)
+ return ret;
init_rwsem(&vdev->memory_lock);
xa_init(&vdev->ctx);
--
2.51.0
next prev parent reply other threads:[~2025-10-13 15:26 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 15:26 [PATCH v5 0/9] vfio/pci: Allow MMIO regions to be exported through dma-buf Leon Romanovsky
2025-10-13 15:26 ` [PATCH v5 1/9] PCI/P2PDMA: Separate the mmap() support from the core logic Leon Romanovsky
2025-10-17 6:30 ` Christoph Hellwig
2025-10-17 11:53 ` Jason Gunthorpe
2025-10-20 12:27 ` Christoph Hellwig
2025-10-20 12:58 ` Jason Gunthorpe
2025-10-20 15:04 ` Leon Romanovsky
2025-10-22 7:10 ` Christoph Hellwig
2025-10-22 11:43 ` Jason Gunthorpe
2025-10-13 15:26 ` [PATCH v5 2/9] PCI/P2PDMA: Simplify bus address mapping API Leon Romanovsky
2025-10-13 15:26 ` [PATCH v5 3/9] PCI/P2PDMA: Refactor to separate core P2P functionality from memory allocation Leon Romanovsky
2025-10-13 15:26 ` [PATCH v5 4/9] PCI/P2PDMA: Export pci_p2pdma_map_type() function Leon Romanovsky
2025-10-17 6:31 ` Christoph Hellwig
2025-10-17 12:14 ` Jason Gunthorpe
2025-10-20 12:29 ` Christoph Hellwig
2025-10-20 13:14 ` Jason Gunthorpe
2025-10-13 15:26 ` [PATCH v5 5/9] types: move phys_vec definition to common header Leon Romanovsky
2025-10-13 15:26 ` [PATCH v5 6/9] vfio: Export vfio device get and put registration helpers Leon Romanovsky
2025-10-13 15:26 ` [PATCH v5 7/9] vfio/pci: Share the core device pointer while invoking feature functions Leon Romanovsky
2025-10-13 15:26 ` Leon Romanovsky [this message]
2025-10-16 4:09 ` [PATCH v5 8/9] vfio/pci: Enable peer-to-peer DMA transactions by default Nicolin Chen
2025-10-16 6:10 ` Leon Romanovsky
2025-10-17 6:32 ` Christoph Hellwig
2025-10-17 11:55 ` Jason Gunthorpe
2025-10-20 12:28 ` Christoph Hellwig
2025-10-20 13:08 ` Jason Gunthorpe
2025-10-22 7:08 ` Christoph Hellwig
2025-10-22 11:38 ` Jason Gunthorpe
2025-10-22 11:54 ` Jason Gunthorpe
2025-10-13 15:26 ` [PATCH v5 9/9] vfio/pci: Add dma-buf export support for MMIO regions Leon Romanovsky
2025-10-16 23:53 ` Jason Gunthorpe
2025-10-17 5:40 ` Leon Romanovsky
2025-10-17 15:58 ` Jason Gunthorpe
2025-10-17 16:01 ` Jason Gunthorpe
2025-10-17 0:01 ` Jason Gunthorpe
2025-10-17 6:33 ` Christoph Hellwig
2025-10-17 12:16 ` Jason Gunthorpe
2025-10-17 13:02 ` Jason Gunthorpe
2025-10-17 16:13 ` Leon Romanovsky
2025-10-20 16:15 ` Jason Gunthorpe
2025-10-20 16:44 ` Leon Romanovsky
2025-10-20 16:51 ` Jason Gunthorpe
2025-10-17 23:40 ` Jason Gunthorpe
2025-10-22 12:50 ` Jason Gunthorpe
2025-10-26 7:55 ` Shuai Xue
2025-10-27 12:09 ` Jason Gunthorpe
2025-10-28 13:46 ` Shuai Xue
2025-10-27 23:13 ` David Matlack
2025-10-28 12:02 ` Leon Romanovsky
2025-10-30 22:28 ` Alex Mastro
[not found] ` <aQJF1wiWWWoIgHI0@devgpu015.cco6.facebook.com>
2025-10-29 18:21 ` Leon Romanovsky
2025-10-30 0:25 ` Samiullah Khawaja
2025-10-30 6:48 ` Leon Romanovsky
2025-10-30 12:57 ` Jason Gunthorpe
2025-10-30 20:38 ` Alex Williamson
2025-10-31 6:48 ` Leon Romanovsky
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=a04c44aa4625a6edfadaf9c9e2c2afb460ad1857.1760368250.git.leon@kernel.org \
--to=leon@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=leonro@nvidia.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=vivek.kasireddy@intel.com \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).