aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-11-10 05:46:19 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-10 06:32:00 -0500
commitad32e8cb86e7894aac51c8963eaa9f36bb8a4e14 (patch)
tree4dce812e83de8bd130fd141afc1229b38b483736
parent5740afdb68abadc473fd5392df733558a58c1254 (diff)
swiotlb: Defer swiotlb init printing, export swiotlb_print_info()
This enables us to avoid printing swiotlb memory info when we initialize swiotlb. After swiotlb initialization, we could find that we don't need swiotlb. This patch removes the code to print swiotlb memory info in swiotlb_init() and exports the function to do that. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: chrisw@sous-sol.org Cc: dwmw2@infradead.org Cc: joerg.roedel@amd.com Cc: muli@il.ibm.com Cc: tony.luck@intel.com Cc: benh@kernel.crashing.org LKML-Reference: <1257849980-22640-9-git-send-email-fujita.tomonori@lab.ntt.co.jp> [ -v2: merge up conflict ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/ia64/kernel/pci-swiotlb.c4
-rw-r--r--arch/powerpc/kernel/setup_32.c2
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb.c3
-rw-r--r--include/linux/swiotlb.h4
-rw-r--r--lib/swiotlb.c15
6 files changed, 15 insertions, 15 deletions
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
index 285aae8431c6..53292abf846c 100644
--- a/arch/ia64/kernel/pci-swiotlb.c
+++ b/arch/ia64/kernel/pci-swiotlb.c
@@ -41,7 +41,7 @@ struct dma_map_ops swiotlb_dma_ops = {
41void __init swiotlb_dma_init(void) 41void __init swiotlb_dma_init(void)
42{ 42{
43 dma_ops = &swiotlb_dma_ops; 43 dma_ops = &swiotlb_dma_ops;
44 swiotlb_init(); 44 swiotlb_init(1);
45} 45}
46 46
47void __init pci_swiotlb_init(void) 47void __init pci_swiotlb_init(void)
@@ -51,7 +51,7 @@ void __init pci_swiotlb_init(void)
51 swiotlb = 1; 51 swiotlb = 1;
52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n"); 52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
53 machvec_init("dig"); 53 machvec_init("dig");
54 swiotlb_init(); 54 swiotlb_init(1);
55 dma_ops = &swiotlb_dma_ops; 55 dma_ops = &swiotlb_dma_ops;
56#else 56#else
57 panic("Unable to find Intel IOMMU"); 57 panic("Unable to find Intel IOMMU");
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 53bcf3d792db..b152de3e64d4 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -345,7 +345,7 @@ void __init setup_arch(char **cmdline_p)
345 345
346#ifdef CONFIG_SWIOTLB 346#ifdef CONFIG_SWIOTLB
347 if (ppc_swiotlb_enable) 347 if (ppc_swiotlb_enable)
348 swiotlb_init(); 348 swiotlb_init(1);
349#endif 349#endif
350 350
351 paging_init(); 351 paging_init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 04f638d82fb3..df2c9e932b37 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -550,7 +550,7 @@ void __init setup_arch(char **cmdline_p)
550 550
551#ifdef CONFIG_SWIOTLB 551#ifdef CONFIG_SWIOTLB
552 if (ppc_swiotlb_enable) 552 if (ppc_swiotlb_enable)
553 swiotlb_init(); 553 swiotlb_init(1);
554#endif 554#endif
555 555
556 paging_init(); 556 paging_init();
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index aaa6b7839f1e..ea20ef7ca523 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -52,8 +52,7 @@ void __init pci_swiotlb_init(void)
52 if (swiotlb_force) 52 if (swiotlb_force)
53 swiotlb = 1; 53 swiotlb = 1;
54 if (swiotlb) { 54 if (swiotlb) {
55 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n"); 55 swiotlb_init(0);
56 swiotlb_init();
57 dma_ops = &swiotlb_dma_ops; 56 dma_ops = &swiotlb_dma_ops;
58 } 57 }
59} 58}
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 59bafa690290..eb9bdb4d4854 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -20,8 +20,7 @@ struct scatterlist;
20 */ 20 */
21#define IO_TLB_SHIFT 11 21#define IO_TLB_SHIFT 11
22 22
23extern void 23extern void swiotlb_init(int verbose);
24swiotlb_init(void);
25 24
26extern void 25extern void
27*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 26*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -94,4 +93,5 @@ extern void __init swiotlb_free(void);
94static inline void swiotlb_free(void) { } 93static inline void swiotlb_free(void) { }
95#endif 94#endif
96 95
96extern void swiotlb_print_info(void);
97#endif /* __LINUX_SWIOTLB_H */ 97#endif /* __LINUX_SWIOTLB_H */
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index eee512b63f17..0c12d7cce300 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -123,8 +123,9 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev,
123 return phys_to_dma(hwdev, virt_to_phys(address)); 123 return phys_to_dma(hwdev, virt_to_phys(address));
124} 124}
125 125
126static void swiotlb_print_info(unsigned long bytes) 126void swiotlb_print_info(void)
127{ 127{
128 unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
128 phys_addr_t pstart, pend; 129 phys_addr_t pstart, pend;
129 130
130 pstart = virt_to_phys(io_tlb_start); 131 pstart = virt_to_phys(io_tlb_start);
@@ -142,7 +143,7 @@ static void swiotlb_print_info(unsigned long bytes)
142 * structures for the software IO TLB used to implement the DMA API. 143 * structures for the software IO TLB used to implement the DMA API.
143 */ 144 */
144void __init 145void __init
145swiotlb_init_with_default_size(size_t default_size) 146swiotlb_init_with_default_size(size_t default_size, int verbose)
146{ 147{
147 unsigned long i, bytes; 148 unsigned long i, bytes;
148 149
@@ -178,14 +179,14 @@ swiotlb_init_with_default_size(size_t default_size)
178 io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); 179 io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
179 if (!io_tlb_overflow_buffer) 180 if (!io_tlb_overflow_buffer)
180 panic("Cannot allocate SWIOTLB overflow buffer!\n"); 181 panic("Cannot allocate SWIOTLB overflow buffer!\n");
181 182 if (verbose)
182 swiotlb_print_info(bytes); 183 swiotlb_print_info();
183} 184}
184 185
185void __init 186void __init
186swiotlb_init(void) 187swiotlb_init(int verbose)
187{ 188{
188 swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */ 189 swiotlb_init_with_default_size(64 * (1<<20), verbose); /* default to 64MB */
189} 190}
190 191
191/* 192/*
@@ -262,7 +263,7 @@ swiotlb_late_init_with_default_size(size_t default_size)
262 if (!io_tlb_overflow_buffer) 263 if (!io_tlb_overflow_buffer)
263 goto cleanup4; 264 goto cleanup4;
264 265
265 swiotlb_print_info(bytes); 266 swiotlb_print_info();
266 267
267 late_alloc = 1; 268 late_alloc = 1;
268 269