All of lore.kernel.org
 help / color / mirror / Atom feed
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 v2 2/4] xen: arm: Handle 4K aligned hypervisor load address.
Date: Sun, 20 Jul 2014 21:28:47 +0100	[thread overview]
Message-ID: <53CC267F.8050103@linaro.org> (raw)
In-Reply-To: <1405699976-9260-2-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 18/07/14 17:12, Ian Campbell wrote:
> diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
> index 51501dc..0a76c2e 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 */
>
> @@ -258,11 +259,11 @@ cpu_init_done:
>           /* Setup boot_pgtable: */
>           ldr   r1, =boot_second
>           add   r1, r1, r10            /* r1 := paddr (boot_second) */
> -        mov   r3, #0x0
>
>           /* ... map boot_second in boot_pgtable[0] */
>           orr   r2, r1, #PT_UPPER(PT)  /* r2:r3 := table map of boot_second */
>           orr   r2, r2, #PT_LOWER(PT)  /* (+ rights for linear PT) */
> +        mov   r3, #0x0
>           strd  r2, r3, [r4, #0]       /* Map it in slot 0 */
>
>           /* ... map of paddr(start) in boot_pgtable */
> @@ -279,31 +280,61 @@ 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) */
> +
> +        /* ... 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) */
> +        mov   r3, #0x0
> +        strd  r2, r3, [r4, #8]       /* Map it in slot 1 */
> +
> +        /* ... map of paddr(start) in boot_second */
> +        lsr   r2, r9, #SECOND_SHIFT  /* Offset of base paddr in boot_second */
> +        mov   r3, #0x0ff             /* r2 := LPAE entries mask */

The register in the comment looks wrong to me.


> +        orr   r3, r3, #0x100

I took me several minutes to understand why the orr... I think the 2 
previous assembly lines could be replaced by a single one:
            ldr r3, =LPAE_ENTRY_MASK

[..]

> diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
> index d46481b..5d7b2b5 100644
> --- a/xen/arch/arm/arm64/head.S
> +++ b/xen/arch/arm/arm64/head.S
> @@ -27,6 +27,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 */
>
> @@ -274,8 +275,9 @@ skip_bss:
>           lsl   x2, x1, #ZEROETH_SHIFT /* Base address for 512GB mapping */
>           mov   x3, #PT_MEM            /* x2 := Section mapping */
>           orr   x2, x2, x3
> -        lsl   x1, x1, #3             /* x1 := Slot offset */
> -        str   x2, [x4, x1]           /* Mapping of paddr(start)*/
> +        and   x1, x1, #0x1ff         /* x1 := Slot offset */

The #0x1ff could be replaced by #LPAE_ENTRY_MASK

> +        lsl   x1, x1, #3
> +        str   x2, [x4, x1]           /* Mapping of paddr(start) */
>
>   1:      /* Setup boot_first: */
>           ldr   x4, =boot_first        /* Next level into boot_first */
> @@ -290,7 +292,7 @@ skip_bss:
>
>           /* ... map of paddr(start) in boot_first */
>           lsr   x2, x19, #FIRST_SHIFT  /* x2 := Offset of base paddr in boot_first */
> -        and   x1, x2, 0x1ff          /* x1 := Slot to use */
> +        and   x1, x2, #0x1ff         /* x1 := Slot to use */

Same here.

OOI, you only added the #. Was there any issue before?

>           cbz   x1, 1f                 /* It's in slot 0, map in boot_second */
>
>           lsl   x2, x2, #FIRST_SHIFT   /* Base address for 1GB mapping */
> @@ -303,31 +305,55 @@ skip_bss:
>           ldr   x4, =boot_second       /* Next level into boot_second */
>           add   x4, x4, x20            /* x4 := paddr(boot_second) */
>
> -        lsr   x2, x19, #SECOND_SHIFT /* Base address for 2MB mapping */
> -        lsl   x2, x2, #SECOND_SHIFT
> +        /* ... map boot_third in boot_second[1] */
> +        ldr   x1, =boot_third
> +        add   x1, x1, x20            /* x1 := paddr(boot_third) */
> +        mov   x3, #PT_PT             /* x2 := table map of boot_third */
> +        orr   x2, x1, x3             /*       + rights for linear PT */
> +        str   x2, [x4, #8]           /* Map it in slot 1 */
> +
> +        /* ... map of paddr(start) in boot_second */
> +        lsr   x2, x19, #SECOND_SHIFT /* x2 := Offset of base paddr in boot_second */
> +        and   x1, x2, 0x1ff          /* x1 := Slot to use */

A bit strange that few lines above you changed a similar lines to add #, 
and here you forgot it.

I would also replace the 0x1ff by LPAE_ENTRY_MASK.

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-07-20 20:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 16:11 [PATCH v2 0/4] xen: arm: various improvements to boot time page table handling Ian Campbell
2014-07-18 16:12 ` [PATCH v2 1/4] xen: arm: correct whitespace/comments and use #defines in head.S Ian Campbell
2014-07-18 16:12   ` [PATCH v2 2/4] xen: arm: Handle 4K aligned hypervisor load address Ian Campbell
2014-07-20 20:28     ` Julien Grall [this message]
2014-07-21 12:00       ` Ian Campbell
2014-07-18 16:12   ` [PATCH v2 3/4] xen: arm: Do not use level 0 section mappings in boot page tables Ian Campbell
2014-07-20 20:42     ` Julien Grall
2014-07-18 16:12   ` [PATCH v2 4/4] xen: arm: avoid unnecessary additional " Ian Campbell
2014-07-20 21:27     ` Julien Grall
2014-07-18 16:16 ` [PATCH v2 0/4] xen: arm: various improvements to boot time page table handling Ian Campbell
2014-07-18 16:30   ` Ian Campbell
2014-07-18 16:36     ` Andrew Cooper
2014-07-18 16:43       ` Ian Campbell
2014-07-18 16:57 ` [PATCH v2 5/4] xen: arm: ensure that the boot code is <4K in size Ian Campbell
2014-07-18 17:06   ` Andrew Cooper
2014-07-21 10:39     ` Ian Campbell
2014-07-21 11:21       ` Ian Campbell
2014-07-20 21:39   ` Julien Grall

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=53CC267F.8050103@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.