On Thu, Mar 14, 2024 at 03:41:23PM +0800, Baolu Lu wrote:
The whole cookie mechanism aims to address two things:Like you answered, I think the flush is a simpler scheme..
- Extend the domain lifetime until all pending page faults are
resolved.
- Associate information about the iommu device with each attachment of
the domain so that the iommufd device object ID could be quickly
retrieved in the fault delivering path.
It does make sense you'd need that, but I think something like this isI see we also need to stick a pointer in the domain for iommufd to getIt's not getting back hwpt from domain, just getting the iommufd_device
back to the hwpt, but that doesn't seem to need such a big system to
accomplish - just add a void *. It would make sense for the domain to
have some optional pointer to a struct for all the fault related data
that becomes allocated when a PRI domain is created..
in the fault delivering path. The iommufd_device is not per-domain, but
per-domain-attachment.
a more direct way to get it. Caller allocates the handle struct. The
iopf will provide the handle from the XA to the
callback. container_of() not void * is used to in the caller's API.