]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
vfio: Prevent from pinned DMABUF importers to attach to VFIO DMABUF
authorLeon Romanovsky <leonro@nvidia.com>
Wed, 21 Jan 2026 15:45:02 +0000 (17:45 +0200)
committerAlex Williamson <alex@shazbot.org>
Fri, 23 Jan 2026 15:47:48 +0000 (08:47 -0700)
Some pinned importers, such as non-ODP RDMA ones, cannot invalidate their
mappings and therefore must be prevented from attaching to this exporter.

Fixes: 5d74781ebc86 ("vfio/pci: Add dma-buf export support for MMIO regions")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20260121-vfio-add-pin-v1-1-4e04916b17f1@nvidia.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
drivers/vfio/pci/vfio_pci_dmabuf.c

index d4d0f7d08c53e2b9b756f00b0bd41b2cd3d5370d..4be4a85005cbcb23b2ff401bc1ae23b2d146c4b3 100644 (file)
@@ -20,6 +20,16 @@ struct vfio_pci_dma_buf {
        u8 revoked : 1;
 };
 
+static int vfio_pci_dma_buf_pin(struct dma_buf_attachment *attachment)
+{
+       return -EOPNOTSUPP;
+}
+
+static void vfio_pci_dma_buf_unpin(struct dma_buf_attachment *attachment)
+{
+       /* Do nothing */
+}
+
 static int vfio_pci_dma_buf_attach(struct dma_buf *dmabuf,
                                   struct dma_buf_attachment *attachment)
 {
@@ -76,6 +86,8 @@ static void vfio_pci_dma_buf_release(struct dma_buf *dmabuf)
 }
 
 static const struct dma_buf_ops vfio_pci_dmabuf_ops = {
+       .pin = vfio_pci_dma_buf_pin,
+       .unpin = vfio_pci_dma_buf_unpin,
        .attach = vfio_pci_dma_buf_attach,
        .map_dma_buf = vfio_pci_dma_buf_map,
        .unmap_dma_buf = vfio_pci_dma_buf_unmap,