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

Jason Gunthorpe
2024-11-05T14:43:44Z

On Tue, Nov 05, 2024 at 11:30:25AM +0800, 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.

Me too

Drivers should not make assumptions like this, the driver facing API
is clear, set_dev_pasid() is supposed to make the pasid domain the
translation for the pasid and replace whatever happened to be there.
Ideally hitlessly.

Good driver structure should not require caring what used to be
attached to the PASID.

Jason