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

Tian, Kevin
2024-11-06T07:58:48Z

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Tuesday, November 5, 2024 10:44 PM
>
> 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.
>

Agree