diff options
-rw-r--r-- | arch/x86_64/kernel/pci-dma.c | 29 | ||||
-rw-r--r-- | arch/x86_64/kernel/pci-gart.c | 13 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/x86_64/mm/init.c | 7 | ||||
-rw-r--r-- | include/asm-x86_64/pci.h | 2 | ||||
-rw-r--r-- | include/asm-x86_64/proto.h | 10 |
6 files changed, 42 insertions, 24 deletions
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c index 7edd1a40fab3..a45844c7e3a3 100644 --- a/arch/x86_64/kernel/pci-dma.c +++ b/arch/x86_64/kernel/pci-dma.c | |||
@@ -279,3 +279,32 @@ __init int iommu_setup(char *p) | |||
279 | } | 279 | } |
280 | return 1; | 280 | return 1; |
281 | } | 281 | } |
282 | __setup("iommu=", iommu_setup); | ||
283 | |||
284 | void __init pci_iommu_alloc(void) | ||
285 | { | ||
286 | /* | ||
287 | * The order of these functions is important for | ||
288 | * fall-back/fail-over reasons | ||
289 | */ | ||
290 | #ifdef CONFIG_IOMMU | ||
291 | iommu_hole_init(); | ||
292 | #endif | ||
293 | |||
294 | #ifdef CONFIG_SWIOTLB | ||
295 | pci_swiotlb_init(); | ||
296 | #endif | ||
297 | } | ||
298 | |||
299 | static int __init pci_iommu_init(void) | ||
300 | { | ||
301 | #ifdef CONFIG_IOMMU | ||
302 | gart_iommu_init(); | ||
303 | #endif | ||
304 | |||
305 | no_iommu_init(); | ||
306 | return 0; | ||
307 | } | ||
308 | |||
309 | /* Must execute after PCI subsystem */ | ||
310 | fs_initcall(pci_iommu_init); | ||
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 4f67957d2b42..9a93954bed37 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -571,7 +571,7 @@ static struct dma_mapping_ops gart_dma_ops = { | |||
571 | .unmap_sg = gart_unmap_sg, | 571 | .unmap_sg = gart_unmap_sg, |
572 | }; | 572 | }; |
573 | 573 | ||
574 | static int __init pci_iommu_init(void) | 574 | void __init gart_iommu_init(void) |
575 | { | 575 | { |
576 | struct agp_kern_info info; | 576 | struct agp_kern_info info; |
577 | unsigned long aper_size; | 577 | unsigned long aper_size; |
@@ -581,7 +581,7 @@ static int __init pci_iommu_init(void) | |||
581 | 581 | ||
582 | if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) { | 582 | if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) { |
583 | printk(KERN_INFO "PCI-GART: No AMD northbridge found.\n"); | 583 | printk(KERN_INFO "PCI-GART: No AMD northbridge found.\n"); |
584 | return -ENODEV; | 584 | return; |
585 | } | 585 | } |
586 | 586 | ||
587 | #ifndef CONFIG_AGP_AMD64 | 587 | #ifndef CONFIG_AGP_AMD64 |
@@ -595,11 +595,11 @@ static int __init pci_iommu_init(void) | |||
595 | #endif | 595 | #endif |
596 | 596 | ||
597 | if (swiotlb) | 597 | if (swiotlb) |
598 | return -ENODEV; | 598 | return; |
599 | 599 | ||
600 | /* Did we detect a different HW IOMMU? */ | 600 | /* Did we detect a different HW IOMMU? */ |
601 | if (iommu_detected && !iommu_aperture) | 601 | if (iommu_detected && !iommu_aperture) |
602 | return -1; | 602 | return; |
603 | 603 | ||
604 | if (no_iommu || | 604 | if (no_iommu || |
605 | (!force_iommu && end_pfn <= MAX_DMA32_PFN) || | 605 | (!force_iommu && end_pfn <= MAX_DMA32_PFN) || |
@@ -611,7 +611,7 @@ static int __init pci_iommu_init(void) | |||
611 | "but IOMMU not available.\n" | 611 | "but IOMMU not available.\n" |
612 | KERN_ERR "WARNING 32bit PCI may malfunction.\n"); | 612 | KERN_ERR "WARNING 32bit PCI may malfunction.\n"); |
613 | } | 613 | } |
614 | return -ENODEV; | 614 | return; |
615 | } | 615 | } |
616 | 616 | ||
617 | printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n"); | 617 | printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n"); |
@@ -678,11 +678,10 @@ static int __init pci_iommu_init(void) | |||
678 | 678 | ||
679 | flush_gart(); | 679 | flush_gart(); |
680 | dma_ops = &gart_dma_ops; | 680 | dma_ops = &gart_dma_ops; |
681 | return 0; | ||
682 | } | 681 | } |
683 | 682 | ||
684 | /* Must execute after PCI subsystem */ | 683 | /* Must execute after PCI subsystem */ |
685 | fs_initcall(pci_iommu_init); | 684 | fs_initcall(gart_iommu_init); |
686 | 685 | ||
687 | void gart_parse_options(char *p) | 686 | void gart_parse_options(char *p) |
688 | { | 687 | { |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index a9de8f02671f..04b2d7b92d17 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <asm/setup.h> | 63 | #include <asm/setup.h> |
64 | #include <asm/mach_apic.h> | 64 | #include <asm/mach_apic.h> |
65 | #include <asm/numa.h> | 65 | #include <asm/numa.h> |
66 | #include <asm/swiotlb.h> | ||
67 | #include <asm/sections.h> | 66 | #include <asm/sections.h> |
68 | #include <asm/dmi.h> | 67 | #include <asm/dmi.h> |
69 | 68 | ||
@@ -702,10 +701,6 @@ void __init setup_arch(char **cmdline_p) | |||
702 | 701 | ||
703 | e820_setup_gap(); | 702 | e820_setup_gap(); |
704 | 703 | ||
705 | #ifdef CONFIG_IOMMU | ||
706 | iommu_hole_init(); | ||
707 | #endif | ||
708 | |||
709 | #ifdef CONFIG_VT | 704 | #ifdef CONFIG_VT |
710 | #if defined(CONFIG_VGA_CONSOLE) | 705 | #if defined(CONFIG_VGA_CONSOLE) |
711 | conswitchp = &vga_con; | 706 | conswitchp = &vga_con; |
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index b83645a2e02d..2f5f5b11e9d0 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #include <asm/proto.h> | 41 | #include <asm/proto.h> |
42 | #include <asm/smp.h> | 42 | #include <asm/smp.h> |
43 | #include <asm/sections.h> | 43 | #include <asm/sections.h> |
44 | #include <asm/dma-mapping.h> | ||
45 | #include <asm/swiotlb.h> | ||
46 | 44 | ||
47 | #ifndef Dprintk | 45 | #ifndef Dprintk |
48 | #define Dprintk(x...) | 46 | #define Dprintk(x...) |
@@ -587,10 +585,7 @@ void __init mem_init(void) | |||
587 | { | 585 | { |
588 | long codesize, reservedpages, datasize, initsize; | 586 | long codesize, reservedpages, datasize, initsize; |
589 | 587 | ||
590 | #ifdef CONFIG_SWIOTLB | 588 | pci_iommu_alloc(); |
591 | pci_swiotlb_init(); | ||
592 | #endif | ||
593 | no_iommu_init(); | ||
594 | 589 | ||
595 | /* How many end-of-memory variables you have, grandma! */ | 590 | /* How many end-of-memory variables you have, grandma! */ |
596 | max_low_pfn = end_pfn; | 591 | max_low_pfn = end_pfn; |
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index 3374d34c4acd..4dbc07c54f7a 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h | |||
@@ -39,8 +39,8 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | |||
39 | #include <asm/scatterlist.h> | 39 | #include <asm/scatterlist.h> |
40 | #include <linux/string.h> | 40 | #include <linux/string.h> |
41 | #include <asm/page.h> | 41 | #include <asm/page.h> |
42 | #include <linux/dma-mapping.h> /* for have_iommu */ | ||
43 | 42 | ||
43 | extern void pci_iommu_alloc(void); | ||
44 | extern int iommu_setup(char *opt); | 44 | extern int iommu_setup(char *opt); |
45 | 45 | ||
46 | /* The PCI address space does equal the physical memory | 46 | /* The PCI address space does equal the physical memory |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 9d3335b4e9b6..038fe1f47e6f 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -37,7 +37,6 @@ extern void ia32_sysenter_target(void); | |||
37 | 37 | ||
38 | extern void config_acpi_tables(void); | 38 | extern void config_acpi_tables(void); |
39 | extern void ia32_syscall(void); | 39 | extern void ia32_syscall(void); |
40 | extern void iommu_hole_init(void); | ||
41 | 40 | ||
42 | extern int pmtimer_mark_offset(void); | 41 | extern int pmtimer_mark_offset(void); |
43 | extern void pmtimer_resume(void); | 42 | extern void pmtimer_resume(void); |
@@ -101,13 +100,9 @@ extern int unsynchronized_tsc(void); | |||
101 | 100 | ||
102 | extern void select_idle_routine(const struct cpuinfo_x86 *c); | 101 | extern void select_idle_routine(const struct cpuinfo_x86 *c); |
103 | 102 | ||
104 | extern void gart_parse_options(char *); | ||
105 | extern void __init no_iommu_init(void); | ||
106 | |||
107 | extern unsigned long table_start, table_end; | 103 | extern unsigned long table_start, table_end; |
108 | 104 | ||
109 | extern int exception_trace; | 105 | extern int exception_trace; |
110 | extern int force_iommu, no_iommu; | ||
111 | extern int using_apic_timer; | 106 | extern int using_apic_timer; |
112 | extern int disable_apic; | 107 | extern int disable_apic; |
113 | extern unsigned cpu_khz; | 108 | extern unsigned cpu_khz; |
@@ -116,8 +111,13 @@ extern int skip_ioapic_setup; | |||
116 | extern int acpi_ht; | 111 | extern int acpi_ht; |
117 | extern int acpi_disabled; | 112 | extern int acpi_disabled; |
118 | 113 | ||
114 | extern void no_iommu_init(void); | ||
115 | extern int force_iommu, no_iommu; | ||
119 | extern int iommu_detected; | 116 | extern int iommu_detected; |
120 | #ifdef CONFIG_IOMMU | 117 | #ifdef CONFIG_IOMMU |
118 | extern void gart_iommu_init(void); | ||
119 | extern void gart_parse_options(char *); | ||
120 | extern void iommu_hole_init(void); | ||
121 | extern int fallback_aper_order; | 121 | extern int fallback_aper_order; |
122 | extern int fallback_aper_force; | 122 | extern int fallback_aper_force; |
123 | extern int iommu_aperture; | 123 | extern int iommu_aperture; |