>-----Original Message-----
>From: Cédric Le Goater <[email protected]>
>Subject: Re: [PATCH 1/2] vfio/container: Support unmap all in one ioctl()
>
>On 10/1/25 00:04, John Levon wrote:
>> On Tue, Sep 30, 2025 at 05:26:59PM +0200, Cédric Le Goater wrote:
>>
>>>> -        }
>>>> +        ret = ioctl(container->fd, VFIO_CHECK_EXTENSION,
>VFIO_UNMAP_ALL);
>>>
>>> Could we introduce an helper to test 'unmap_all' support in the host
>>> kernel ? The result would be something like :
>>>
>>>    if (unmap_all) {
>>>          if
>(vfio_legacy_has_unmap_all(VFIO_IOMMU_LEGACY(bcontainer))) {
>>>              flags = VFIO_DMA_UNMAP_FLAG_ALL;
>>>          } else {
>>>              /* The unmap ioctl doesn't accept a full 64-bit span. */
>>>              Int128 llsize = int128_rshift(int128_2_64(), 1);
>>>              ...
>>>          }
>>>    }
>>
>> For reference/consideration, the previous approach taken in the vfio-user
>> series:
>>
>>
>https://lore.kernel.org/qemu-devel/20250219144858.266455-4-john.levon@
>nutanix.com/
>>
>> @@ -533,6 +562,11 @@ static bool vfio_legacy_setup(VFIOContainerBase
>*bcontainer, Error **errp)
>>       vfio_get_info_iova_range(info, bcontainer);
>>
>>       vfio_get_iommu_info_migration(container, info);
>> +
>> +    ret = ioctl(container->fd, VFIO_CHECK_EXTENSION,
>VFIO_UNMAP_ALL);
>> +
>> +    container->unmap_all_supported = (ret != 0);

Good suggestion, thanks John.

>>
>> (I dropped this particular change as part of getting merged.)
>Yes. I'm reconsidering now.
>
>Should we introduce a VFIOContainerBase attribute/flag
>'unmap_all_supported',
>set in the vioc->setup handler ?

Do you mean to check bcontainer->unmap_all_supported and do the split in 
vfio_listener_region_del()?

If only checking it in legacy container, putting it in VFIOLegacyContainer 
sounds better?

Thanks
Zhenzhong

Reply via email to