Re: [PATCH v3] vfio: Support VFIO_NOIOMMU with iommufd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 18, 2023 at 01:50:28PM -0400, Jason Gunthorpe wrote:
> Add a small amount of emulation to vfio_compat to accept the SET_IOMMU to
> VFIO_NOIOMMU_IOMMU and have vfio just ignore iommufd if it is working on a
> no-iommu enabled device.
> 
> Move the enable_unsafe_noiommu_mode module out of container.c into
> vfio_main.c so that it is always available even if VFIO_CONTAINER=n.
> 
> This passes Alex's mini-test:
> 
> https://github.com/awilliam/tests/blob/master/vfio-noiommu-pci-device-open.c
> 
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> ---
>  drivers/iommu/iommufd/Kconfig           |   2 +-
>  drivers/iommu/iommufd/iommufd_private.h |   2 +
>  drivers/iommu/iommufd/vfio_compat.c     | 105 +++++++++++++++++++-----
>  drivers/vfio/Kconfig                    |   2 +-
>  drivers/vfio/container.c                |   7 --
>  drivers/vfio/group.c                    |   7 +-
>  drivers/vfio/iommufd.c                  |  19 ++++-
>  drivers/vfio/vfio.h                     |   8 +-
>  drivers/vfio/vfio_main.c                |   7 ++
>  include/linux/iommufd.h                 |  12 ++-
>  10 files changed, 136 insertions(+), 35 deletions(-)
> 
> v3:
>  - Missed kdoc
>  - Incorrect indent
>  - Consolidate duplicate code into vfio_device_is_noiommu()
> v2: https://lore.kernel.org/r/0-v2-568c93fef076+5a-iommufd_noiommu_jgg@xxxxxxxxxx
>  - Passes Alex's test
>  - Fix a spelling error for s/CONFIG_VFIO_NO_IOMMU/CONFIG_VFIO_NOIOMMU/
>  - Prevent type1 mode from being requested and prevent a compat IOAS from being
>    auto created with an additional context global trap door flag
>  - Make it so VFIO_CONTAINER=n still creates the module option and related machinery
>  - Comment updates
> v1: https://lore.kernel.org/all/0-v1-5cde901db21d+661fe-iommufd_noiommu_jgg@xxxxxxxxxx
> 
> Alex, if you are good with this can you ack it and I'll send you a PR. Yi will
> need to rebase his series on top of it.

Alex are we OK?

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux