Skip to content

Commit 01dac2d

Browse files
LuBaolujoergroedel
authored andcommitted
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: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 5e41c99 commit 01dac2d

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

drivers/iommu/intel/Kconfig

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ config INTEL_IOMMU
2525
and include PCI device scope covered by these DMA
2626
remapping devices.
2727

28+
if INTEL_IOMMU
29+
2830
config INTEL_IOMMU_DEBUGFS
2931
bool "Export Intel IOMMU internals in Debugfs"
30-
depends on INTEL_IOMMU && IOMMU_DEBUGFS
32+
depends on IOMMU_DEBUGFS
3133
select DMAR_PERF
3234
help
3335
!!!WARNING!!!
@@ -41,7 +43,7 @@ config INTEL_IOMMU_DEBUGFS
4143

4244
config INTEL_IOMMU_SVM
4345
bool "Support for Shared Virtual Memory with Intel IOMMU"
44-
depends on INTEL_IOMMU && X86_64
46+
depends on X86_64
4547
select PCI_PASID
4648
select PCI_PRI
4749
select MMU_NOTIFIER
@@ -53,17 +55,16 @@ config INTEL_IOMMU_SVM
5355
means of a Process Address Space ID (PASID).
5456

5557
config INTEL_IOMMU_DEFAULT_ON
56-
def_bool y
57-
prompt "Enable Intel DMA Remapping Devices by default"
58-
depends on INTEL_IOMMU
58+
bool "Enable Intel DMA Remapping Devices by default"
59+
default y
5960
help
6061
Selecting this option will enable a DMAR device at boot time if
6162
one is found. If this option is not selected, DMAR support can
6263
be enabled by passing intel_iommu=on to the kernel.
6364

6465
config INTEL_IOMMU_BROKEN_GFX_WA
6566
bool "Workaround broken graphics drivers (going away soon)"
66-
depends on INTEL_IOMMU && BROKEN && X86
67+
depends on BROKEN && X86
6768
help
6869
Current Graphics drivers tend to use physical address
6970
for DMA and avoid using DMA APIs. Setting this config
@@ -74,7 +75,7 @@ config INTEL_IOMMU_BROKEN_GFX_WA
7475

7576
config INTEL_IOMMU_FLOPPY_WA
7677
def_bool y
77-
depends on INTEL_IOMMU && X86
78+
depends on X86
7879
help
7980
Floppy disk drivers are known to bypass DMA API calls
8081
thereby failing to work when IOMMU is enabled. This
@@ -83,7 +84,6 @@ config INTEL_IOMMU_FLOPPY_WA
8384

8485
config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
8586
bool "Enable Intel IOMMU scalable mode by default"
86-
depends on INTEL_IOMMU
8787
help
8888
Selecting this option will enable by default the scalable mode if
8989
hardware presents the capability. The scalable mode is defined in
@@ -92,3 +92,5 @@ config INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
9292
is not selected, scalable mode support could also be enabled by
9393
passing intel_iommu=sm_on to the kernel. If not sure, please use
9494
the default value.
95+
96+
endif # INTEL_IOMMU

drivers/iommu/intel/iommu.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
327327
static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
328328
dma_addr_t iova);
329329

330-
#ifdef CONFIG_INTEL_IOMMU_DEFAULT_ON
331-
int dmar_disabled = 0;
332-
#else
333-
int dmar_disabled = 1;
334-
#endif /* CONFIG_INTEL_IOMMU_DEFAULT_ON */
335-
336-
#ifdef CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
337-
int intel_iommu_sm = 1;
338-
#else
339-
int intel_iommu_sm;
340-
#endif /* CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
330+
int dmar_disabled = !IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON);
331+
int intel_iommu_sm = IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON);
341332

342333
int intel_iommu_enabled = 0;
343334
EXPORT_SYMBOL_GPL(intel_iommu_enabled);

0 commit comments

Comments
 (0)