public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, heyi.guo@Linaro.org
Subject: Re: [PATCH] ArmPkg/CpuDxe: handle implied attributes in EfiAttributeToArmAttribute
Date: Wed, 8 Mar 2017 13:10:21 +0000	[thread overview]
Message-ID: <20170308131021.GY16034@bivouac.eciton.net> (raw)
In-Reply-To: <1488973904-15031-1-git-send-email-ard.biesheuvel@linaro.org>

On Wed, Mar 08, 2017 at 12:51:44PM +0100, Ard Biesheuvel wrote:
> Some memory attributes are implied by the memory type, e.g., device memory
> is always mapped non-executable and cached memory should have the inner
> shareable attribute.
> 
> In order to prevent unnecessary memory attribute updates of mappings
> created early on, make EfiAttributeToArmAttribute() return these implied
> attributes in the same way as ArmMmuLib does already. This avoids false
> positives when looking for differences between current and desired mapping
> attributes.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> index 7688846e70cb..3e216c7cb235 100644
> --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
> @@ -204,16 +204,20 @@ EfiAttributeToArmAttribute (
>  
>    switch (EfiAttributes & EFI_MEMORY_CACHETYPE_MASK) {
>    case EFI_MEMORY_UC:
> -    ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY;
> +    if (ArmReadCurrentEL () == AARCH64_EL2) {
> +      ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY | TT_XN_MASK;
> +    } else {
> +      ArmAttributes = TT_ATTR_INDX_DEVICE_MEMORY | TT_UXN_MASK | TT_PXN_MASK;
> +    }
>      break;
>    case EFI_MEMORY_WC:
>      ArmAttributes = TT_ATTR_INDX_MEMORY_NON_CACHEABLE;
>      break;
>    case EFI_MEMORY_WT:
> -    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_THROUGH;
> +    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_THROUGH | TT_SH_INNER_SHAREABLE;
>      break;
>    case EFI_MEMORY_WB:
> -    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_BACK;
> +    ArmAttributes = TT_ATTR_INDX_MEMORY_WRITE_BACK | TT_SH_INNER_SHAREABLE;
>      break;
>    default:
>      ArmAttributes = TT_ATTR_INDX_MASK;
> -- 
> 2.7.4
> 


      reply	other threads:[~2017-03-08 13:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 11:51 [PATCH] ArmPkg/CpuDxe: handle implied attributes in EfiAttributeToArmAttribute Ard Biesheuvel
2017-03-08 13:10 ` Leif Lindholm [this message]

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-list 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=20170308131021.GY16034@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox