public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Heyi Guo <heyi.guo@linaro.org>
Cc: linaro-uefi <linaro-uefi@lists.linaro.org>,
	 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Peicong Li <lipeicong@huawei.com>,
	 Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [RFC] ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHARE
Date: Tue, 7 Nov 2017 11:08:39 +0000	[thread overview]
Message-ID: <CAKv+Gu-SjDqneDx+Af_L1rxgS4UnNTyG5t_6TNCp6f4PhDgLyQ@mail.gmail.com> (raw)
In-Reply-To: <1510052748-5564-1-git-send-email-heyi.guo@linaro.org>

On 7 November 2017 at 11:05, Heyi Guo <heyi.guo@linaro.org> wrote:
> From: Peicong Li <lipeicong@huawei.com>
>
> Flash region needs to be set as cacheable (write back) to increase
> performance, if PEI is still XIP on flash or DXE FV is decompressed
> from flash FV. However some ARM platforms do not support to set flash
> as inner shareable since flash is not normal DDR memory and it will
> not respond to cache snoop request, which will causes system hang
> after MMU is enabled.
>
> So we need a new ARM memory region attribute WRITE_BACK_NONSHARE for
> flash region on these platforms specifically. This attribute will set
> the region as write back but not inner shared.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Peicong Li <lipeicong@huawei.com>
> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  ArmPkg/Include/Library/ArmLib.h                  | 2 ++
>  ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 4 ++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
> index 24ffe9f..e43e375 100644
> --- a/ArmPkg/Include/Library/ArmLib.h
> +++ b/ArmPkg/Include/Library/ArmLib.h
> @@ -39,6 +39,8 @@
>  typedef enum {
>    ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED = 0,
>    ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_UNCACHED_UNBUFFERED,
> +  ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHARE,
> +  ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHARE,
>    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK,
>    ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK,
>    ARM_MEMORY_REGION_ATTRIBUTE_WRITE_THROUGH,
> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> index 8bd1c6f..cc10143 100644
> --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
> @@ -35,6 +35,10 @@ ArmMemoryAttributeToPageAttribute (
>    )
>  {
>    switch (Attributes) {
> +  case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHARE:
> +  case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK_NONSHARE:
> +    return TT_ATTR_INDX_MEMORY_WRITE_BACK;
> +
>    case ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK:
>    case ARM_MEMORY_REGION_ATTRIBUTE_NONSECURE_WRITE_BACK:
>      return TT_ATTR_INDX_MEMORY_WRITE_BACK | TT_SH_INNER_SHAREABLE;
> --
> 2.7.2.windows.1
>

I'd prefer the name
ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK_NONSHAREABLE but other than
that, this looks sensible to me. Leif?


  reply	other threads:[~2017-11-07 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 11:05 [RFC] ArmPkg/ArmMmuLib: Add new attribute WRITE_BACK_NONSHARE Heyi Guo
2017-11-07 11:08 ` Ard Biesheuvel [this message]
2017-11-07 11:23   ` Leif Lindholm
2017-11-07 11:25     ` Ard Biesheuvel
2017-11-07 11:30       ` Leif Lindholm
2017-11-07 11:37       ` Heyi Guo

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=CAKv+Gu-SjDqneDx+Af_L1rxgS4UnNTyG5t_6TNCp6f4PhDgLyQ@mail.gmail.com \
    --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