Re: [PATCH v5 0/5] cover-letter: Simplify vfio_iommu_type1 attach/detach routine

From: Nicolin Chen
Date: Wed Jul 06 2022 - 13:54:05 EST


On Wed, Jul 06, 2022 at 11:42:17AM -0600, Alex Williamson wrote:

> On Fri, 1 Jul 2022 14:44:50 -0700
> Nicolin Chen <nicolinc@xxxxxxxxxx> wrote:
>
> > This is a preparatory series for IOMMUFD v2 patches. It enforces error
> > code -EMEDIUMTYPE in iommu_attach_device() and iommu_attach_group() when
> > an IOMMU domain and a device/group are incompatible. It also drops the
> > useless domain->ops check since it won't fail in current environment.
> >
> > These allow VFIO iommu code to simplify its group attachment routine, by
> > avoiding the extra IOMMU domain allocations and attach/detach sequences
> > of the old code.
> >
> > Worths mentioning the exact match for enforce_cache_coherency is removed
> > with this series, since there's very less value in doing that as KVM will
> > not be able to take advantage of it -- this just wastes domain memory.
> > Instead, we rely on Intel IOMMU driver taking care of that internally.
> >
> > This is on github:
> > https://github.com/nicolinc/iommufd/commits/vfio_iommu_attach
>
> How do you foresee this going in, I'm imagining Joerg would merge the
> first patch via the IOMMU tree and provide a topic branch that I'd
> merge into the vfio tree along with the remaining patches. Sound
> right? Thanks,

We don't have any build dependency between the IOMMU change and
VFIO changes, yet, without the IOMMU one, any iommu_attach_group()
failure now would be a hard failure without a chance falling back
to a new_domain, which is slightly different from the current flow.

For a potential existing use case that relies on reusing existing
domain, I think it'd be safer to have Joerg acking the first change
so you merge them all? Thank!