mirror of
https://github.com/torvalds/linux.git
synced 2026-10-16 04:39:02 +02:00
Create just a little part of a real iommu driver, enough to slot in under the dev_iommu_ops() and allow iommufd to call domain_alloc_paging_flags() and fail everything else. This allows explicitly creating a HWPT under an IOAS. A new Kconfig option IOMMUFD_NOIOMMU is introduced to differentiate from the VFIO group/container based noiommu mode. Link: https://patch.msgid.link/r/8d1ad0b90db0381d4139eda5c126cc8d168d89f8.1783360051.git.jacob.pan@linux.microsoft.com Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Samiullah Khawaja <skhawaja@google.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Pranjal Shrivastava <praan@google.com> Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com> Fixes: 2c6cf6ab1564 ("iommufd: Allow binding to a noiommu device") Reviewed-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
64 lines
2.1 KiB
Plaintext
64 lines
2.1 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
config IOMMUFD_DRIVER_CORE
|
|
bool
|
|
default (IOMMUFD_DRIVER || IOMMUFD) if IOMMUFD!=n
|
|
|
|
config IOMMUFD
|
|
tristate "IOMMU Userspace API"
|
|
select INTERVAL_TREE
|
|
select INTERVAL_TREE_SPAN_ITER
|
|
select IOMMU_API
|
|
default n
|
|
help
|
|
Provides /dev/iommu, the user API to control the IOMMU subsystem as
|
|
it relates to managing IO page tables that point at user space memory.
|
|
|
|
If you don't know what to do here, say N.
|
|
|
|
if IOMMUFD
|
|
config IOMMUFD_NOIOMMU
|
|
bool
|
|
depends on !GENERIC_ATOMIC64 # IOMMU_PT_AMDV1 requires cmpxchg64
|
|
select GENERIC_PT
|
|
select IOMMU_PT
|
|
select IOMMU_PT_AMDV1
|
|
help
|
|
Provides a SW-only IO page table for devices without hardware
|
|
IOMMU backing. This uses the AMDV1 page table format for
|
|
IOVA-to-PA lookups only, not for hardware DMA translation.
|
|
To be selected by VFIO_NOIOMMU when VFIO_DEVICE_CDEV is enabled.
|
|
|
|
config IOMMUFD_VFIO_CONTAINER
|
|
bool "IOMMUFD provides the VFIO container /dev/vfio/vfio"
|
|
depends on VFIO_GROUP && !VFIO_CONTAINER
|
|
default VFIO_GROUP && !VFIO_CONTAINER
|
|
help
|
|
IOMMUFD will provide /dev/vfio/vfio instead of VFIO. This relies on
|
|
IOMMUFD providing compatibility emulation to give the same ioctls.
|
|
It provides an option to build a kernel with legacy VFIO components
|
|
removed.
|
|
|
|
IOMMUFD VFIO container emulation is known to lack certain features
|
|
of the native VFIO container, such as peer-to-peer
|
|
DMA mapping, PPC IOMMU support, as well as other potentially
|
|
undiscovered gaps. This option is currently intended for the
|
|
purpose of testing IOMMUFD with unmodified userspace supporting VFIO
|
|
and making use of the Type1 VFIO IOMMU backend. General purpose
|
|
enabling of this option is currently discouraged.
|
|
|
|
Unless testing IOMMUFD, say N here.
|
|
|
|
config IOMMUFD_TEST
|
|
bool "IOMMU Userspace API Test support"
|
|
depends on DEBUG_KERNEL
|
|
depends on FAULT_INJECTION
|
|
depends on RUNTIME_TESTING_MENU
|
|
depends on IOMMU_PT_AMDV1=y || IOMMUFD=IOMMU_PT_AMDV1
|
|
select DMA_SHARED_BUFFER
|
|
select IOMMUFD_DRIVER
|
|
default n
|
|
help
|
|
This is dangerous, do not enable unless running
|
|
tools/testing/selftests/iommu
|
|
endif
|