On 11/4/24 21:18, Yi Liu wrote:
There is no known usage that will attach SVA domain or detach SVA domain by replacing PASID to or from SVA domain. It is supposed to use the iommu_sva_{un}bind_device() which invoke the iommu_{at|de}tach_device_pasid(). So Intel iommu driver decides to fail the domain replacement if the old domain or new domain is SVA type.
I would suggest dropping this patch. The iommu driver now supports switching SVA domains to and from other types of domains. The current limitation comes from the iommu core, where the SVA interface doesn't use replace. Looking forward, iommu_detach_device_pasid() will be converted to switch an SVA domain to a blocking domain. Once this is implemented, perhaps the check and failure scenario will no longer be relevant. -- baolu