Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

Jon Mason and committed by
Linus Torvalds
60b08c67 04a3d311

+6 -20
+1 -1
arch/x86_64/kernel/aperture.c
··· 248 248 /* Got the aperture from the AGP bridge */ 249 249 } else if (swiotlb && !valid_agp) { 250 250 /* Do nothing */ 251 - } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || 251 + } else if ((!no_iommu && end_pfn > MAX_DMA32_PFN) || 252 252 force_iommu || 253 253 valid_agp || 254 254 fallback_aper_force) {
+5 -17
arch/x86_64/kernel/pci-gart.c
··· 228 228 int mmu = high; 229 229 if (force_iommu) 230 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 231 return mmu; 237 232 } 238 233 ··· 236 241 u64 mask = *dev->dma_mask; 237 242 int high = addr + size >= mask; 238 243 int mmu = high; 239 - if (no_iommu) { 240 - if (high) 241 - panic("PCI-DMA: high address but no IOMMU.\n"); 242 - mmu = 0; 243 - } 244 244 return mmu; 245 245 } 246 246 ··· 300 310 301 311 for (i = 0; i < nents; i++) { 302 312 struct scatterlist *s = &sg[i]; 303 - if (!s->dma_length) 313 + if (!s->dma_length || !s->length) 304 314 break; 305 315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir); 306 316 } ··· 354 364 355 365 BUG_ON(i > start && s->offset); 356 366 if (i == start) { 367 + *sout = *s; 357 368 sout->dma_address = iommu_bus_base; 358 369 sout->dma_address += iommu_page*PAGE_SIZE + s->offset; 359 370 sout->dma_length = s->length; ··· 381 390 { 382 391 if (!need) { 383 392 BUG_ON(stopat - start != 1); 393 + *sout = sg[start]; 384 394 sout->dma_length = sg[start].length; 385 395 return 0; 386 396 } ··· 624 632 (agp_copy_info(agp_bridge, &info) < 0); 625 633 #endif 626 634 627 - if (swiotlb) { 628 - no_iommu = 1; 635 + if (swiotlb) 629 636 return -1; 630 - } 631 - 637 + 632 638 if (no_iommu || 633 639 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 634 640 !iommu_aperture || 635 641 (no_agp && init_k8_gatt(&info) < 0)) { 636 - no_iommu = 1; 637 - no_iommu_init(); 638 642 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 639 643 if (end_pfn > MAX_DMA32_PFN) { 640 644 printk(KERN_ERR "WARNING more than 4GB of memory "
-2
include/asm-x86_64/pci.h
··· 19 19 #endif 20 20 #define pcibios_scan_all_fns(a, b) 0 21 21 22 - extern int no_iommu, force_iommu; 23 - 24 22 extern unsigned long pci_mem_start; 25 23 #define PCIBIOS_MIN_IO 0x1000 26 24 #define PCIBIOS_MIN_MEM (pci_mem_start)