On Fri, Aug 18, 2023 at 07:40:36AM +0800, Lu Baolu wrote: > When a user-managed page table is attached to an IOMMU, it is necessary > to deliver IO page faults to user space so that they can be handled > appropriately. One use case for this is nested translation, which is > currently being discussed in the mailing list. > > I have posted a RFC series [1] that describes the implementation of > delivering page faults to user space through IOMMUFD. This series has > received several comments on the IOMMU refactoring, which I am trying to > address in this series. Looking at this after all the patches are applied.. iommu_report_device_fault() and iommu_queue_iopf() should be put in the same file. iommu_queue_iopf() seems misnamed since it isn't queuing anything. It is delivering the fault to the domain. It is weird that iommu_sva_domain_alloc is not in the sva file iopf_queue_work() wrappers a work queue, but it should trampoline through another function before invoking the driver's callback and not invoke it with a weird work_struct - decode the group and get back the domain. Every single handler will require the group and domain. Same for domain->iopf_handler, the domain should be an argument if we are invoking the function on a domain. Perhaps group->domain is a simple answer. Jason