Re: [PATCH 0/6] Make set_dev_pasid op supportting domain replacement

Jason Gunthorpe
2024-07-15T12:19:14Z

On Mon, Jul 15, 2024 at 08:16:40AM +0000, Tian, Kevin wrote:

> > Then the description is sort of like
> >
> > Replace is useful for iommufd/VFIO to provide perfect HW emulation in
> > case the VM is expecting to be able to change a PASID on the fly. As
> > AMD will only support PASID in VM's using nested translation where we
> > don't use the set_dev_pasid API leave it disabled for now.
> >
>
> yes that's clearer.
>
> btw I don't remember whether we have discussed the rationale behind
> the different driver semantics between RID and PASID. Currently RID
> replace is same as RID attach, with the driver simply blocking the old
> translation from the start and then no rollback upon failure when
> switching to the new domain (expecting the iommu core to recover),
> while for PASID replace we expect the driver to implement the hitless
> switch.
>
> Is it because there is no need of perfect HW emulation for RID or just
> to be cleaned up later?

Yeah, too much legacy it would be hard to go in and do something about
this for RID across every driver.

PASID can be a bit more well defined from the start since we only have
three drivers and two of them support replace.

An ideal driver should be like ARM and support hitless replace
whenever possible in all paths so there is no confusion within the
driver.

Jason