From: Baolu Lu baolu.lu@linux.intel.com Sent: Wednesday, September 27, 2023 10:05 AM
On 9/26/23 5:26 PM, Yi Liu wrote:
+/**
- iommu_replace_device_pasid - replace the domain that a pasid is
attached to
- @domain: new IOMMU domain to replace with
- @dev: the physical device
- @pasid: pasid that will be attached to the new domain
- This API allows the pasid to switch domains. Return 0 on success, or an
- error. The pasid will roll back to use the old domain if failure. The
- caller could call iommu_detach_device_pasid() before free the old
domain
- in order to avoid use-after-free case.
The comment does not match the actual behavior of the code. We need to discuss and agree on which state the PASID should park in if replacing the domain fails.
there is no legacy as in group_set_domain and iommufd is the only caller of this new function. So IMHO the description above is the right thing to do and the code should be updated to match it.