162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenuconfig VFIO
362306a36Sopenharmony_ci	tristate "VFIO Non-Privileged userspace driver framework"
462306a36Sopenharmony_ci	select IOMMU_API
562306a36Sopenharmony_ci	depends on IOMMUFD || !IOMMUFD
662306a36Sopenharmony_ci	select INTERVAL_TREE
762306a36Sopenharmony_ci	select VFIO_GROUP if SPAPR_TCE_IOMMU || IOMMUFD=n
862306a36Sopenharmony_ci	select VFIO_DEVICE_CDEV if !VFIO_GROUP
962306a36Sopenharmony_ci	select VFIO_CONTAINER if IOMMUFD=n
1062306a36Sopenharmony_ci	help
1162306a36Sopenharmony_ci	  VFIO provides a framework for secure userspace device drivers.
1262306a36Sopenharmony_ci	  See Documentation/driver-api/vfio.rst for more details.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci	  If you don't know what to do here, say N.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciif VFIO
1762306a36Sopenharmony_ciconfig VFIO_DEVICE_CDEV
1862306a36Sopenharmony_ci	bool "Support for the VFIO cdev /dev/vfio/devices/vfioX"
1962306a36Sopenharmony_ci	depends on IOMMUFD && !SPAPR_TCE_IOMMU
2062306a36Sopenharmony_ci	default !VFIO_GROUP
2162306a36Sopenharmony_ci	help
2262306a36Sopenharmony_ci	  The VFIO device cdev is another way for userspace to get device
2362306a36Sopenharmony_ci	  access. Userspace gets device fd by opening device cdev under
2462306a36Sopenharmony_ci	  /dev/vfio/devices/vfioX, and then bind the device fd with an iommufd
2562306a36Sopenharmony_ci	  to set up secure DMA context for device access.  This interface does
2662306a36Sopenharmony_ci	  not support noiommu.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	  If you don't know what to do here, say N.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciconfig VFIO_GROUP
3162306a36Sopenharmony_ci	bool "Support for the VFIO group /dev/vfio/$group_id"
3262306a36Sopenharmony_ci	default y
3362306a36Sopenharmony_ci	help
3462306a36Sopenharmony_ci	   VFIO group support provides the traditional model for accessing
3562306a36Sopenharmony_ci	   devices through VFIO and is used by the majority of userspace
3662306a36Sopenharmony_ci	   applications and drivers making use of VFIO.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	   If you don't know what to do here, say Y.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciconfig VFIO_CONTAINER
4162306a36Sopenharmony_ci	bool "Support for the VFIO container /dev/vfio/vfio"
4262306a36Sopenharmony_ci	select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
4362306a36Sopenharmony_ci	depends on VFIO_GROUP
4462306a36Sopenharmony_ci	default y
4562306a36Sopenharmony_ci	help
4662306a36Sopenharmony_ci	  The VFIO container is the classic interface to VFIO for establishing
4762306a36Sopenharmony_ci	  IOMMU mappings. If N is selected here then IOMMUFD must be used to
4862306a36Sopenharmony_ci	  manage the mappings.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci	  Unless testing IOMMUFD say Y here.
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciif VFIO_CONTAINER
5362306a36Sopenharmony_ciconfig VFIO_IOMMU_TYPE1
5462306a36Sopenharmony_ci	tristate
5562306a36Sopenharmony_ci	default n
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciconfig VFIO_IOMMU_SPAPR_TCE
5862306a36Sopenharmony_ci	tristate
5962306a36Sopenharmony_ci	depends on SPAPR_TCE_IOMMU
6062306a36Sopenharmony_ci	default VFIO
6162306a36Sopenharmony_ciendif
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciconfig VFIO_NOIOMMU
6462306a36Sopenharmony_ci	bool "VFIO No-IOMMU support"
6562306a36Sopenharmony_ci	depends on VFIO_GROUP
6662306a36Sopenharmony_ci	help
6762306a36Sopenharmony_ci	  VFIO is built on the ability to isolate devices using the IOMMU.
6862306a36Sopenharmony_ci	  Only with an IOMMU can userspace access to DMA capable devices be
6962306a36Sopenharmony_ci	  considered secure.  VFIO No-IOMMU mode enables IOMMU groups for
7062306a36Sopenharmony_ci	  devices without IOMMU backing for the purpose of re-using the VFIO
7162306a36Sopenharmony_ci	  infrastructure in a non-secure mode.  Use of this mode will result
7262306a36Sopenharmony_ci	  in an unsupportable kernel and will therefore taint the kernel.
7362306a36Sopenharmony_ci	  Device assignment to virtual machines is also not possible with
7462306a36Sopenharmony_ci	  this mode since there is no IOMMU to provide DMA translation.
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci	  If you don't know what to do here, say N.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciconfig VFIO_VIRQFD
7962306a36Sopenharmony_ci	bool
8062306a36Sopenharmony_ci	select EVENTFD
8162306a36Sopenharmony_ci	default n
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_cisource "drivers/vfio/pci/Kconfig"
8462306a36Sopenharmony_cisource "drivers/vfio/platform/Kconfig"
8562306a36Sopenharmony_cisource "drivers/vfio/mdev/Kconfig"
8662306a36Sopenharmony_cisource "drivers/vfio/fsl-mc/Kconfig"
8762306a36Sopenharmony_cisource "drivers/vfio/cdx/Kconfig"
8862306a36Sopenharmony_ciendif
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_cisource "virt/lib/Kconfig"
91