Two opens about iommufd pasid + IOPF
Hi Kevin, Baolu, Jason,
I've got two opens when rebasing iommufd pasid series on top of 6.11. Would like to hear about your ideas. :)
1) How to retrieve attached domain for pasid in the iommu core. This is needed when adding domain replacement for pasid. In the before, it can be done by searching the group->pasid_array[1]. However, the group->pasid_array stores iommu_attach_handle after the iopf patch [2]. IIUC, iommu_attach_handle is passed only when the domain is iopf-capable. So, if the old domain does not support iopf, then it's not able to get this old domain from the group->pasid_array when trying to do domain replacement. :(
Not sure if any side-effect if I always pass an iommu_attach_handle even if the hwpt/domain is not iopf-capable. @Baolu?
2) Should I enable/disable IOPF when attaching/detaching pasid to/from domains just like patch [3] does?
[1] https://lore.kernel.org/linux-iommu/[email protected]/
[2] https://lore.kernel.org/linux-iommu/[email protected]/
[3] https://lore.kernel.org/linux-iommu/[email protected]/
Signature · 2 lines
Regards, Yi Liu
Quoted 5 lines · Yi Liu
Hi Kevin, Baolu, Jason,
I've got two opens when rebasing iommufd pasid series on top of 6.11. Would like to hear about your ideas. :)
Quoted 10 lines
1) How to retrieve attached domain for pasid in the iommu core. This is needed when adding domain replacement for pasid. In the before, it can be done by searching the group->pasid_array[1]. However, the
group->pasid_arraystoresiommu_attach_handleafter the iopf patch [2]. IIUC,iommu_attach_handleis passed only when the domain is iopf-capable. So, if the old domain does not support iopf, then it's not able to get this old domain from thegroup->pasid_arraywhen trying to do domain replacement. :(
Not sure if any side-effect if I always pass aniommu_attach_handleeven if the hwpt/domain is not iopf-capable. @Baolu?
You should always pass the handle
Alternatively you could use the xa based encoding I showed earlier to store either handles or naked domains in the xarray. But really it seems just fine to have iommufd allocate handle memory
Quoted 6 lines
2) Should I enable/disable IOPF when attaching/detaching pasid to/from domains just like patch [3] does?
[1] https://lore.kernel.org/linux-iommu/[email protected]/
[2] https://lore.kernel.org/linux-iommu/[email protected]/
[3] https://lore.kernel.org/linux-iommu/[email protected]/
I would really like to remove IOMMU_DEV_FEAT_IOPF...
Jason
Quoted 16 lines · Jason Gunthorpe
Quoted 5 lines · Yi Liu
Hi Kevin, Baolu, Jason,
I've got two opens when rebasing iommufd pasid series on top of 6.11. Would like to hear about your ideas. 🙂
Quoted 10 lines
1) How to retrieve attached domain for pasid in the iommu core. This is needed when adding domain replacement for pasid. In the before, it can be done by searching the group->pasid_array[1]. However, the
group->pasid_arraystoresiommu_attach_handleafter the iopf patch [2]. IIUC,iommu_attach_handleis passed only when the domain is iopf-capable. So, if the old domain does not support iopf, then it's not able to get this old domain from thegroup->pasid_arraywhen trying to do domain replacement. 🙁
Not sure if any side-effect if I always pass aniommu_attach_handleeven if the hwpt/domain is not iopf-capable. @Baolu?
Quoted 5 lines
You should always pass the handle
Alternatively you could use the xa based encoding I showed earlier to store either handles or naked domains in the xarray. But really it seems just fine to have iommufd allocate handle memory
That works.
An alternative approach is to separate replace_pasid from set_pasid. In that case, both new and old domains could be passed from iommufd to replace callback.
Quoted 7 lines
Quoted 6 lines
2) Should I enable/disable IOPF when attaching/detaching pasid to/from domains just like patch [3] does?
[1]https://lore.kernel.org/linux-iommu/[email protected]/ [2]https://lore.kernel.org/linux-iommu/[email protected]/ [3]https://lore.kernel.org/linux-iommu/[email protected]/
I would really like to remove
IOMMU_DEV_FEAT_IOPF...
That's reasonable. Then iopf is automatically enabled when the first iopf-capable domain is attached and disabled when the last such domain is detached.
Thanks,
baolu