Skip to content

Commit

Permalink
swiotlb: Defer swiotlb init printing, export swiotlb_print_info()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Nov 10, 2009
1 parent 5740afd commit ad32e8c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions arch/ia64/kernel/pci-swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct dma_map_ops swiotlb_dma_ops = {
void __init swiotlb_dma_init(void)
{
dma_ops = &swiotlb_dma_ops;
swiotlb_init();
swiotlb_init(1);
}

void __init pci_swiotlb_init(void)
Expand All @@ -51,7 +51,7 @@ void __init pci_swiotlb_init(void)
swiotlb = 1;
printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
machvec_init("dig");
swiotlb_init();
swiotlb_init(1);
dma_ops = &swiotlb_dma_ops;
#else
panic("Unable to find Intel IOMMU");
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void __init setup_arch(char **cmdline_p)

#ifdef CONFIG_SWIOTLB
if (ppc_swiotlb_enable)
swiotlb_init();
swiotlb_init(1);
#endif

paging_init();
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ void __init setup_arch(char **cmdline_p)

#ifdef CONFIG_SWIOTLB
if (ppc_swiotlb_enable)
swiotlb_init();
swiotlb_init(1);
#endif

paging_init();
Expand Down
3 changes: 1 addition & 2 deletions arch/x86/kernel/pci-swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ void __init pci_swiotlb_init(void)
if (swiotlb_force)
swiotlb = 1;
if (swiotlb) {
printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
swiotlb_init();
swiotlb_init(0);
dma_ops = &swiotlb_dma_ops;
}
}
4 changes: 2 additions & 2 deletions include/linux/swiotlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ struct scatterlist;
*/
#define IO_TLB_SHIFT 11

extern void
swiotlb_init(void);
extern void swiotlb_init(int verbose);

extern void
*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
Expand Down Expand Up @@ -94,4 +93,5 @@ extern void __init swiotlb_free(void);
static inline void swiotlb_free(void) { }
#endif

extern void swiotlb_print_info(void);
#endif /* __LINUX_SWIOTLB_H */
15 changes: 8 additions & 7 deletions lib/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev,
return phys_to_dma(hwdev, virt_to_phys(address));
}

static void swiotlb_print_info(unsigned long bytes)
void swiotlb_print_info(void)
{
unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
phys_addr_t pstart, pend;

pstart = virt_to_phys(io_tlb_start);
Expand All @@ -142,7 +143,7 @@ static void swiotlb_print_info(unsigned long bytes)
* structures for the software IO TLB used to implement the DMA API.
*/
void __init
swiotlb_init_with_default_size(size_t default_size)
swiotlb_init_with_default_size(size_t default_size, int verbose)
{
unsigned long i, bytes;

Expand Down Expand Up @@ -178,14 +179,14 @@ swiotlb_init_with_default_size(size_t default_size)
io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
if (!io_tlb_overflow_buffer)
panic("Cannot allocate SWIOTLB overflow buffer!\n");

swiotlb_print_info(bytes);
if (verbose)
swiotlb_print_info();
}

void __init
swiotlb_init(void)
swiotlb_init(int verbose)
{
swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */
swiotlb_init_with_default_size(64 * (1<<20), verbose); /* default to 64MB */
}

/*
Expand Down Expand Up @@ -262,7 +263,7 @@ swiotlb_late_init_with_default_size(size_t default_size)
if (!io_tlb_overflow_buffer)
goto cleanup4;

swiotlb_print_info(bytes);
swiotlb_print_info();

late_alloc = 1;

Expand Down

0 comments on commit ad32e8c

Please sign in to comment.