]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Make IOMMU code safe for > 132 GB of memory
authorMichael Ellerman <michael@ellerman.id.au>
Mon, 21 Jan 2008 07:01:43 +0000 (18:01 +1100)
committerPaul Mackerras <paulus@samba.org>
Fri, 25 Jan 2008 11:52:54 +0000 (22:52 +1100)
Currently the IOMMU code allocates one page for the segment table, that
isn't safe if we have more than 132 GB of RAM.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/iommu.c

index 7f45d59cdf2aa8eed0a0a37687f2e0156c30a064..eb2a94b0dc4cb9917ed95226f629583df61e238c 100644 (file)
@@ -310,8 +310,8 @@ static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, unsigned long siz
 {
        struct page *page;
        int ret, i;
-       unsigned long reg, segments, pages_per_segment, ptab_size, n_pte_pages;
-       unsigned long xlate_base;
+       unsigned long reg, segments, pages_per_segment, ptab_size, stab_size,
+                     n_pte_pages, xlate_base;
        unsigned int virq;
 
        if (cell_iommu_find_ioc(iommu->nid, &xlate_base))
@@ -328,7 +328,8 @@ static void cell_iommu_setup_hardware(struct cbe_iommu *iommu, unsigned long siz
                        __FUNCTION__, iommu->nid, segments, pages_per_segment);
 
        /* set up the segment table */
-       page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
+       stab_size = segments * sizeof(unsigned long);
+       page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(stab_size));
        BUG_ON(!page);
        iommu->stab = page_address(page);
        clear_page(iommu->stab);