Re: [PATCH 14/29] drm/i915/gvt: devirtualize ->{get,put}_vfio_device

From: Jason Gunthorpe
Date: Tue Nov 02 2021 - 12:49:34 EST


On Tue, Nov 02, 2021 at 08:05:46AM +0100, Christoph Hellwig wrote:
> Just open code the calls to the VFIO APIs.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> drivers/gpu/drm/i915/gvt/dmabuf.c | 12 ++++++-----
> drivers/gpu/drm/i915/gvt/hypercall.h | 2 --
> drivers/gpu/drm/i915/gvt/kvmgt.c | 22 --------------------
> drivers/gpu/drm/i915/gvt/mpt.h | 30 ----------------------------
> 4 files changed, 7 insertions(+), 59 deletions(-)

I suspect the use of get/put here is very questionable

It only prevents the vfio_device from becoming unregistered, but the
main thing a mdev should care about is if it is still beween
opne_device() / close_device() - ie the FD is open, there is a SW
IOMMU available, and memory pins can be made.

Still, not for this patch

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason