Re: [PATCH v4 10/13] iommu/vt-d: Fail SVA domain replacement

Yi Liu
2024-11-05T05:25:56Z

On 2024/11/5 11:30, Baolu Lu wrote:
> 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.

I also noticed other iommu drivers (like ARM SMMUv3 and AMD iommu) would
support SVA replacement. So may we also make intel_svm_set_dev_pasid() be
able to handle the case in which @old==non-null? At first, it looks to be
dead code when SVA interface does not use replace. But this may make all
drivers aligned.

> 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.

you are right.

--
Regards,
Yi Liu