aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-04-08 12:20:56 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:19:57 -0400
commitfae9a0d8ca68a14da8d2351ad3e0bf42f3b29899 (patch)
treea16bbeabb8b77e96e040ddc900a03ae5879fe784 /arch/x86/kernel
parent8e0c379718ef32967deea55937895bfc9b493dd8 (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>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/pci-dma.c81
-rw-r--r--arch/x86/kernel/pci-dma_32.c12
-rw-r--r--arch/x86/kernel/pci-dma_64.c79
3 files changed, 81 insertions, 91 deletions
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;
24int force_iommu __read_mostly = 0; 24int force_iommu __read_mostly = 0;
25#endif 25#endif
26 26
27int iommu_merge __read_mostly = 0;
28
29int no_iommu __read_mostly;
30/* Set this to 1 if there is a HW IOMMU in the system */
31int 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. */
35int iommu_bio_merge __read_mostly = 0;
36EXPORT_SYMBOL(iommu_bio_merge);
37
38
27int dma_set_mask(struct device *dev, u64 mask) 39int 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 */
124static __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}
187early_param("iommu", iommu_setup);
188
108int dma_supported(struct device *dev, u64 mask) 189int 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}
155EXPORT_SYMBOL(dma_mark_declared_memory_occupied); 155EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
156
157#ifdef CONFIG_PCI
158static 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
17int iommu_merge __read_mostly = 0;
18
19dma_addr_t bad_dma_address __read_mostly; 17dma_addr_t bad_dma_address __read_mostly;
20EXPORT_SYMBOL(bad_dma_address); 18EXPORT_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. */
24int iommu_bio_merge __read_mostly = 0;
25EXPORT_SYMBOL(iommu_bio_merge);
26
27extern int iommu_sac_force;
28
29int no_iommu __read_mostly;
30/* Set this to 1 if there is a HW IOMMU in the system */
31int 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}
162EXPORT_SYMBOL(dma_free_coherent); 149EXPORT_SYMBOL(dma_free_coherent);
163
164/*
165 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter
166 * documentation.
167 */
168static __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}
228early_param("iommu", iommu_setup);