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

Leon Romanovsky
2025-11-02T17:16:56Z

On Sun, Nov 2, 2025, at 19:11, Alex Williamson wrote:
> On Sun, 2 Nov 2025 17:12:53 +0200
> Leon Romanovsky <leon@kernel.org> wrote:
>> On Sun, Nov 02, 2025 at 08:01:37AM -0700, Alex Williamson wrote:
>> > We don't need the separate loop or flag, and adding it breaks the
>> > existing reverse list walk. Thanks,
>>
>> Do you want me to send v7? I have a feeling that v6 is good to be merged.
>
> Let's hold off, if this ends up being the only fixup I can roll it in.
> Thanks,

Thanks

>
> Alex
>
>> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
>> index 24204893e221..51a3bcc26f8b 100644
>> --- a/drivers/vfio/pci/vfio_pci_core.c
>> +++ b/drivers/vfio/pci/vfio_pci_core.c
>> @@ -2403,7 +2403,6 @@ 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;
>>
>> @@ -2473,7 +2472,6 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
>> }
>>
>> vfio_pci_dma_buf_move(vdev, true);
>> - restore_revoke = true;
>> vfio_pci_zap_bars(vdev);
>> }
>>
>> @@ -2501,15 +2499,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)
>> + vdev.dev_set_list) {
>> + if (__vfio_pci_memory_enabled(vdev))
>> + vfio_pci_dma_buf_move(vdev, false);
>> up_write(&vdev->memory_lock);
>> + }
>>
>> list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
>> pm_runtime_put(&vdev->pdev->dev);
>>
>>
>> >
>> > Alex
>> >
>>