please pull powerpc-merge.git

Olof Johansson olof at lixom.net
Fri Dec 2 16:57:21 EST 2005


On Fri, Dec 02, 2005 at 04:39:58PM +1100, Paul Mackerras wrote:
> > I suggest the following instead.
> 
> Or better still, we could do:
> 
> 	if (TCE_PAGE_FACTOR == 0 && npages == 1)
> 		return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
> 					   direction);
> 
> which will let the whole tce_build_pSeriesLP call get optimized out
> when we have 64k pages selected.

Yep, that's even better. Yet another twist is to do:

if ((npages << TCE_PAGE_FACTOR) == 1)

Same result, maybe a little easier to read. Patch below if it's in your
taste, if not go with what you have. :)


-Olof



---

Fix adjustment of TCE_PAGE_FACTOR in fallbacks to tce_build_pSeriesLP.


Signed-off-by: Olof Johansson <olof at lixom.net>

Index: 2.6/arch/powerpc/platforms/pseries/iommu.c
===================================================================
--- 2.6.orig/arch/powerpc/platforms/pseries/iommu.c	2005-11-29 09:11:47.000000000 -0600
+++ 2.6/arch/powerpc/platforms/pseries/iommu.c	2005-12-01 23:53:04.000000000 -0600
@@ -109,6 +109,9 @@ static void tce_build_pSeriesLP(struct i
 	u64 rc;
 	union tce_entry tce;
 
+	tcenum <<= TCE_PAGE_FACTOR;
+	npages <<= TCE_PAGE_FACTOR;
+
 	tce.te_word = 0;
 	tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
 	tce.te_rdwr = 1;
@@ -143,10 +146,8 @@ static void tce_buildmulti_pSeriesLP(str
 	union tce_entry tce, *tcep;
 	long l, limit;
 
-	tcenum <<= TCE_PAGE_FACTOR;
-	npages <<= TCE_PAGE_FACTOR;
-
-	if (npages == 1)
+	/* For performance reasons, only fall back for single TCE insert */
+	if ((npages << TCE_PAGE_FACTOR) == 1)
 		return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
 					   direction);
 
@@ -164,6 +165,9 @@ static void tce_buildmulti_pSeriesLP(str
 		__get_cpu_var(tce_page) = tcep;
 	}
 
+	tcenum <<= TCE_PAGE_FACTOR;
+	npages <<= TCE_PAGE_FACTOR;
+
 	tce.te_word = 0;
 	tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
 	tce.te_rdwr = 1;



More information about the Linuxppc64-dev mailing list