Re: [Intel-gfx] [PATCH 00/10] Connect VFIO to IOMMUFD

Yi Liu
2022-10-31T10:38:42Z

Hi Jason,

On 2022/10/26 02:17, Jason Gunthorpe wrote:
> This series provides an alternative container layer for VFIO implemented
> using iommufd. This is optional, if CONFIG_IOMMUFD is not set then it will
> not be compiled in.
>
> At this point iommufd can be injected by passing in a iommfd FD to
> VFIO_GROUP_SET_CONTAINER which will use the VFIO compat layer in iommufd
> to obtain the compat IOAS and then connect up all the VFIO drivers as
> appropriate.
>
> This is temporary stopping point, a following series will provide a way to
> directly open a VFIO device FD and directly connect it to IOMMUFD using
> native ioctls that can expose the IOMMUFD features like hwpt, future
> vPASID and dynamic attachment.
>
> This series, in compat mode, has passed all the qemu tests we have
> available, including the test suites for the Intel GVT mdev. Aside from
> the temporary limitation with P2P memory this is belived to be fully
> compatible with VFIO.
>
> This is on github: https://github.com/jgunthorpe/linux/commits/vfio_iommufd

In our side, we found the gvt-g test failed. Guest i915 driver stuck at
init phase. While with your former version (commit ID
a249441ba6fd9d658f4a1b568453e3a742d12686), gvt-g test is passing. I
noticed there a quite a few change in iommufd/pages.c from last version.
We are internally tracing in the gvt-g side, may also good to have your
attention.

> It requires the iommufd series:
>
> https://lore.kernel.org/r/0-v3-402a7d6459de+24b-iommufd_jgg@nvidia.com
>
> Jason Gunthorpe (10):
> vfio: Move vfio_device driver open/close code to a function
> vfio: Move vfio_device_assign_container() into
> vfio_device_first_open()
> vfio: Rename vfio_device_assign/unassign_container()
> vfio: Move storage of allow_unsafe_interrupts to vfio_main.c
> vfio: Use IOMMU_CAP_ENFORCE_CACHE_COHERENCY for
> vfio_file_enforced_coherent()
> vfio-iommufd: Allow iommufd to be used in place of a container fd
> vfio-iommufd: Support iommufd for physical VFIO devices
> vfio-iommufd: Support iommufd for emulated VFIO devices
> vfio: Make vfio_container optionally compiled
> iommufd: Allow iommufd to supply /dev/vfio/vfio
>
> drivers/gpu/drm/i915/gvt/kvmgt.c | 3 +
> drivers/iommu/iommufd/Kconfig | 12 +
> drivers/iommu/iommufd/main.c | 35 +-
> drivers/s390/cio/vfio_ccw_ops.c | 3 +
> drivers/s390/crypto/vfio_ap_ops.c | 3 +
> drivers/vfio/Kconfig | 38 ++-
> drivers/vfio/Makefile | 5 +-
> drivers/vfio/container.c | 136 ++------
> drivers/vfio/fsl-mc/vfio_fsl_mc.c | 3 +
> drivers/vfio/iommufd.c | 161 +++++++++
> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 6 +
> drivers/vfio/pci/mlx5/main.c | 3 +
> drivers/vfio/pci/vfio_pci.c | 3 +
> drivers/vfio/platform/vfio_amba.c | 3 +
> drivers/vfio/platform/vfio_platform.c | 3 +
> drivers/vfio/vfio.h | 100 +++++-
> drivers/vfio/vfio_iommu_type1.c | 5 +-
> drivers/vfio/vfio_main.c | 318 ++++++++++++++----
> include/linux/vfio.h | 39 +++
> 19 files changed, 681 insertions(+), 198 deletions(-)
> create mode 100644 drivers/vfio/iommufd.c
>
>
> base-commit: 3bec937e94942a6aee8854be1c1f5cc2b92d15e2

--
Regards,
Yi Liu