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

Jason Gunthorpe
2025-02-12T14:45:48Z

On Wed, Feb 12, 2025 at 02:16:54PM +0000, Robin Murphy wrote:
> 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.

Oh, I see, yes, that would be much better that the tricks drivers do
with the default domain too.

Jason