[edk2-devel] [PATCH 1/1] OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable
Ard Biesheuvel
ardb at kernel.org
Thu Jan 12 10:20:00 UTC 2023
On Wed, 11 Jan 2023 at 19:00, Gerd Hoffmann <kraxel at redhat.com> wrote:
>
> Switching from the ArmPlatformPkg/NorFlashDxe driver to the
> OvmfPkg/VirtNorFlashDxe driver had the side effect that flash address
> space got registered as EFI_MEMORY_WC instead of EFI_MEMORY_UC.
>
> That confuses the linux kernel's numa code, seems this makes kernel
> consider the flash being node memory. "lsmem" changes from ...
>
> RANGE SIZE STATE REMOVABLE BLOCK
> 0x0000000040000000-0x000000013fffffff 4G online yes 8-39
>
> ... to ...
>
> RANGE SIZE STATE REMOVABLE BLOCK
> 0x0000000000000000-0x0000000007ffffff 128M online yes 0
> 0x0000000040000000-0x000000013fffffff 4G online yes 8-39
>
> ... and in the kernel log got new error lines:
>
> NUMA: Warning: invalid memblk node 512 [mem 0x0000000004000000-0x0000000007ffffff]
> NUMA: Faking a node at [mem 0x0000000004000000-0x000000013fffffff]
>
> Changing the attributes back to EFI_MEMORY_UC fixes this.
>
> Fixes: b92298af8218 ("ArmVirtPkg/ArmVirtQemu: migrate to OVMF's VirtNorFlashDxe")
> Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
Reviewed-by: Ard Biesheuvel <ardb at kernel.org>
Queued up as #3887
> ---
> OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
> index ff3121af2a40..f9a41f6aab0f 100644
> --- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
> +++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
> @@ -394,14 +394,14 @@ NorFlashFvbInitialize (
> EfiGcdMemoryTypeMemoryMappedIo,
> Instance->DeviceBaseAddress,
> RuntimeMmioRegionSize,
> - EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
> + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
> );
> ASSERT_EFI_ERROR (Status);
>
> Status = gDS->SetMemorySpaceAttributes (
> Instance->DeviceBaseAddress,
> RuntimeMmioRegionSize,
> - EFI_MEMORY_WC | EFI_MEMORY_RUNTIME
> + EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
> );
> ASSERT_EFI_ERROR (Status);
>
> --
> 2.39.0
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98356): https://edk2.groups.io/g/devel/message/98356
Mute This Topic: https://groups.io/mt/96205414/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list