Re: [PATCH 07/10] vfio: Move vfio_external_check_extension() to vfio_file_ops

Jason Gunthorpe
2022-04-19T19:23:47Z

On Fri, Apr 15, 2022 at 04:07:51AM +0000, Tian, Kevin wrote:

> > + struct vfio_group *group = filep->private_data;
> > + bool ret;
> > +
> > + /*
> > + * Since the coherency state is determined only once a container is
> > + * attached the user must do so before they can prove they have
> > + * permission.
> > + */
> > + if (vfio_group_add_container_user(group))
> > + return true;
>
> I wonder whether it's better to return error here and let KVM to
> decide whether it wants to allow wbinvd in such case (though
> likely the conclusion is same) or simply rejects adding the group.

Since the new model is to present proof at add it is OK - it just
means the user doesn't have a proof to enable wbinvd.

The thing that is missing here is a notifier so kvm can track changes
in the group's assigned iommu_domain, but I think it is not necessary..

Jason