Commit 01dac2d9 authored by Lu Baolu's avatar Lu Baolu Committed by Joerg Roedel

iommu/vt-d: Refactor Kconfig a bit

Put all sub-options inside a "if INTEL_IOMMU" so that they don't need to
always depend on INTEL_IOMMU. Use IS_ENABLED() instead of #ifdef as well.
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20210720013856.4143880-1-baolu.lu@linux.intel.com
Link: https://lore.kernel.org/r/20210818134852.1847070-4-baolu.lu@linux.intel.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 5e41c998
...@@ -25,9 +25,11 @@ config INTEL_IOMMU ...@@ -25,9 +25,11 @@ config INTEL_IOMMU
and include PCI device scope covered by these DMA and include PCI device scope covered by these DMA
remapping devices. remapping devices.
if INTEL_IOMMU
config INTEL_IOMMU_DEBUGFS config INTEL_IOMMU_DEBUGFS
bool "Export Intel IOMMU internals in Debugfs" bool "Export Intel IOMMU internals in Debugfs"
depends on INTEL_IOMMU && IOMMU_DEBUGFS depends on IOMMU_DEBUGFS
select DMAR_PERF select DMAR_PERF
help help
!!!WARNING!!! !!!WARNING!!!
...@@ -41,7 +43,7 @@ config INTEL_IOMMU_DEBUGFS ...@@ -41,7 +43,7 @@ config INTEL_IOMMU_DEBUGFS
config INTEL_IOMMU_SVM config INTEL_IOMMU_SVM
bool "Support for Shared Virtual Memory with Intel IOMMU" bool "Support for Shared Virtual Memory with Intel IOMMU"
depends on INTEL_IOMMU && X86_64 depends on X86_64
select PCI_PASID select PCI_PASID
select PCI_PRI select PCI_PRI
select MMU_NOTIFIER select MMU_NOTIFIER
...@@ -53,9 +55,8 @@ config INTEL_IOMMU_SVM ...@@ -53,9 +55,8 @@ config INTEL_IOMMU_SVM
means of a Process Address Space ID (PASID). means of a Process Address Space ID (PASID).
config INTEL_IOMMU_DEFAULT_ON config INTEL_IOMMU_DEFAULT_ON
def_bool y bool "Enable Intel DMA Remapping Devices by default"
prompt "Enable Intel DMA Remapping Devices by default" default y
depends on INTEL_IOMMU
help help
Selecting this option will enable a DMAR device at boot time if Selecting this option will enable a DMAR device at boot time if
one is found. If this option is not selected, DMAR support can one is found. If this option is not selected, DMAR support can
...@@ -63,7 +64,7 @@ config INTEL_IOMMU_DEFAULT_ON ...@@ -63,7 +64,7 @@ config INTEL_IOMMU_DEFAULT_ON
config INTEL_IOMMU_BROKEN_GFX_WA config INTEL_IOMMU_BROKEN_GFX_WA
bool "Workaround broken graphics drivers (going away soon)" bool "Workaround broken graphics drivers (going away soon)"
depends on INTEL_IOMMU && BROKEN && X86 depends on BROKEN && X86
help help
Current Graphics drivers tend to use physical address Current Graphics drivers tend to use physical address
for DMA and avoid using DMA APIs. Setting this config for DMA and avoid using DMA APIs. Setting this config
...@@ -74,7 +75,7 @@ config INTEL_IOMMU_BROKEN_GFX_WA ...@@ -74,7 +75,7 @@ config INTEL_IOMMU_BROKEN_GFX_WA
config INTEL_IOMMU_FLOPPY_WA config INTEL_IOMMU_FLOPPY_WA
def_bool y def_bool y
depends on INTEL_IOMMU && X86 depends on X86
help help
Floppy disk drivers are known to bypass DMA API calls Floppy disk drivers are known to bypass DMA API calls
thereby failing to work when IOMMU is enabled. This thereby failing to work when IOMMU is enabled. This
...@@ -83,7 +84,6 @@ config INTEL_IOMMU_FLOPPY_WA ...@@ -83,7 +84,6 @@ config INTEL_IOMMU_FLOPPY_WA
config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
bool "Enable Intel IOMMU scalable mode by default" bool "Enable Intel IOMMU scalable mode by default"
depends on INTEL_IOMMU
help help
Selecting this option will enable by default the scalable mode if Selecting this option will enable by default the scalable mode if
hardware presents the capability. The scalable mode is defined in hardware presents the capability. The scalable mode is defined in
...@@ -92,3 +92,5 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON ...@@ -92,3 +92,5 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
is not selected, scalable mode support could also be enabled by is not selected, scalable mode support could also be enabled by
passing intel_iommu=sm_on to the kernel. If not sure, please use passing intel_iommu=sm_on to the kernel. If not sure, please use
the default value. the default value.
endif # INTEL_IOMMU
...@@ -327,17 +327,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, ...@@ -327,17 +327,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
dma_addr_t iova); dma_addr_t iova);
#ifdef CONFIG_INTEL_IOMMU_DEFAULT_ON int dmar_disabled = !IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON);
int dmar_disabled = 0; int intel_iommu_sm = IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON);
#else
int dmar_disabled = 1;
#endif /* CONFIG_INTEL_IOMMU_DEFAULT_ON */
#ifdef CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
int intel_iommu_sm = 1;
#else
int intel_iommu_sm;
#endif /* CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
int intel_iommu_enabled = 0; int intel_iommu_enabled = 0;
EXPORT_SYMBOL_GPL(intel_iommu_enabled); EXPORT_SYMBOL_GPL(intel_iommu_enabled);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment