aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-12-16 15:17:36 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-17 12:58:19 -0500
commitcfb80c9eae8c7ed8f2ee81090062d15ead51cbe8 (patch)
tree8343c02e8599f0e038cc9c0b303854193fb38e37 /arch/x86
parent8ce7996009bab7b2d23e7af7ad831fed7eb6faa1 (diff)
x86: unify pci iommu setup and allow swiotlb to compile for 32 bit
swiotlb on 32 bit will be used by Xen domain 0 support. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/dma-mapping.h2
-rw-r--r--arch/x86/include/asm/pci.h2
-rw-r--r--arch/x86/include/asm/pci_64.h1
-rw-r--r--arch/x86/kernel/Makefile3
-rw-r--r--arch/x86/kernel/pci-dma.c6
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/mm/init_32.c3
7 files changed, 14 insertions, 5 deletions
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 097794ff6b79..3b43a65894c4 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -65,7 +65,7 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
65 return dma_ops; 65 return dma_ops;
66 else 66 else
67 return dev->archdata.dma_ops; 67 return dev->archdata.dma_ops;
68#endif /* _ASM_X86_DMA_MAPPING_H */ 68#endif
69} 69}
70 70
71/* Make sure we keep the same behaviour */ 71/* Make sure we keep the same behaviour */
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 875b38edf193..50ac542c9382 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -82,6 +82,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
82static inline void early_quirks(void) { } 82static inline void early_quirks(void) { }
83#endif 83#endif
84 84
85extern void pci_iommu_alloc(void);
86
85#endif /* __KERNEL__ */ 87#endif /* __KERNEL__ */
86 88
87#ifdef CONFIG_X86_32 89#ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/pci_64.h b/arch/x86/include/asm/pci_64.h
index d02d936840a3..4da207982777 100644
--- a/arch/x86/include/asm/pci_64.h
+++ b/arch/x86/include/asm/pci_64.h
@@ -23,7 +23,6 @@ extern int (*pci_config_write)(int seg, int bus, int dev, int fn,
23 int reg, int len, u32 value); 23 int reg, int len, u32 value);
24 24
25extern void dma32_reserve_bootmem(void); 25extern void dma32_reserve_bootmem(void);
26extern void pci_iommu_alloc(void);
27 26
28/* The PCI address space does equal the physical memory 27/* The PCI address space does equal the physical memory
29 * address space. The networking and block device layers use 28 * address space. The networking and block device layers use
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index b62a7667828e..a9c656f2d661 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -105,6 +105,8 @@ microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o
105microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o 105microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o
106obj-$(CONFIG_MICROCODE) += microcode.o 106obj-$(CONFIG_MICROCODE) += microcode.o
107 107
108obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o # NB rename without _64
109
108### 110###
109# 64 bit specific files 111# 64 bit specific files
110ifeq ($(CONFIG_X86_64),y) 112ifeq ($(CONFIG_X86_64),y)
@@ -118,7 +120,6 @@ ifeq ($(CONFIG_X86_64),y)
118 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o 120 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
119 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 121 obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
120 obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o 122 obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o
121 obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
122 123
123 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 124 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
124endif 125endif
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index e150ad4f0ccc..00e07447a5bd 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -105,11 +105,15 @@ static void __init dma32_free_bootmem(void)
105 dma32_bootmem_ptr = NULL; 105 dma32_bootmem_ptr = NULL;
106 dma32_bootmem_size = 0; 106 dma32_bootmem_size = 0;
107} 107}
108#endif
108 109
109void __init pci_iommu_alloc(void) 110void __init pci_iommu_alloc(void)
110{ 111{
112#ifdef CONFIG_X86_64
111 /* free the range so iommu could get some range less than 4G */ 113 /* free the range so iommu could get some range less than 4G */
112 dma32_free_bootmem(); 114 dma32_free_bootmem();
115#endif
116
113 /* 117 /*
114 * The order of these functions is important for 118 * The order of these functions is important for
115 * fall-back/fail-over reasons 119 * fall-back/fail-over reasons
@@ -125,8 +129,6 @@ void __init pci_iommu_alloc(void)
125 pci_swiotlb_init(); 129 pci_swiotlb_init();
126} 130}
127 131
128#endif
129
130void *dma_generic_alloc_coherent(struct device *dev, size_t size, 132void *dma_generic_alloc_coherent(struct device *dev, size_t size,
131 dma_addr_t *dma_addr, gfp_t flag) 133 dma_addr_t *dma_addr, gfp_t flag)
132{ 134{
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index f47a097a135b..a991afea6700 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -62,8 +62,10 @@ struct dma_mapping_ops swiotlb_dma_ops = {
62void __init pci_swiotlb_init(void) 62void __init pci_swiotlb_init(void)
63{ 63{
64 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 64 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
65#ifdef CONFIG_X86_64
65 if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) 66 if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
66 swiotlb = 1; 67 swiotlb = 1;
68#endif
67 if (swiotlb_force) 69 if (swiotlb_force)
68 swiotlb = 1; 70 swiotlb = 1;
69 if (swiotlb) { 71 if (swiotlb) {
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c483f4242079..2b4b14fc0c04 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/highmem.h> 22#include <linux/highmem.h>
23#include <linux/pagemap.h> 23#include <linux/pagemap.h>
24#include <linux/pci.h>
24#include <linux/pfn.h> 25#include <linux/pfn.h>
25#include <linux/poison.h> 26#include <linux/poison.h>
26#include <linux/bootmem.h> 27#include <linux/bootmem.h>
@@ -971,6 +972,8 @@ void __init mem_init(void)
971 972
972 start_periodic_check_for_corruption(); 973 start_periodic_check_for_corruption();
973 974
975 pci_iommu_alloc();
976
974#ifdef CONFIG_FLATMEM 977#ifdef CONFIG_FLATMEM
975 BUG_ON(!mem_map); 978 BUG_ON(!mem_map);
976#endif 979#endif