Ian Campbell
2012-Mar-15 15:40 UTC
[PATCH] arm: use symbolic constants for initial page table attributes
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- xen/arch/arm/head.S | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S index eabb403..6fb7214 100644 --- a/xen/arch/arm/head.S +++ b/xen/arch/arm/head.S @@ -21,6 +21,12 @@ #include <asm/page.h> #include <asm/asm_defns.h> +#define XEN_PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ +#define XEN_PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ +#define XEN_PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ + +#define PT_UPPER(x) (XEN_PT_##x & 0xf00) +#define PT_LOWER(x) (XEN_PT_##x & 0x0ff) /* Macro to print a string to the UART, if there is one. * Clobbers r0-r3. */ @@ -203,8 +209,8 @@ hyp: ldr r1, =xen_second add r1, r1, r10 /* r1 := paddr (xen_second) */ mov r3, #0x0 - orr r2, r1, #0xe00 /* r2:r3 := table map of xen_second */ - orr r2, r2, #0x07f /* (+ rights for linear PT) */ + orr r2, r1, #PT_UPPER(PT) /* r2:r3 := table map of xen_second */ + orr r2, r2, #PT_LOWER(PT) /* (+ rights for linear PT) */ strd r2, r3, [r4, #0] /* Map it in slot 0 */ add r2, r2, #0x1000 strd r2, r3, [r4, #8] /* Map 2nd page in slot 1 */ @@ -214,8 +220,8 @@ hyp: strd r2, r3, [r4, #24] /* Map 4th page in slot 3 */ /* Now set up the second-level entries */ - orr r2, r9, #0xe00 - orr r2, r2, #0x07d /* r2:r3 := 2MB normal map of Xen */ + orr r2, r9, #PT_UPPER(MEM) + orr r2, r2, #PT_LOWER(MEM) /* r2:r3 := 2MB normal map of Xen */ mov r4, r9, lsr #18 /* Slot for paddr(start) */ strd r2, r3, [r1, r4] /* Map Xen there */ ldr r4, =start @@ -225,8 +231,8 @@ hyp: ldr r3, =(1<<(54-32)) /* NS for device mapping */ lsr r2, r11, #21 lsl r2, r2, #21 /* 2MB-aligned paddr of UART */ - orr r2, r2, #0xe00 - orr r2, r2, #0x071 /* r2:r3 := 2MB dev map including UART */ + orr r2, r2, #PT_UPPER(DEV) + orr r2, r2, #PT_LOWER(DEV) /* r2:r3 := 2MB dev map including UART */ add r4, r4, #8 strd r2, r3, [r1, r4] /* Map it in the fixmap''s slot */ #else @@ -235,8 +241,8 @@ hyp: mov r3, #0x0 lsr r2, r8, #21 lsl r2, r2, #21 /* 2MB-aligned paddr of DTB */ - orr r2, r2, #0xe00 - orr r2, r2, #0x07d /* r2:r3 := 2MB RAM incl. DTB */ + orr r2, r2, #PT_UPPER(MEM) + orr r2, r2, #PT_LOWER(MEM) /* r2:r3 := 2MB RAM incl. DTB */ add r4, r4, #8 strd r2, r3, [r1, r4] /* Map it in the early boot slot */ -- 1.7.2.5
Tim Deegan
2012-Mar-15 17:27 UTC
Re: [PATCH] arm: use symbolic constants for initial page table attributes
At 15:40 +0000 on 15 Mar (1331826008), Ian Campbell wrote:> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > --- > xen/arch/arm/head.S | 22 ++++++++++++++-------- > 1 files changed, 14 insertions(+), 8 deletions(-) > > diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S > index eabb403..6fb7214 100644 > --- a/xen/arch/arm/head.S > +++ b/xen/arch/arm/head.S > @@ -21,6 +21,12 @@ > #include <asm/page.h> > #include <asm/asm_defns.h> > > +#define XEN_PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ > +#define XEN_PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ > +#define XEN_PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ > +Since these are file-local, maybe drop the XEN_ prefix to avoid the long lines? Otherwise, Ack. Tim.
Ian Campbell
2012-Mar-15 17:29 UTC
Re: [PATCH] arm: use symbolic constants for initial page table attributes
On Thu, 2012-03-15 at 17:27 +0000, Tim Deegan wrote:> At 15:40 +0000 on 15 Mar (1331826008), Ian Campbell wrote: > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > > --- > > xen/arch/arm/head.S | 22 ++++++++++++++-------- > > 1 files changed, 14 insertions(+), 8 deletions(-) > > > > diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S > > index eabb403..6fb7214 100644 > > --- a/xen/arch/arm/head.S > > +++ b/xen/arch/arm/head.S > > @@ -21,6 +21,12 @@ > > #include <asm/page.h> > > #include <asm/asm_defns.h> > > > > +#define XEN_PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ > > +#define XEN_PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ > > +#define XEN_PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ > > + > > Since these are file-local, maybe drop the XEN_ prefix to avoid the long > lines?Hmm. My Emacs appears to have stopped highlighting the 80th column. How odd.> Otherwise, Ack.Thanks.
Ian Campbell
2012-Mar-22 15:14 UTC
Re: [PATCH] arm: use symbolic constants for initial page table attributes
On Thu, 2012-03-15 at 17:29 +0000, Ian Campbell wrote:> On Thu, 2012-03-15 at 17:27 +0000, Tim Deegan wrote: > > At 15:40 +0000 on 15 Mar (1331826008), Ian Campbell wrote: > > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > > > --- > > > xen/arch/arm/head.S | 22 ++++++++++++++-------- > > > 1 files changed, 14 insertions(+), 8 deletions(-) > > > > > > diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S > > > index eabb403..6fb7214 100644 > > > --- a/xen/arch/arm/head.S > > > +++ b/xen/arch/arm/head.S > > > @@ -21,6 +21,12 @@ > > > #include <asm/page.h> > > > #include <asm/asm_defns.h> > > > > > > +#define XEN_PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ > > > +#define XEN_PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ > > > +#define XEN_PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ > > > + > > > > Since these are file-local, maybe drop the XEN_ prefix to avoid the long > > lines? > > Hmm. My Emacs appears to have stopped highlighting the 80th column. How > odd.I managed to mess this up and push the un-edited version (specifically I aborted the rebase -i for a different reason and forgot to do these again). I''ll apply the following fixup. Also managed to drop your Ack on this and the tab cleanup in the same error, sorry. Ian. diff --git a/xen/arch/arm/head.S b/xen/arch/arm/head.S index 6fb7214..1858eb3 100644 --- a/xen/arch/arm/head.S +++ b/xen/arch/arm/head.S @@ -21,12 +21,12 @@ #include <asm/page.h> #include <asm/asm_defns.h> -#define XEN_PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ -#define XEN_PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ -#define XEN_PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ +#define PT_PT 0xe7f /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=1, P=1 */ +#define PT_MEM 0xe7d /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=111, T=0, P=1 */ +#define PT_DEV 0xe71 /* nG=1, AF=1, SH=10, AP=01, NS=1, ATTR=100, T=0, P=1 */ -#define PT_UPPER(x) (XEN_PT_##x & 0xf00) -#define PT_LOWER(x) (XEN_PT_##x & 0x0ff) +#define PT_UPPER(x) (PT_##x & 0xf00) +#define PT_LOWER(x) (PT_##x & 0x0ff) /* Macro to print a string to the UART, if there is one. * Clobbers r0-r3. */