xref: /linux/drivers/vfio/Kconfig (revision 85e0d1de369cdf827dae8c759f40696de81b7ca7)
1# SPDX-License-Identifier: GPL-2.0-only
2menuconfig VFIO
3	tristate "VFIO Non-Privileged userspace driver framework"
4	select IOMMU_API
5	depends on IOMMUFD || !IOMMUFD
6	select INTERVAL_TREE
7	select VFIO_GROUP if SPAPR_TCE_IOMMU || IOMMUFD=n
8	select VFIO_DEVICE_CDEV if !VFIO_GROUP
9	select VFIO_CONTAINER if IOMMUFD=n
10	help
11	  VFIO provides a framework for secure userspace device drivers.
12	  See Documentation/driver-api/vfio.rst for more details.
13
14	  If you don't know what to do here, say N.
15
16if VFIO
17config VFIO_DEVICE_CDEV
18	bool "Support for the VFIO cdev /dev/vfio/devices/vfioX"
19	depends on IOMMUFD && !SPAPR_TCE_IOMMU
20	default !VFIO_GROUP
21	help
22	  The VFIO device cdev is another way for userspace to get device
23	  access. Userspace gets device fd by opening device cdev under
24	  /dev/vfio/devices/vfioX, and then bind the device fd with an iommufd
25	  to set up secure DMA context for device access.
26
27	  If you don't know what to do here, say N.
28
29config VFIO_GROUP
30	bool "Support for the VFIO group /dev/vfio/$group_id"
31	default y
32	help
33	   VFIO group support provides the traditional model for accessing
34	   devices through VFIO and is used by the majority of userspace
35	   applications and drivers making use of VFIO.
36
37	   If you don't know what to do here, say Y.
38
39config VFIO_CONTAINER
40	bool "Support for the VFIO container /dev/vfio/vfio"
41	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
42	depends on VFIO_GROUP
43	default y
44	help
45	  The VFIO container is the classic interface to VFIO for establishing
46	  IOMMU mappings. If N is selected here then IOMMUFD must be used to
47	  manage the mappings.
48
49	  Unless testing IOMMUFD say Y here.
50
51if VFIO_CONTAINER
52config VFIO_IOMMU_TYPE1
53	tristate
54	default n
55
56config VFIO_IOMMU_SPAPR_TCE
57	tristate
58	depends on SPAPR_TCE_IOMMU
59	default VFIO
60endif
61
62config VFIO_NOIOMMU
63	bool "VFIO No-IOMMU support"
64	depends on VFIO_GROUP || (VFIO_DEVICE_CDEV && !GENERIC_ATOMIC64)
65	depends on !VFIO_GROUP || VFIO_CONTAINER || IOMMUFD_VFIO_CONTAINER
66	select IOMMUFD_NOIOMMU if VFIO_DEVICE_CDEV && !GENERIC_ATOMIC64
67	help
68	  VFIO is built on the ability to isolate devices using the IOMMU.
69	  Only with an IOMMU can userspace access to DMA capable devices be
70	  considered secure.  VFIO No-IOMMU mode enables IOMMU groups for
71	  devices without IOMMU backing for the purpose of re-using the VFIO
72	  infrastructure in a non-secure mode.  Use of this mode will result
73	  in an unsupportable kernel and will therefore taint the kernel.
74	  Device assignment to virtual machines is also not possible with
75	  this mode since there is no IOMMU to provide DMA translation.
76
77	  If you don't know what to do here, say N.
78
79config VFIO_VIRQFD
80	bool
81	select EVENTFD
82	default n
83
84config VFIO_DEBUGFS
85	bool "Export VFIO internals in DebugFS"
86	depends on DEBUG_FS
87	help
88	  Allows exposure of VFIO device internals. This option enables
89	  the use of debugfs by VFIO drivers as required. The device can
90	  cause the VFIO code create a top-level debug/vfio directory
91	  during initialization, and then populate a subdirectory with
92	  entries as required.
93
94source "drivers/vfio/pci/Kconfig"
95source "drivers/vfio/platform/Kconfig"
96source "drivers/vfio/mdev/Kconfig"
97source "drivers/vfio/fsl-mc/Kconfig"
98source "drivers/vfio/cdx/Kconfig"
99endif
100
101source "virt/lib/Kconfig"
102