xref: /linux/drivers/vfio/Kconfig (revision 67f8bc848ee31831336bd478e57d2f993551902e)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2cba3345cSAlex Williamsonmenuconfig VFIO
3cba3345cSAlex Williamson	tristate "VFIO Non-Privileged userspace driver framework"
4179209faSJason Gunthorpe	select IOMMU_API
52a3dab19SJason Gunthorpe	depends on IOMMUFD || !IOMMUFD
680c4b92aSYishai Hadas	select INTERVAL_TREE
7c1cce6d0SYi Liu	select VFIO_GROUP if SPAPR_TCE_IOMMU || IOMMUFD=n
8c1cce6d0SYi Liu	select VFIO_DEVICE_CDEV if !VFIO_GROUP
9e5a9ec7eSJason Gunthorpe	select VFIO_CONTAINER if IOMMUFD=n
10cba3345cSAlex Williamson	help
11cba3345cSAlex Williamson	  VFIO provides a framework for secure userspace device drivers.
12baa293e9SMauro Carvalho Chehab	  See Documentation/driver-api/vfio.rst for more details.
13cba3345cSAlex Williamson
14cba3345cSAlex Williamson	  If you don't know what to do here, say N.
1589e1f7d4SAlex Williamson
1685c94dcfSJason Gunthorpeif VFIO
178b6f173aSYi Liuconfig VFIO_DEVICE_CDEV
188b6f173aSYi Liu	bool "Support for the VFIO cdev /dev/vfio/devices/vfioX"
198b6f173aSYi Liu	depends on IOMMUFD && !SPAPR_TCE_IOMMU
20c1cce6d0SYi Liu	default !VFIO_GROUP
218b6f173aSYi Liu	help
228b6f173aSYi Liu	  The VFIO device cdev is another way for userspace to get device
238b6f173aSYi Liu	  access. Userspace gets device fd by opening device cdev under
248b6f173aSYi Liu	  /dev/vfio/devices/vfioX, and then bind the device fd with an iommufd
25*e8efdf02SJacob Pan	  to set up secure DMA context for device access.
268b6f173aSYi Liu
278b6f173aSYi Liu	  If you don't know what to do here, say N.
288b6f173aSYi Liu
29c1cce6d0SYi Liuconfig VFIO_GROUP
30c1cce6d0SYi Liu	bool "Support for the VFIO group /dev/vfio/$group_id"
31c1cce6d0SYi Liu	default y
32c1cce6d0SYi Liu	help
33c1cce6d0SYi Liu	   VFIO group support provides the traditional model for accessing
34c1cce6d0SYi Liu	   devices through VFIO and is used by the majority of userspace
35c1cce6d0SYi Liu	   applications and drivers making use of VFIO.
36c1cce6d0SYi Liu
37c1cce6d0SYi Liu	   If you don't know what to do here, say Y.
38c1cce6d0SYi Liu
39e5a9ec7eSJason Gunthorpeconfig VFIO_CONTAINER
40e5a9ec7eSJason Gunthorpe	bool "Support for the VFIO container /dev/vfio/vfio"
41e5a9ec7eSJason Gunthorpe	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
42c1cce6d0SYi Liu	depends on VFIO_GROUP
43e5a9ec7eSJason Gunthorpe	default y
44e5a9ec7eSJason Gunthorpe	help
45e5a9ec7eSJason Gunthorpe	  The VFIO container is the classic interface to VFIO for establishing
46e5a9ec7eSJason Gunthorpe	  IOMMU mappings. If N is selected here then IOMMUFD must be used to
47e5a9ec7eSJason Gunthorpe	  manage the mappings.
48e5a9ec7eSJason Gunthorpe
49e5a9ec7eSJason Gunthorpe	  Unless testing IOMMUFD say Y here.
50e5a9ec7eSJason Gunthorpe
51e5a9ec7eSJason Gunthorpeif VFIO_CONTAINER
5285c94dcfSJason Gunthorpeconfig VFIO_IOMMU_TYPE1
5385c94dcfSJason Gunthorpe	tristate
5485c94dcfSJason Gunthorpe	default n
5585c94dcfSJason Gunthorpe
5685c94dcfSJason Gunthorpeconfig VFIO_IOMMU_SPAPR_TCE
5785c94dcfSJason Gunthorpe	tristate
5885c94dcfSJason Gunthorpe	depends on SPAPR_TCE_IOMMU
5985c94dcfSJason Gunthorpe	default VFIO
60c9a397ceSJason Gunthorpeendif
6185c94dcfSJason Gunthorpe
6226c22cfdSJason Gunthorpeconfig VFIO_NOIOMMU
6303a76b60SAlex Williamson	bool "VFIO No-IOMMU support"
64*e8efdf02SJacob Pan	depends on VFIO_GROUP || (VFIO_DEVICE_CDEV && !GENERIC_ATOMIC64)
65*e8efdf02SJacob Pan	depends on !VFIO_GROUP || VFIO_CONTAINER || IOMMUFD_VFIO_CONTAINER
66*e8efdf02SJacob Pan	select IOMMUFD_NOIOMMU if VFIO_DEVICE_CDEV && !GENERIC_ATOMIC64
6703a76b60SAlex Williamson	help
6803a76b60SAlex Williamson	  VFIO is built on the ability to isolate devices using the IOMMU.
6903a76b60SAlex Williamson	  Only with an IOMMU can userspace access to DMA capable devices be
7003a76b60SAlex Williamson	  considered secure.  VFIO No-IOMMU mode enables IOMMU groups for
7103a76b60SAlex Williamson	  devices without IOMMU backing for the purpose of re-using the VFIO
7203a76b60SAlex Williamson	  infrastructure in a non-secure mode.  Use of this mode will result
7303a76b60SAlex Williamson	  in an unsupportable kernel and will therefore taint the kernel.
7403a76b60SAlex Williamson	  Device assignment to virtual machines is also not possible with
7503a76b60SAlex Williamson	  this mode since there is no IOMMU to provide DMA translation.
7603a76b60SAlex Williamson
7703a76b60SAlex Williamson	  If you don't know what to do here, say N.
78e5a9ec7eSJason Gunthorpe
79e5a9ec7eSJason Gunthorpeconfig VFIO_VIRQFD
80785d21baSLinus Torvalds	bool
81e5a9ec7eSJason Gunthorpe	select EVENTFD
82e5a9ec7eSJason Gunthorpe	default n
8303a76b60SAlex Williamson
842202844eSLongfang Liuconfig VFIO_DEBUGFS
852202844eSLongfang Liu	bool "Export VFIO internals in DebugFS"
862202844eSLongfang Liu	depends on DEBUG_FS
872202844eSLongfang Liu	help
882202844eSLongfang Liu	  Allows exposure of VFIO device internals. This option enables
892202844eSLongfang Liu	  the use of debugfs by VFIO drivers as required. The device can
902202844eSLongfang Liu	  cause the VFIO code create a top-level debug/vfio directory
912202844eSLongfang Liu	  during initialization, and then populate a subdirectory with
922202844eSLongfang Liu	  entries as required.
932202844eSLongfang Liu
9489e1f7d4SAlex Williamsonsource "drivers/vfio/pci/Kconfig"
9553161532SAntonios Motakissource "drivers/vfio/platform/Kconfig"
967b96953bSKirti Wankhedesource "drivers/vfio/mdev/Kconfig"
97fb1ff4c1SBharat Bhushansource "drivers/vfio/fsl-mc/Kconfig"
98234489acSNipun Guptasource "drivers/vfio/cdx/Kconfig"
9985c94dcfSJason Gunthorpeendif
10085c94dcfSJason Gunthorpe
1016d7425f1SFeng Wusource "virt/lib/Kconfig"
102