Re: [PATCH v7 10/11] vfio/pci: Add dma-buf export support for MMIO regions

From: Alex Williamson
Date: Mon Nov 10 2025 - 15:06:01 EST


On Thu, 6 Nov 2025 16:16:55 +0200
Leon Romanovsky <leon@xxxxxxxxxx> wrote:
> diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci_dmabuf.c
> new file mode 100644
> index 000000000000..cbf502b14e3c
> --- /dev/null
> +++ b/drivers/vfio/pci/vfio_pci_dmabuf.c
...
> +
> +int vfio_pci_core_feature_dma_buf(struct vfio_pci_core_device *vdev, u32 flags,
> + struct vfio_device_feature_dma_buf __user *arg,
> + size_t argsz)
> +{
> + struct vfio_device_feature_dma_buf get_dma_buf = {};
> + struct vfio_region_dma_range *dma_ranges;
> + DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
> + struct vfio_pci_dma_buf *priv;
> + size_t length;
> + int ret;
> +
> + if (!vdev->pci_ops->get_dmabuf_phys)


vdev->pci_ops can be NULL.

Thanks,
Alex