[PATCH] PPC: Correct the tophys/tovirt macros

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Mon Oct 1 09:28:47 EST 2012


asm/page.h discusses the calculation for v2p and p2v, it should be:
 va = pa + KERNELBASE - PHYSICAL_START
which is the same as:
 va = pa + LOAD_OFFSET

tophys/tovirt were using PAGE_OFFSET, which as page.h says, is almost
always the same thing.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
---
 arch/powerpc/include/asm/ppc_asm.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index ea2a86e..44edc3a 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -461,14 +461,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
 #define fromreal(rd)	tovirt(rd,rd)
 
 #define tophys(rd,rs)				\
-0:	addis	rd,rs,-PAGE_OFFSET at h;		\
+0:	addis	rd,rs,-LOAD_OFFSET at h;		\
 	.section ".vtop_fixup","aw";		\
 	.align  1;				\
 	.long   0b;				\
 	.previous
 
 #define tovirt(rd,rs)				\
-0:	addis	rd,rs,PAGE_OFFSET at h;		\
+0:	addis	rd,rs,LOAD_OFFSET at h;		\
 	.section ".ptov_fixup","aw";		\
 	.align  1;				\
 	.long   0b;				\
-- 
1.7.4.1



More information about the Linuxppc-dev mailing list