Re: [RFC PATCH v1 10/38] iommufd/vdevice: Add TSM map ioctl
From: Jason Gunthorpe
Date: Tue Jul 29 2025 - 10:31:52 EST
On Tue, Jul 29, 2025 at 02:07:55PM +0530, Aneesh Kumar K.V wrote:
> > But it looks really strange to have an iommufd ioctl that just calls a
> > KVM function. Feeling this should be a KVM function, or a guestmfd
> > behavior??
> >
> This functionality is equivalent to `IOMMU_IOAS_MAP`, but in the
> presence of firmware like RMM, we also need to supply the realm
> descriptor associated with the KVM instance.
There is no IOAS here because the secure world is using the KVM page
table. Since KVM owns this I don't see why iommufd should be invovled
in any way.
You need KVM to push the guestmemfd to the RMM and pin all the memory.
> > I was kind of thinking it would be nice to have a guestmemfd mode that
> > was "pinned", meaning the memory is allocated and remains almost
> > always mapped into the TSM's page tables automatically. VFIO using
> > guests would set things this way.
>
> We need to allocate and free these pages dynamically as they are
> converted between private and shared states.
That's still within guestmemfd's area of concern and it can
immediately pin on state changes.
Jason