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

Alex Williamson
2025-11-02T15:01:46Z

On Sun, 2 Nov 2025 10:00:58 +0200
Leon Romanovsky <leon@kernel.org> wrote:
> @@ -2391,6 +2403,7 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> struct iommufd_ctx *iommufd_ctx)
> {
> struct vfio_pci_core_device *vdev;
> + bool restore_revoke = false;
> struct pci_dev *pdev;
> int ret;
>
> @@ -2459,6 +2472,8 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> break;
> }
>
> + vfio_pci_dma_buf_move(vdev, true);
> + restore_revoke = true;
> vfio_pci_zap_bars(vdev);
> }
>
> @@ -2486,6 +2501,12 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> struct vfio_pci_core_device, vdev.dev_set_list);
>
> err_undo:
> + if (restore_revoke) {
> + list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
> + if (__vfio_pci_memory_enabled(vdev))
> + vfio_pci_dma_buf_move(vdev, false);
> + }
> +
> list_for_each_entry_from_reverse(vdev, &dev_set->device_list,
> vdev.dev_set_list)

We don't need the separate loop or flag, and adding it breaks the
existing reverse list walk. Thanks,

Alex