]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
62fdd767 FY |
2 | /* |
3 | * Dynamic DMA mapping support. | |
4 | */ | |
5 | ||
6 | #include <linux/types.h> | |
7 | #include <linux/mm.h> | |
8 | #include <linux/string.h> | |
9 | #include <linux/pci.h> | |
10 | #include <linux/module.h> | |
11 | #include <linux/dmar.h> | |
12 | #include <asm/iommu.h> | |
13 | #include <asm/machvec.h> | |
14 | #include <linux/dma-mapping.h> | |
62fdd767 | 15 | #include <linux/kernel.h> |
62fdd767 | 16 | #include <asm/page.h> |
62fdd767 | 17 | |
62fdd767 FY |
18 | int no_iommu __read_mostly; |
19 | #ifdef CONFIG_IOMMU_DEBUG | |
20 | int force_iommu __read_mostly = 1; | |
21 | #else | |
22 | int force_iommu __read_mostly; | |
23 | #endif | |
24 | ||
aed5d5f4 FY |
25 | int iommu_pass_through; |
26 | ||
62fdd767 FY |
27 | static int __init pci_iommu_init(void) |
28 | { | |
29 | if (iommu_detected) | |
30 | intel_iommu_init(); | |
31 | ||
32 | return 0; | |
33 | } | |
34 | ||
35 | /* Must execute after PCI subsystem */ | |
36 | fs_initcall(pci_iommu_init); | |
37 | ||
160c1d8e FT |
38 | void __init pci_iommu_alloc(void) |
39 | { | |
160c1d8e FT |
40 | /* |
41 | * The order of these functions is important for | |
42 | * fall-back/fail-over reasons | |
43 | */ | |
44 | detect_intel_iommu(); | |
45 | ||
46 | #ifdef CONFIG_SWIOTLB | |
4fac8076 CH |
47 | if (!iommu_detected) { |
48 | #ifdef CONFIG_IA64_GENERIC | |
49 | printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n"); | |
50 | machvec_init("dig"); | |
51 | swiotlb_dma_init(); | |
52 | #else | |
53 | panic("Unable to find Intel IOMMU"); | |
54 | #endif /* CONFIG_IA64_GENERIC */ | |
55 | } | |
56 | #endif /* CONFIG_SWIOTLB */ | |
160c1d8e | 57 | } |