• Lu Baolu's avatar
    iommu: Add attach handle to struct iopf_group · 06cdcc32
    Lu Baolu authored
    Previously, the domain that a page fault targets is stored in an
    iopf_group, which represents a minimal set of page faults. With the
    introduction of attach handle, replace the domain with the handle
    so that the fault handler can obtain more information as needed
    when handling the faults.
    
    iommu_report_device_fault() is currently used for SVA page faults,
    which handles the page fault in an internal cycle. The domain is retrieved
    with iommu_get_domain_for_dev_pasid() if the pasid in the fault message
    is valid. This doesn't work in IOMMUFD case, where if the pasid table of
    a device is wholly managed by user space, there is no domain attached to
    the PASID of the device, and all page faults are forwarded through a
    NESTING domain attaching to RID.
    
    Add a static flag in iommu ops, which indicates if the IOMMU driver
    supports user-managed PASID tables. In the iopf deliver path, if no
    attach handle found for the iopf PASID, roll back to RID domain when
    the IOMMU driver supports this capability.
    
    iommu_get_domain_for_dev_pasid() is no longer used and can be removed.
    Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
    Link: https://lore.kernel.org/r/20240702063444.105814-4-baolu.lu@linux.intel.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    06cdcc32
iommu-sva.c 7.83 KB