xref: /linux/drivers/iommu/iommufd/Kconfig (revision 67f8bc848ee31831336bd478e57d2f993551902e)
1# SPDX-License-Identifier: GPL-2.0-only
2config IOMMUFD_DRIVER_CORE
3	bool
4	default (IOMMUFD_DRIVER || IOMMUFD) if IOMMUFD!=n
5
6config IOMMUFD
7	tristate "IOMMU Userspace API"
8	select INTERVAL_TREE
9	select INTERVAL_TREE_SPAN_ITER
10	select IOMMU_API
11	default n
12	help
13	  Provides /dev/iommu, the user API to control the IOMMU subsystem as
14	  it relates to managing IO page tables that point at user space memory.
15
16	  If you don't know what to do here, say N.
17
18if IOMMUFD
19config IOMMUFD_NOIOMMU
20	bool
21	depends on !GENERIC_ATOMIC64 # IOMMU_PT_AMDV1 requires cmpxchg64
22	select GENERIC_PT
23	select IOMMU_PT
24	select IOMMU_PT_AMDV1
25	help
26	  Provides a SW-only IO page table for devices without hardware
27	  IOMMU backing. This uses the AMDV1 page table format for
28	  IOVA-to-PA lookups only, not for hardware DMA translation.
29	  To be selected by VFIO_NOIOMMU when VFIO_DEVICE_CDEV is enabled.
30
31config IOMMUFD_VFIO_CONTAINER
32	bool "IOMMUFD provides the VFIO container /dev/vfio/vfio"
33	depends on VFIO_GROUP && !VFIO_CONTAINER
34	default VFIO_GROUP && !VFIO_CONTAINER
35	help
36	  IOMMUFD will provide /dev/vfio/vfio instead of VFIO. This relies on
37	  IOMMUFD providing compatibility emulation to give the same ioctls.
38	  It provides an option to build a kernel with legacy VFIO components
39	  removed.
40
41	  IOMMUFD VFIO container emulation is known to lack certain features
42	  of the native VFIO container, such as peer-to-peer
43	  DMA mapping, PPC IOMMU support, as well as other potentially
44	  undiscovered gaps.  This option is currently intended for the
45	  purpose of testing IOMMUFD with unmodified userspace supporting VFIO
46	  and making use of the Type1 VFIO IOMMU backend.  General purpose
47	  enabling of this option is currently discouraged.
48
49	  Unless testing IOMMUFD, say N here.
50
51config IOMMUFD_TEST
52	bool "IOMMU Userspace API Test support"
53	depends on DEBUG_KERNEL
54	depends on FAULT_INJECTION
55	depends on RUNTIME_TESTING_MENU
56	depends on IOMMU_PT_AMDV1=y || IOMMUFD=IOMMU_PT_AMDV1
57	select DMA_SHARED_BUFFER
58	select IOMMUFD_DRIVER
59	default n
60	help
61	  This is dangerous, do not enable unless running
62	  tools/testing/selftests/iommu
63endif
64