From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 2/5] xen: arm: Handle 4K aligned hypervisor load address.
Date: Wed, 16 Jul 2014 16:41:28 +0100 [thread overview]
Message-ID: <53C69D28.9090700@linaro.org> (raw)
In-Reply-To: <1405355950-6461-2-git-send-email-ian.campbell@citrix.com>
Hi Ian,
On 14/07/14 17:39, Ian Campbell wrote:
> ---
> xen/arch/arm/arm32/head.S | 54 +++++++++++++++++++++++++++++++++------------
> xen/arch/arm/arm64/head.S | 50 +++++++++++++++++++++++++++++------------
> xen/arch/arm/mm.c | 8 +++++--
> 3 files changed, 82 insertions(+), 30 deletions(-)
>
> diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
> index 1319a13..3a72195 100644
> --- a/xen/arch/arm/arm32/head.S
> +++ b/xen/arch/arm/arm32/head.S
> @@ -26,6 +26,7 @@
>
> #define PT_PT 0xf7f /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=1 P=1 */
> #define PT_MEM 0xf7d /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=0 P=1 */
> +#define PT_MEM_L3 0xf7f /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=1 P=1 */
> #define PT_DEV 0xe71 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=0 P=1 */
> #define PT_DEV_L3 0xe73 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=1 P=1 */
>
> @@ -279,25 +280,50 @@ cpu_init_done:
> ldr r4, =boot_second
> add r4, r4, r10 /* r4 := paddr (boot_second) */
>
> - lsr r2, r9, #SECOND_SHIFT /* Base address for 2MB mapping */
> - lsl r2, r2, #SECOND_SHIFT
> + ldr r1, =boot_third
> + add r1, r1, r10 /* r1 := paddr (boot_third) */
> + mov r3, #0x0
> +
> + /* ... map boot_third in boot_second[1] */
> + orr r2, r1, #PT_UPPER(PT) /* r2:r3 := table map of boot_third */
> + orr r2, r2, #PT_LOWER(PT) /* (+ rights for linear PT) */
> + strd r2, r3, [r4, #8] /* Map it in slot 1 */
> +
> + /* ... map of paddr(start) in boot_second */
> + lsrs r1, r9, #SECOND_SHIFT /* Offset of base paddr in boot_second */
> + mov r2, #0x0ff /* r2 := LPAE entries mask */
> + orr r2, r2, #0x100
> + and r1, r1, r2
> + cmp r1, #1
> + bne 2f /* It's not in slot 1, map it */
> +
> + /* Identity map clashes with boot_third, which we cannot handle yet */
> + PRINT("Unable to build boot page tables - virt and phys addresses clash.\r\n")
> + b fail
AFAIU, this can happen if the kernel is loaded around 2MB in the memory,
right?
Also what does prevent Xen to be shared between 2 third page table?
> +
> +2:
> + lsl r2, r1, #SECOND_SHIFT /* Base address for 2MB mapping */
> orr r2, r2, #PT_UPPER(MEM) /* r2:r3 := section map */
> orr r2, r2, #PT_LOWER(MEM)
> + lsl r1, r1, #3 /* r1 := Slot offset */
> + strd r2, r3, [r4, r1] /* Mapping of paddr(start) */
>
> - /* ... map of vaddr(start) in boot_second */
> - ldr r1, =start
> - lsr r1, #(SECOND_SHIFT - 3) /* Slot for vaddr(start) */
> - strd r2, r3, [r4, r1] /* Map vaddr(start) */
> + /* Setup boot_third: */
> +1: ldr r4, =boot_third
> + add r4, r4, r10 /* r4 := paddr (boot_third) */
>
> - /* ... map of paddr(start) in boot_second */
> - lsrs r1, r9, #30 /* Base paddr */
> - bne 1f /* If paddr(start) is not in slot 0
> - * then the mapping was done in
> - * boot_pgtable above */
> + lsr r2, r9, #THIRD_SHIFT /* Base address for 4K mapping */
> + lsl r2, r2, #THIRD_SHIFT
> + orr r2, r2, #PT_UPPER(MEM_L3) /* r2:r3 := map */
> + orr r2, r2, #PT_LOWER(MEM_L3)
>
> - mov r1, r9, lsr #(SECOND_SHIFT - 3) /* Slot for paddr(start) */
> - strd r2, r3, [r4, r1] /* Map Xen there */
> -1:
> + /* ... map of vaddr(start) in boot_third */
> + mov r1, #0
> +1: strd r2, r3, [r4, r1] /* Map vaddr(start) */
> + add r2, r2, #4096 /* Next page */
I would use PAGE_SIZE or THIRD_SIZE here.
> + add r1, r1, #8 /* Next slot */
> + cmp r1, #(512*8)
Any reason to not use LPAE_ENTRIES here?
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-07-16 15:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 16:38 [PATCH 0/5] xen: arm: various improvements to boot time page table handling Ian Campbell
2014-07-14 16:39 ` [PATCH 1/5] xen: arm: correct whitespace/comments and use #defines in head.S Ian Campbell
2014-07-14 18:37 ` Julien Grall
2014-07-14 16:39 ` [PATCH 2/5] xen: arm: Handle 4K aligned hypervisor load address Ian Campbell
2014-07-14 22:33 ` Julien Grall
2014-07-15 9:13 ` Ian Campbell
2014-07-15 11:03 ` Julien Grall
2014-07-15 11:07 ` Julien Grall
2014-07-15 11:10 ` Ian Campbell
2014-07-15 12:03 ` Julien Grall
2014-07-15 15:18 ` Ian Campbell
2014-07-16 15:18 ` Julien Grall
2014-07-16 16:54 ` Ian Campbell
2014-07-16 15:41 ` Julien Grall [this message]
2014-07-16 16:53 ` Ian Campbell
2014-07-16 17:49 ` Julien Grall
2014-07-17 9:38 ` Ian Campbell
2014-07-14 16:39 ` [PATCH 3/5] xen: arm: Do not use level 0 section mappings in boot page tables Ian Campbell
2014-07-14 16:39 ` [PATCH 4/5] xen: arm: avoid unnecessary aliasing " Ian Campbell
2014-07-17 11:37 ` Ian Campbell
2014-07-14 16:39 ` [PATCH 5/5] xen: arm: flush TLB after overwriting 1:1 mapping " Ian Campbell
2014-07-16 18:11 ` Julien Grall
2014-07-17 9:30 ` Ian Campbell
2014-07-18 13:37 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C69D28.9090700@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.