From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: powerpc/iommu: Fix iommu pool initialization
Git-commit: dcd261ba58d7a49f4624b34b3bd2d535f63643a2
Patch-mainline: yes
References: bnc#795789,fate#314056 IBM:83657

powerpc/iommu: Fix iommu pool initialization

The iommu pool patch has a bug where it would cause a crash when using
only one pool (based on the size of the DMA window).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Torsten Duwe <duwe@suse.de>

diff -urpN linux-3.0-5/arch/powerpc/kernel/iommu.c linux-3.0-6/arch/powerpc/kernel/iommu.c
--- linux-3.0-5/arch/powerpc/kernel/iommu.c	2012-12-05 22:42:33.000000000 +0000
+++ linux-3.0-6/arch/powerpc/kernel/iommu.c	2012-12-05 22:44:37.000000000 +0000
@@ -568,9 +568,9 @@ struct iommu_table *iommu_init_table(str
 		tbl->nr_pools = 1;
 
 	/* We reserve the top 1/4 of the table for large allocations */
-	tbl->poolsize = (tbl->it_size * 3 / 4) / IOMMU_NR_POOLS;
+	tbl->poolsize = (tbl->it_size * 3 / 4) / tbl->nr_pools;
 
-	for (i = 0; i < IOMMU_NR_POOLS; i++) {
+	for (i = 0; i < tbl->nr_pools; i++) {
 		p = &tbl->pools[i];
 		spin_lock_init(&(p->lock));
 		p->start = tbl->poolsize * i;
