162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci# Intel IOMMU support
362306a36Sopenharmony_ciconfig DMAR_TABLE
462306a36Sopenharmony_ci	bool
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciconfig DMAR_PERF
762306a36Sopenharmony_ci	bool
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciconfig DMAR_DEBUG
1062306a36Sopenharmony_ci	bool
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciconfig INTEL_IOMMU
1362306a36Sopenharmony_ci	bool "Support for Intel IOMMU using DMA Remapping Devices"
1462306a36Sopenharmony_ci	depends on PCI_MSI && ACPI && (X86 || IA64)
1562306a36Sopenharmony_ci	select DMA_OPS
1662306a36Sopenharmony_ci	select IOMMU_API
1762306a36Sopenharmony_ci	select IOMMU_IOVA
1862306a36Sopenharmony_ci	select NEED_DMA_MAP_STATE
1962306a36Sopenharmony_ci	select DMAR_TABLE
2062306a36Sopenharmony_ci	select SWIOTLB
2162306a36Sopenharmony_ci	select PCI_ATS
2262306a36Sopenharmony_ci	select PCI_PRI
2362306a36Sopenharmony_ci	select PCI_PASID
2462306a36Sopenharmony_ci	help
2562306a36Sopenharmony_ci	  DMA remapping (DMAR) devices support enables independent address
2662306a36Sopenharmony_ci	  translations for Direct Memory Access (DMA) from devices.
2762306a36Sopenharmony_ci	  These DMA remapping devices are reported via ACPI tables
2862306a36Sopenharmony_ci	  and include PCI device scope covered by these DMA
2962306a36Sopenharmony_ci	  remapping devices.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciif INTEL_IOMMU
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciconfig INTEL_IOMMU_DEBUGFS
3462306a36Sopenharmony_ci	bool "Export Intel IOMMU internals in Debugfs"
3562306a36Sopenharmony_ci	depends on IOMMU_DEBUGFS
3662306a36Sopenharmony_ci	select DMAR_PERF
3762306a36Sopenharmony_ci	select DMAR_DEBUG
3862306a36Sopenharmony_ci	help
3962306a36Sopenharmony_ci	  !!!WARNING!!!
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	  DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!!
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	  Expose Intel IOMMU internals in Debugfs.
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci	  This option is -NOT- intended for production environments, and should
4662306a36Sopenharmony_ci	  only be enabled for debugging Intel IOMMU.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciconfig INTEL_IOMMU_SVM
4962306a36Sopenharmony_ci	bool "Support for Shared Virtual Memory with Intel IOMMU"
5062306a36Sopenharmony_ci	depends on X86_64
5162306a36Sopenharmony_ci	select MMU_NOTIFIER
5262306a36Sopenharmony_ci	select IOMMU_SVA
5362306a36Sopenharmony_ci	help
5462306a36Sopenharmony_ci	  Shared Virtual Memory (SVM) provides a facility for devices
5562306a36Sopenharmony_ci	  to access DMA resources through process address space by
5662306a36Sopenharmony_ci	  means of a Process Address Space ID (PASID).
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconfig INTEL_IOMMU_DEFAULT_ON
5962306a36Sopenharmony_ci	bool "Enable Intel DMA Remapping Devices by default"
6062306a36Sopenharmony_ci	default y
6162306a36Sopenharmony_ci	help
6262306a36Sopenharmony_ci	  Selecting this option will enable a DMAR device at boot time if
6362306a36Sopenharmony_ci	  one is found. If this option is not selected, DMAR support can
6462306a36Sopenharmony_ci	  be enabled by passing intel_iommu=on to the kernel.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciconfig INTEL_IOMMU_BROKEN_GFX_WA
6762306a36Sopenharmony_ci	bool "Workaround broken graphics drivers (going away soon)"
6862306a36Sopenharmony_ci	depends on BROKEN && X86
6962306a36Sopenharmony_ci	help
7062306a36Sopenharmony_ci	  Current Graphics drivers tend to use physical address
7162306a36Sopenharmony_ci	  for DMA and avoid using DMA APIs. Setting this config
7262306a36Sopenharmony_ci	  option permits the IOMMU driver to set a unity map for
7362306a36Sopenharmony_ci	  all the OS-visible memory. Hence the driver can continue
7462306a36Sopenharmony_ci	  to use physical addresses for DMA, at least until this
7562306a36Sopenharmony_ci	  option is removed in the 2.6.32 kernel.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciconfig INTEL_IOMMU_FLOPPY_WA
7862306a36Sopenharmony_ci	def_bool y
7962306a36Sopenharmony_ci	depends on X86
8062306a36Sopenharmony_ci	help
8162306a36Sopenharmony_ci	  Floppy disk drivers are known to bypass DMA API calls
8262306a36Sopenharmony_ci	  thereby failing to work when IOMMU is enabled. This
8362306a36Sopenharmony_ci	  workaround will setup a 1:1 mapping for the first
8462306a36Sopenharmony_ci	  16MiB to make floppy (an ISA device) work.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciconfig INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
8762306a36Sopenharmony_ci	bool "Enable Intel IOMMU scalable mode by default"
8862306a36Sopenharmony_ci	default y
8962306a36Sopenharmony_ci	help
9062306a36Sopenharmony_ci	  Selecting this option will enable by default the scalable mode if
9162306a36Sopenharmony_ci	  hardware presents the capability. The scalable mode is defined in
9262306a36Sopenharmony_ci	  VT-d 3.0. The scalable mode capability could be checked by reading
9362306a36Sopenharmony_ci	  /sys/devices/virtual/iommu/dmar*/intel-iommu/ecap. If this option
9462306a36Sopenharmony_ci	  is not selected, scalable mode support could also be enabled by
9562306a36Sopenharmony_ci	  passing intel_iommu=sm_on to the kernel. If not sure, please use
9662306a36Sopenharmony_ci	  the default value.
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciconfig INTEL_IOMMU_PERF_EVENTS
9962306a36Sopenharmony_ci	def_bool y
10062306a36Sopenharmony_ci	bool "Intel IOMMU performance events"
10162306a36Sopenharmony_ci	depends on INTEL_IOMMU && PERF_EVENTS
10262306a36Sopenharmony_ci	help
10362306a36Sopenharmony_ci	  Selecting this option will enable the performance monitoring
10462306a36Sopenharmony_ci	  infrastructure in the Intel IOMMU. It collects information about
10562306a36Sopenharmony_ci	  key events occurring during operation of the remapping hardware,
10662306a36Sopenharmony_ci	  to aid performance tuning and debug. These are available on modern
10762306a36Sopenharmony_ci	  processors which support Intel VT-d 4.0 and later.
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ciendif # INTEL_IOMMU
110