aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <jdmason@us.ibm.com>2006-02-25 22:18:22 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-26 12:53:29 -0500
commit60b08c67220cf6faef7410ac6adba23a8a743bf7 (patch)
treead3c5f6933f06ce46ff41b0fe456a10900a04567
parent04a3d311c01d3ad287750c5c8d03fa614475af91 (diff)
[PATCH] x86_64: no_iommu removal in pci-gart.c
In previous versions of pci-gart.c, no_iommu was used to determine if IOMMU was disabled in the GART DMA mapping functions. This changed in 2.6.16 and now gart_xxx() functions are only called if gart is enabled. Therefore, uses of no_iommu in the GART code are no longer necessary and can be removed. Also, it removes double deceleration of no_iommu and force_iommu in pci.h and proto.h, by removing the deceleration in pci.h. Lastly, end_pfn off by one error. Tested (along with patch 1/2) on dual opteron with gart enabled, iommu=soft, and iommu=off. Signed-off-by: Jon Mason <jdmason@us.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/x86_64/kernel/aperture.c2
-rw-r--r--arch/x86_64/kernel/pci-gart.c22
-rw-r--r--include/asm-x86_64/pci.h2
3 files changed, 6 insertions, 20 deletions
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index e4e2b7d01f89..a0f955b9995f 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -248,7 +248,7 @@ void __init iommu_hole_init(void)
248 /* Got the aperture from the AGP bridge */ 248 /* Got the aperture from the AGP bridge */
249 } else if (swiotlb && !valid_agp) { 249 } else if (swiotlb && !valid_agp) {
250 /* Do nothing */ 250 /* Do nothing */
251 } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || 251 } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) ||
252 force_iommu || 252 force_iommu ||
253 valid_agp || 253 valid_agp ||
254 fallback_aper_force) { 254 fallback_aper_force) {
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index dd0718dc178b..0c3f052ba6ce 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -228,11 +228,6 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size
228 int mmu = high; 228 int mmu = high;
229 if (force_iommu) 229 if (force_iommu)
230 mmu = 1; 230 mmu = 1;
231 if (no_iommu) {
232 if (high)
233 panic("PCI-DMA: high address but no IOMMU.\n");
234 mmu = 0;
235 }
236 return mmu; 231 return mmu;
237} 232}
238 233
@@ -241,11 +236,6 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t
241 u64 mask = *dev->dma_mask; 236 u64 mask = *dev->dma_mask;
242 int high = addr + size >= mask; 237 int high = addr + size >= mask;
243 int mmu = high; 238 int mmu = high;
244 if (no_iommu) {
245 if (high)
246 panic("PCI-DMA: high address but no IOMMU.\n");
247 mmu = 0;
248 }
249 return mmu; 239 return mmu;
250} 240}
251 241
@@ -310,7 +300,7 @@ void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int di
310 300
311 for (i = 0; i < nents; i++) { 301 for (i = 0; i < nents; i++) {
312 struct scatterlist *s = &sg[i]; 302 struct scatterlist *s = &sg[i];
313 if (!s->dma_length) 303 if (!s->dma_length || !s->length)
314 break; 304 break;
315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 305 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
316 } 306 }
@@ -364,6 +354,7 @@ static int __dma_map_cont(struct scatterlist *sg, int start, int stopat,
364 354
365 BUG_ON(i > start && s->offset); 355 BUG_ON(i > start && s->offset);
366 if (i == start) { 356 if (i == start) {
357 *sout = *s;
367 sout->dma_address = iommu_bus_base; 358 sout->dma_address = iommu_bus_base;
368 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 359 sout->dma_address += iommu_page*PAGE_SIZE + s->offset;
369 sout->dma_length = s->length; 360 sout->dma_length = s->length;
@@ -390,6 +381,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
390{ 381{
391 if (!need) { 382 if (!need) {
392 BUG_ON(stopat - start != 1); 383 BUG_ON(stopat - start != 1);
384 *sout = sg[start];
393 sout->dma_length = sg[start].length; 385 sout->dma_length = sg[start].length;
394 return 0; 386 return 0;
395 } 387 }
@@ -632,17 +624,13 @@ static int __init pci_iommu_init(void)
632 (agp_copy_info(agp_bridge, &info) < 0); 624 (agp_copy_info(agp_bridge, &info) < 0);
633#endif 625#endif
634 626
635 if (swiotlb) { 627 if (swiotlb)
636 no_iommu = 1;
637 return -1; 628 return -1;
638 } 629
639
640 if (no_iommu || 630 if (no_iommu ||
641 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 631 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
642 !iommu_aperture || 632 !iommu_aperture ||
643 (no_agp && init_k8_gatt(&info) < 0)) { 633 (no_agp && init_k8_gatt(&info) < 0)) {
644 no_iommu = 1;
645 no_iommu_init();
646 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 634 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
647 if (end_pfn > MAX_DMA32_PFN) { 635 if (end_pfn > MAX_DMA32_PFN) {
648 printk(KERN_ERR "WARNING more than 4GB of memory " 636 printk(KERN_ERR "WARNING more than 4GB of memory "
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index fd03e15d7ea6..8a05af264d18 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -19,8 +19,6 @@ extern unsigned int pcibios_assign_all_busses(void);
19#endif 19#endif
20#define pcibios_scan_all_fns(a, b) 0 20#define pcibios_scan_all_fns(a, b) 0
21 21
22extern int no_iommu, force_iommu;
23
24extern unsigned long pci_mem_start; 22extern unsigned long pci_mem_start;
25#define PCIBIOS_MIN_IO 0x1000 23#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM (pci_mem_start) 24#define PCIBIOS_MIN_MEM (pci_mem_start)