aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2008-02-29 02:33:24 -0500
committerArnd Bergmann <arnd@arndb.de>2008-03-03 02:03:15 -0500
commitedf441fb80f9d7a962c298e8da94c8c64802fffa (patch)
treee7b6708297a07c6239b68ec36dafcd4485522492 /arch/powerpc
parent08e024272e529076663e5b4dc8eeecd4131f8a48 (diff)
[POWERPC] Move allocation of cell IOMMU pad page
There's no need to allocate the pad page unless we're going to actually use it - so move the allocation to where we know we're going to use it. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/cell/iommu.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 555d264ad568..8e57e1af3785 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -344,12 +344,6 @@ static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu,
344 iommu->ptab = page_address(page); 344 iommu->ptab = page_address(page);
345 memset(iommu->ptab, 0, ptab_size); 345 memset(iommu->ptab, 0, ptab_size);
346 346
347 /* allocate a bogus page for the end of each mapping */
348 page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
349 BUG_ON(!page);
350 iommu->pad_page = page_address(page);
351 clear_page(iommu->pad_page);
352
353 /* number of pages needed for a page table */ 347 /* number of pages needed for a page table */
354 n_pte_pages = (pages_per_segment * 348 n_pte_pages = (pages_per_segment *
355 sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT; 349 sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
@@ -463,6 +457,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
463 unsigned long pte_offset) 457 unsigned long pte_offset)
464{ 458{
465 struct iommu_window *window; 459 struct iommu_window *window;
460 struct page *page;
466 u32 ioid; 461 u32 ioid;
467 462
468 ioid = cell_iommu_get_ioid(np); 463 ioid = cell_iommu_get_ioid(np);
@@ -501,6 +496,11 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
501 * This code also assumes that we have a window that starts at 0, 496 * This code also assumes that we have a window that starts at 0,
502 * which is the case on all spider based blades. 497 * which is the case on all spider based blades.
503 */ 498 */
499 page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
500 BUG_ON(!page);
501 iommu->pad_page = page_address(page);
502 clear_page(iommu->pad_page);
503
504 __set_bit(0, window->table.it_map); 504 __set_bit(0, window->table.it_map);
505 tce_build_cell(&window->table, window->table.it_offset, 1, 505 tce_build_cell(&window->table, window->table.it_offset, 1,
506 (unsigned long)iommu->pad_page, DMA_TO_DEVICE); 506 (unsigned long)iommu->pad_page, DMA_TO_DEVICE);