• Lu Baolu's avatar
    iommufd: Fault-capable hwpt attach/detach/replace · b7d88336
    Lu Baolu authored
    Add iopf-capable hw page table attach/detach/replace helpers. The pointer
    to iommufd_device is stored in the domain attachment handle, so that it
    can be echo'ed back in the iopf_group.
    
    The iopf-capable hw page tables can only be attached to devices that
    support the IOMMU_DEV_FEAT_IOPF feature. On the first attachment of an
    iopf-capable hw_pagetable to the device, the IOPF feature is enabled on
    the device. Similarly, after the last iopf-capable hwpt is detached from
    the device, the IOPF feature is disabled on the device.
    
    The current implementation allows a replacement between iopf-capable and
    non-iopf-capable hw page tables. This matches the nested translation use
    case, where a parent domain is attached by default and can then be
    replaced with a nested user domain with iopf support.
    
    Link: https://lore.kernel.org/r/20240702063444.105814-8-baolu.lu@linux.intel.comSigned-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    b7d88336
device.c 34 KB