Re: [PATCH 0/7] Enable shared device assignment

David Hildenbrand
2025-01-20T12:57:42Z

On 15.01.25 13:49, Jason Gunthorpe wrote:
> On Wed, Jan 15, 2025 at 02:39:55PM +1100, Alexey Kardashevskiy wrote:
>>> The thread was talking about the built-in support in iommufd to split
>>> mappings.
>>
>> Just to clarify - I am talking about splitting only "iommufd areas", not
>> large pages.
>
> In generality it is the same thing as you cannot generally guarantee
> that an area split doesn't also cross a large page.
>
>> If all IOMMU PTEs are 4k and areas are bigger than 4K => the hw
>> support is not needed to allow splitting. The comments above and below seem
>> to confuse large pages with large areas (well, I am consufed, at least).
>
> Yes, in that special case yes.
>
>>> That built-in support is only accessible through legacy APIs
>>> and should never be used in new qemu code. To use that built in
>>> support in new code we need to build new APIs.
>>
>> Why would not IOMMU_IOAS_MAP/UNMAP uAPI work? Thanks,
>
> I don't want to overload those APIs, I prefer to see a new API that is
> just about splitting areas. Splitting is a special operation that can
> fail depending on driver support.

So we'd just always perform a split-before-unmap. If split fails, we're
in trouble, just like we would be when unmap would fail.

If the split succeeded, the unmap will succeed *and* be atomic.

That sounds reasonable to me and virtio-mem could benefit from that as well.

--
Cheers,

David / dhildenb