diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-04-08 12:20:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-19 13:19:57 -0400 |
commit | fae9a0d8ca68a14da8d2351ad3e0bf42f3b29899 (patch) | |
tree | a16bbeabb8b77e96e040ddc900a03ae5879fe784 | |
parent | 8e0c379718ef32967deea55937895bfc9b493dd8 (diff) |
x86: merge iommu initialization parameters
we merge the iommu initialization parameters in pci-dma.c
Nice thing, that both architectures at least recognize the same
parameters.
usedac i386 parameter is marked for deprecation
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 7 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 81 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma_32.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma_64.c | 79 | ||||
-rw-r--r-- | include/asm-x86/dma-mapping.h | 1 |
5 files changed, 89 insertions, 91 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index af0e9393bf68..309c47b91598 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -282,6 +282,13 @@ Why: Not used in-tree. The current out-of-tree users used it to | |||
282 | out-of-tree driver. | 282 | out-of-tree driver. |
283 | Who: Thomas Gleixner <tglx@linutronix.de> | 283 | Who: Thomas Gleixner <tglx@linutronix.de> |
284 | 284 | ||
285 | ---------------------------- | ||
286 | |||
287 | What: usedac i386 kernel parameter | ||
288 | When: 2.6.27 | ||
289 | Why: replaced by allowdac and no dac combination | ||
290 | Who: Glauber Costa <gcosta@redhat.com> | ||
291 | |||
285 | --------------------------- | 292 | --------------------------- |
286 | 293 | ||
287 | What: /sys/o2cb symlink | 294 | What: /sys/o2cb symlink |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 7d3bd652c36f..48ab52d052b6 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -24,6 +24,18 @@ int panic_on_overflow __read_mostly = 0; | |||
24 | int force_iommu __read_mostly = 0; | 24 | int force_iommu __read_mostly = 0; |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | int iommu_merge __read_mostly = 0; | ||
28 | |||
29 | int no_iommu __read_mostly; | ||
30 | /* Set this to 1 if there is a HW IOMMU in the system */ | ||
31 | int iommu_detected __read_mostly = 0; | ||
32 | |||
33 | /* This tells the BIO block layer to assume merging. Default to off | ||
34 | because we cannot guarantee merging later. */ | ||
35 | int iommu_bio_merge __read_mostly = 0; | ||
36 | EXPORT_SYMBOL(iommu_bio_merge); | ||
37 | |||
38 | |||
27 | int dma_set_mask(struct device *dev, u64 mask) | 39 | int dma_set_mask(struct device *dev, u64 mask) |
28 | { | 40 | { |
29 | if (!dev->dma_mask || !dma_supported(dev, mask)) | 41 | if (!dev->dma_mask || !dma_supported(dev, mask)) |
@@ -105,6 +117,75 @@ void __init pci_iommu_alloc(void) | |||
105 | } | 117 | } |
106 | #endif | 118 | #endif |
107 | 119 | ||
120 | /* | ||
121 | * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter | ||
122 | * documentation. | ||
123 | */ | ||
124 | static __init int iommu_setup(char *p) | ||
125 | { | ||
126 | iommu_merge = 1; | ||
127 | |||
128 | if (!p) | ||
129 | return -EINVAL; | ||
130 | |||
131 | while (*p) { | ||
132 | if (!strncmp(p, "off", 3)) | ||
133 | no_iommu = 1; | ||
134 | /* gart_parse_options has more force support */ | ||
135 | if (!strncmp(p, "force", 5)) | ||
136 | force_iommu = 1; | ||
137 | if (!strncmp(p, "noforce", 7)) { | ||
138 | iommu_merge = 0; | ||
139 | force_iommu = 0; | ||
140 | } | ||
141 | |||
142 | if (!strncmp(p, "biomerge", 8)) { | ||
143 | iommu_bio_merge = 4096; | ||
144 | iommu_merge = 1; | ||
145 | force_iommu = 1; | ||
146 | } | ||
147 | if (!strncmp(p, "panic", 5)) | ||
148 | panic_on_overflow = 1; | ||
149 | if (!strncmp(p, "nopanic", 7)) | ||
150 | panic_on_overflow = 0; | ||
151 | if (!strncmp(p, "merge", 5)) { | ||
152 | iommu_merge = 1; | ||
153 | force_iommu = 1; | ||
154 | } | ||
155 | if (!strncmp(p, "nomerge", 7)) | ||
156 | iommu_merge = 0; | ||
157 | if (!strncmp(p, "forcesac", 8)) | ||
158 | iommu_sac_force = 1; | ||
159 | if (!strncmp(p, "allowdac", 8)) | ||
160 | forbid_dac = 0; | ||
161 | if (!strncmp(p, "nodac", 5)) | ||
162 | forbid_dac = -1; | ||
163 | if (!strncmp(p, "usedac", 6)) { | ||
164 | forbid_dac = -1; | ||
165 | return 1; | ||
166 | } | ||
167 | #ifdef CONFIG_SWIOTLB | ||
168 | if (!strncmp(p, "soft", 4)) | ||
169 | swiotlb = 1; | ||
170 | #endif | ||
171 | |||
172 | #ifdef CONFIG_GART_IOMMU | ||
173 | gart_parse_options(p); | ||
174 | #endif | ||
175 | |||
176 | #ifdef CONFIG_CALGARY_IOMMU | ||
177 | if (!strncmp(p, "calgary", 7)) | ||
178 | use_calgary = 1; | ||
179 | #endif /* CONFIG_CALGARY_IOMMU */ | ||
180 | |||
181 | p += strcspn(p, ","); | ||
182 | if (*p == ',') | ||
183 | ++p; | ||
184 | } | ||
185 | return 0; | ||
186 | } | ||
187 | early_param("iommu", iommu_setup); | ||
188 | |||
108 | int dma_supported(struct device *dev, u64 mask) | 189 | int dma_supported(struct device *dev, u64 mask) |
109 | { | 190 | { |
110 | #ifdef CONFIG_PCI | 191 | #ifdef CONFIG_PCI |
diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c index 1d4091af4417..eea52df68a3b 100644 --- a/arch/x86/kernel/pci-dma_32.c +++ b/arch/x86/kernel/pci-dma_32.c | |||
@@ -153,15 +153,3 @@ void *dma_mark_declared_memory_occupied(struct device *dev, | |||
153 | return mem->virt_base + (pos << PAGE_SHIFT); | 153 | return mem->virt_base + (pos << PAGE_SHIFT); |
154 | } | 154 | } |
155 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); | 155 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); |
156 | |||
157 | #ifdef CONFIG_PCI | ||
158 | static int check_iommu(char *s) | ||
159 | { | ||
160 | if (!strcmp(s, "usedac")) { | ||
161 | forbid_dac = -1; | ||
162 | return 1; | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | __setup("iommu=", check_iommu); | ||
167 | #endif | ||
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c index c80da76e7e61..e7d45cf82251 100644 --- a/arch/x86/kernel/pci-dma_64.c +++ b/arch/x86/kernel/pci-dma_64.c | |||
@@ -14,22 +14,9 @@ | |||
14 | #include <asm/gart.h> | 14 | #include <asm/gart.h> |
15 | #include <asm/calgary.h> | 15 | #include <asm/calgary.h> |
16 | 16 | ||
17 | int iommu_merge __read_mostly = 0; | ||
18 | |||
19 | dma_addr_t bad_dma_address __read_mostly; | 17 | dma_addr_t bad_dma_address __read_mostly; |
20 | EXPORT_SYMBOL(bad_dma_address); | 18 | EXPORT_SYMBOL(bad_dma_address); |
21 | 19 | ||
22 | /* This tells the BIO block layer to assume merging. Default to off | ||
23 | because we cannot guarantee merging later. */ | ||
24 | int iommu_bio_merge __read_mostly = 0; | ||
25 | EXPORT_SYMBOL(iommu_bio_merge); | ||
26 | |||
27 | extern int iommu_sac_force; | ||
28 | |||
29 | int no_iommu __read_mostly; | ||
30 | /* Set this to 1 if there is a HW IOMMU in the system */ | ||
31 | int iommu_detected __read_mostly = 0; | ||
32 | |||
33 | /* Dummy device used for NULL arguments (normally ISA). Better would | 20 | /* Dummy device used for NULL arguments (normally ISA). Better would |
34 | be probably a smaller DMA mask, but this is bug-to-bug compatible | 21 | be probably a smaller DMA mask, but this is bug-to-bug compatible |
35 | to i386. */ | 22 | to i386. */ |
@@ -160,69 +147,3 @@ void dma_free_coherent(struct device *dev, size_t size, | |||
160 | free_pages((unsigned long)vaddr, get_order(size)); | 147 | free_pages((unsigned long)vaddr, get_order(size)); |
161 | } | 148 | } |
162 | EXPORT_SYMBOL(dma_free_coherent); | 149 | EXPORT_SYMBOL(dma_free_coherent); |
163 | |||
164 | /* | ||
165 | * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter | ||
166 | * documentation. | ||
167 | */ | ||
168 | static __init int iommu_setup(char *p) | ||
169 | { | ||
170 | iommu_merge = 1; | ||
171 | |||
172 | if (!p) | ||
173 | return -EINVAL; | ||
174 | |||
175 | while (*p) { | ||
176 | if (!strncmp(p, "off", 3)) | ||
177 | no_iommu = 1; | ||
178 | /* gart_parse_options has more force support */ | ||
179 | if (!strncmp(p, "force", 5)) | ||
180 | force_iommu = 1; | ||
181 | if (!strncmp(p, "noforce", 7)) { | ||
182 | iommu_merge = 0; | ||
183 | force_iommu = 0; | ||
184 | } | ||
185 | |||
186 | if (!strncmp(p, "biomerge", 8)) { | ||
187 | iommu_bio_merge = 4096; | ||
188 | iommu_merge = 1; | ||
189 | force_iommu = 1; | ||
190 | } | ||
191 | if (!strncmp(p, "panic", 5)) | ||
192 | panic_on_overflow = 1; | ||
193 | if (!strncmp(p, "nopanic", 7)) | ||
194 | panic_on_overflow = 0; | ||
195 | if (!strncmp(p, "merge", 5)) { | ||
196 | iommu_merge = 1; | ||
197 | force_iommu = 1; | ||
198 | } | ||
199 | if (!strncmp(p, "nomerge", 7)) | ||
200 | iommu_merge = 0; | ||
201 | if (!strncmp(p, "forcesac", 8)) | ||
202 | iommu_sac_force = 1; | ||
203 | if (!strncmp(p, "allowdac", 8)) | ||
204 | forbid_dac = 0; | ||
205 | if (!strncmp(p, "nodac", 5)) | ||
206 | forbid_dac = -1; | ||
207 | |||
208 | #ifdef CONFIG_SWIOTLB | ||
209 | if (!strncmp(p, "soft", 4)) | ||
210 | swiotlb = 1; | ||
211 | #endif | ||
212 | |||
213 | #ifdef CONFIG_GART_IOMMU | ||
214 | gart_parse_options(p); | ||
215 | #endif | ||
216 | |||
217 | #ifdef CONFIG_CALGARY_IOMMU | ||
218 | if (!strncmp(p, "calgary", 7)) | ||
219 | use_calgary = 1; | ||
220 | #endif /* CONFIG_CALGARY_IOMMU */ | ||
221 | |||
222 | p += strcspn(p, ","); | ||
223 | if (*p == ',') | ||
224 | ++p; | ||
225 | } | ||
226 | return 0; | ||
227 | } | ||
228 | early_param("iommu", iommu_setup); | ||
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h index d82517de1e7c..75807368051a 100644 --- a/include/asm-x86/dma-mapping.h +++ b/include/asm-x86/dma-mapping.h | |||
@@ -15,6 +15,7 @@ extern int iommu_merge; | |||
15 | extern struct device fallback_dev; | 15 | extern struct device fallback_dev; |
16 | extern int panic_on_overflow; | 16 | extern int panic_on_overflow; |
17 | extern int forbid_dac; | 17 | extern int forbid_dac; |
18 | extern int force_iommu; | ||
18 | 19 | ||
19 | struct dma_mapping_ops { | 20 | struct dma_mapping_ops { |
20 | int (*mapping_error)(dma_addr_t dma_addr); | 21 | int (*mapping_error)(dma_addr_t dma_addr); |