Re: [PATCH 2/5] iommu: Add domain_alloc_identity()

Robin Murphy
2025-02-12T14:16:58Z

On 2025-02-12 2:03 pm, Jason Gunthorpe wrote:
> On Wed, Feb 12, 2025 at 01:56:55PM +0000, Robin Murphy wrote:
>> On 2025-02-07 2:46 pm, Jason Gunthorpe wrote:
>>> virtio-iommu has a mode where the IDENTITY domain is actually a paging
>>> domain with an identity mapping covering some of the system address
>>> space manually created.
>>>
>>> To support this add a new domain_alloc_identity() op that accepts
>>> the struct device so that virtio can allocate and fully finalize a
>>> paging domain to return.
>>
>> Oh, I'd already managed to forget this idea - this could be convenient for
>> DART to implement per-instance identity domain support as well.
>
> If we are going to broaden this someday then I suggest the core code should
> implement it entirely buy asking the driver for a paging domain and
> then mapping all of system memory into it. There is nothing special
> here that needs to be in driver code.

Sorry, that was just in terms of having a domain_alloc_identity() op
that's allowed to fail, being potentially neater than otherwise having
to register distinct per-instance ops with and without the static
identity_domain. I'm inclined to agree that if anyone really is
desperate for identity-mapped paging domains in the absence of true
identity support, then indeed we probably should handle that in core
code much like we do for improvised blocking domains.

Thanks,
Robin.