From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Pete Batard <pete@akeo.ie>, devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
andrey.warkentin@gmail.com, samer.el-haj-mahmoud@arm.com
Subject: Re: [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory
Date: Wed, 11 Dec 2019 13:22:37 +0100 [thread overview]
Message-ID: <16fc8664-5dc0-3bb2-56b0-52107b9bce4d@redhat.com> (raw)
In-Reply-To: <20191211112552.15900-3-pete@akeo.ie>
On 12/11/19 12:25 PM, Pete Batard wrote:
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> When using ACPI OpRegions to poke device registers, Linux will use
> the UEFI memory map to decide which memory attributes to use, and
> so they should not be described as cacheable memory.
>
> Since MMIO regions that don't require an OS virtual mapping at runtime
> don't really belong in the UEFI memory map to begin with, omit them
> entirely.
>
> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
> Platform/RaspberryPi/Include/Library/RPiMem.h | 7 ++++---
> Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 10 ++++++++++
> Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c | 6 +++---
> 3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/Platform/RaspberryPi/Include/Library/RPiMem.h b/Platform/RaspberryPi/Include/Library/RPiMem.h
> index 9d38e4b6cfb3..a033af369bb0 100644
> --- a/Platform/RaspberryPi/Include/Library/RPiMem.h
> +++ b/Platform/RaspberryPi/Include/Library/RPiMem.h
> @@ -9,9 +9,10 @@
> #ifndef RPI_MEM_H__
> #define RPI_MEM_H__
>
> -#define RPI_MEM_BASIC_REGION 0
> -#define RPI_MEM_RUNTIME_REGION 1
> -#define RPI_MEM_RESERVED_REGION 2
> +#define RPI_MEM_UNMAPPED_REGION 0
> +#define RPI_MEM_BASIC_REGION 1
> +#define RPI_MEM_RUNTIME_REGION 2
> +#define RPI_MEM_RESERVED_REGION 3
>
> typedef struct {
> CONST CHAR16* Name;
> diff --git a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> index 3a0f7e19e993..7ba1cc5602d2 100644
> --- a/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> +++ b/Platform/RaspberryPi/Library/MemoryInitPeiLib/MemoryInitPeiLib.c
> @@ -72,6 +72,15 @@ AddRuntimeServicesRegion (
> );
> }
>
> +STATIC
> +VOID
> +AddUnmappedMemoryRegion (
> + IN ARM_MEMORY_REGION_DESCRIPTOR *Desc
> + )
> +{
> + // Do nothing
> +}
> +
> STATIC
> VOID
> AddReservedMemoryRegion (
> @@ -88,6 +97,7 @@ AddReservedMemoryRegion (
> }
>
> void (*AddRegion[]) (IN ARM_MEMORY_REGION_DESCRIPTOR *Desc) = {
> + AddUnmappedMemoryRegion,
> AddBasicMemoryRegion,
> AddRuntimeServicesRegion,
> AddReservedMemoryRegion,
> diff --git a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> index 781cf78b83d3..f8223d1b94e8 100644
> --- a/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> +++ b/Platform/RaspberryPi/Library/PlatformLib/RaspberryPiMem.c
> @@ -117,7 +117,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = mVideoCoreSize;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"GPU Reserved";
>
> // Compute the total RAM size available on this platform
> @@ -139,7 +139,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = BCM2711_SOC_REGISTER_LENGTH;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (27xx)";
> }
>
> @@ -152,7 +152,7 @@ ArmPlatformGetVirtualMemoryMap (
> VirtualMemoryTable[Index].VirtualBase = VirtualMemoryTable[Index].PhysicalBase;
> VirtualMemoryTable[Index].Length = BCM2836_SOC_REGISTER_LENGTH;
> VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> - VirtualMemoryInfo[Index].Type = RPI_MEM_RESERVED_REGION;
> + VirtualMemoryInfo[Index].Type = RPI_MEM_UNMAPPED_REGION;
> VirtualMemoryInfo[Index++].Name = L"SoC Reserved (283x)";
>
> // If we have RAM above the 1 GB mark, declare it
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
next prev parent reply other threads:[~2019-12-11 12:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 11:25 [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 1/5] Platform/RPi: Fix overlap of SoC registers and RAM Pete Batard
2019-12-11 12:21 ` Philippe Mathieu-Daudé
2019-12-11 12:39 ` Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 2/5] Platform/RPi: Don't describe MMIO regions as memory Pete Batard
2019-12-11 12:22 ` Philippe Mathieu-Daudé [this message]
2019-12-11 11:25 ` [edk2-platforms][PATCH 3/5] Platform/RPi4: Add initial ACPI tables Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 4/5] Platform/RPi4: Update ACPI tables for the new platform Pete Batard
2019-12-11 11:25 ` [edk2-platforms][PATCH 5/5] Platform/RPi4: Add base platform files Pete Batard
2019-12-11 16:21 ` [edk2-platforms][PATCH 0/5] Add initial Raspberry Pi 4 platform 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=16fc8664-5dc0-3bb2-56b0-52107b9bce4d@redhat.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