public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: Andrei Warkentin <awarkentin@vmware.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	 "pete@akeo.ie" <pete@akeo.ie>,
	"ardb+tianocore@kernel.org" <ardb+tianocore@kernel.org>,
	 "leif@nuviainc.com" <leif@nuviainc.com>,
	"Sunny.Wang@arm.com" <Sunny.Wang@arm.com>,
	 "samer.el-haj-mahmoud@arm.com" <samer.el-haj-mahmoud@arm.com>
Subject: Re: [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be marked as uncached
Date: Tue, 5 Oct 2021 12:05:00 +0200	[thread overview]
Message-ID: <CAMj1kXF2mP9mGyNmQZ3Bmj-TU3f6GEQBd=V3a3oU9-Ukj8wYpg@mail.gmail.com> (raw)
In-Reply-To: <PH0PR05MB8702377CAE923E825DFFEEAEB9AC9@PH0PR05MB8702.namprd05.prod.outlook.com>

On Sat, 2 Oct 2021 at 03:14, Andrei Warkentin <awarkentin@vmware.com> wrote:
>
> I may have misunderstood the flags as being valid ways of mapping the added range. Should we also then take out WC and WT?

No, you understood correctly. The problem is that normal memory ceases
to behave like normal memory when you map it UC (ie., unaligned
accesses and DC ZVA instructions are no longer allowed) so it should
be omitted. We use it in the memory map for things like the runtime
MMIO mappings for NOR flash and RTC.

WC and WT are reasonable for bare metal, but note that we omit those
as well for ArmVirtPkg, as using those breaks coherency, which means
the hypervisor/virtualization host's view of the guest's memory goes
out of sync.


> ________________________________
> From: Jeremy Linton <jeremy.linton@arm.com>
> Sent: Friday, October 1, 2021 7:52 PM
> To: devel@edk2.groups.io <devel@edk2.groups.io>
> Cc: pete@akeo.ie <pete@akeo.ie>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>; leif@nuviainc.com <leif@nuviainc.com>; Andrei Warkentin <awarkentin@vmware.com>; Sunny.Wang@arm.com <Sunny.Wang@arm.com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com>; Jeremy Linton <jeremy.linton@arm.com>
> Subject: [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be marked as uncached
>
> The efi spec seems to indicate that the efi uncacheable attribute
> should be mapped to device memory rather than normal-nc. This means
> that the uefi mem attribute for the >3G ram doesn't match the remainder
> of the RAM in the machine.
>
> So, lets remove the uncacheable attribute to make it more consistent.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>  Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 2ef7da67bd..415d99fadb 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -499,7 +499,7 @@ ApplyVariables (
>
>      Status = gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 3UL * BASE_1GB,
>                      SystemMemorySizeBelow4GB - (3UL * SIZE_1GB),
> -                    EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB);
> +                    EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB);
>      ASSERT_EFI_ERROR (Status);
>      Status = gDS->SetMemorySpaceAttributes (3UL * BASE_1GB,
>                      SystemMemorySizeBelow4GB - (3UL * SIZE_1GB), EFI_MEMORY_WB);
> @@ -511,7 +511,7 @@ ApplyVariables (
>        //
>        Status = gDS->AddMemorySpace (EfiGcdMemoryTypeSystemMemory, 4UL * BASE_1GB,
>                        SystemMemorySize - (4UL * SIZE_1GB),
> -                      EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB);
> +                      EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB);
>        ASSERT_EFI_ERROR (Status);
>        Status = gDS->SetMemorySpaceAttributes (4UL * BASE_1GB,
>                        SystemMemorySize - (4UL * SIZE_1GB), EFI_MEMORY_WB);
> --
> 2.13.7
>

  reply	other threads:[~2021-10-05 10:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02  0:52 [PATCH 0/5] Platform/Rpi: Various cleanups Jeremy Linton
2021-10-02  0:52 ` [PATCH 1/5] Platform/RaspberryPi: Fix vfr warning caused by two defaults Jeremy Linton
2021-10-02  1:12   ` Andrei Warkentin
2021-10-02  0:52 ` [PATCH 2/5] Platform/RaspberryPi: Expand locking to cover return data Jeremy Linton
2021-10-02  1:17   ` Andrei Warkentin
2021-10-05 10:12   ` Ard Biesheuvel
2021-10-05 21:19     ` Jeremy Linton
2021-10-06 15:31       ` Ard Biesheuvel
2021-10-02  0:52 ` [PATCH 3/5] Platform/RaspberryPi: Update Linux quirk name Jeremy Linton
2021-10-02  1:13   ` Andrei Warkentin
2021-10-14 21:22   ` Jeremy Linton
2021-10-02  0:52 ` [PATCH 4/5] Platform/RaspberryPi: Normal memory should not be marked as uncached Jeremy Linton
2021-10-02  1:14   ` Andrei Warkentin
2021-10-05 10:05     ` Ard Biesheuvel [this message]
2021-10-02  0:52 ` [PATCH 5/5] Platform/RaspberryPi: Disconnect/shutdown all drivers before reboot Jeremy Linton
2021-10-02  1:16   ` Andrei Warkentin
2021-10-05 10:11   ` Ard Biesheuvel
2021-10-05 21:24     ` Jeremy Linton
2021-10-05 21:35       ` Ard Biesheuvel

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='CAMj1kXF2mP9mGyNmQZ3Bmj-TU3f6GEQBd=V3a3oU9-Ukj8wYpg@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