From 29d2cbe15903f06b21d6b9cafefb1840d9672115 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Wed, 18 Jan 2023 02:12:37 -0500 Subject: [PATCH] * Wed Jan 18 2023 Miroslav Rezanina - 20221207gitfff6d81270b5-4 - edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch [bz#2158173] - Resolves: bz#2158173 ([aarch64][numa] Failed to create 2 numa nodes in some hardwares) --- ...t-use-unaligned-CopyMem-on-NOR-flash.patch | 86 +++++++++++++++++++ edk2.spec | 9 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch diff --git a/edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch b/edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch new file mode 100644 index 0000000..25cd51b --- /dev/null +++ b/edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch @@ -0,0 +1,86 @@ +From f6d83cd74def6af6ab27ddda15112cdf59c853d5 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 16 Jan 2023 10:46:39 +0100 +Subject: [PATCH] ArmVirt: don't use unaligned CopyMem () on NOR flash + +RH-Author: Gerd Hoffmann +RH-MergeRequest: 23: ArmVirt: don't use unaligned CopyMem () on NOR flash +RH-Bugzilla: 2158173 +RH-Acked-by: Oliver Steffen +RH-Commit: [1/1] 7c8b7e5cd9c239dd8d040450bd4d479ef789114b (kraxel/centos-edk2) + +Commit 789a72328553 reclassified the NOR flash region as EFI_MEMORY_WC +in the OS visible EFI memory map, and dropped the explicit aligned +CopyMem() implementation, in the assumption that EFI_MEMORY_WC will be +honored by the OS, and that the region will be mapped in a way that +tolerates misaligned accesseses. However, Linux today uses device +attributes for all EFI MMIO regions, in spite of the memory type +attributes, and so using misaligned accesses is never safe. + +So instead, switch to the generic CopyMem() implementation entirely, +just like we already did for VariableRuntimeDxe. + +Fixes: 789a72328553 ("OvmfPkg/VirtNorFlashDxe: use EFI_MEMORY_WC and drop AlignedCopyMem()") +Signed-off-by: Gerd Hoffmann +Reviewed-by: Ard Biesheuvel +(cherry picked from commit 987cc09c7cf38d628063062483e2341fba679b0e) +--- + ArmVirtPkg/ArmVirtKvmTool.dsc | 6 +++++- + ArmVirtPkg/ArmVirtQemu.dsc | 6 +++++- + ArmVirtPkg/ArmVirtQemuKernel.dsc | 6 +++++- + 3 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc +index 2ba00bd08f..d0afe1b49e 100644 +--- a/ArmVirtPkg/ArmVirtKvmTool.dsc ++++ b/ArmVirtPkg/ArmVirtKvmTool.dsc +@@ -296,7 +296,11 @@ + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf + } + +- OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf ++ OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf { ++ ++ # don't use unaligned CopyMem () on the UEFI varstore NOR flash region ++ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf ++ } + + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + +diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc +index a4bd72e481..76389e6bd4 100644 +--- a/ArmVirtPkg/ArmVirtQemu.dsc ++++ b/ArmVirtPkg/ArmVirtQemu.dsc +@@ -428,7 +428,11 @@ + + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf + } +- OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf ++ OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf { ++ ++ # don't use unaligned CopyMem () on the UEFI varstore NOR flash region ++ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf ++ } + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # +diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc +index 7f85b0dc92..0445a89b1c 100644 +--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc ++++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc +@@ -331,7 +331,11 @@ + + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf + } +- OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf ++ OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf { ++ ++ # don't use unaligned CopyMem () on the UEFI varstore NOR flash region ++ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf ++ } + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # +-- +2.31.1 + diff --git a/edk2.spec b/edk2.spec index 4097437..8d768a2 100644 --- a/edk2.spec +++ b/edk2.spec @@ -16,7 +16,7 @@ ExclusiveArch: x86_64 aarch64 Name: edk2 Version: %{GITDATE}git%{GITCOMMIT} -Release: 3%{?dist} +Release: 4%{?dist} Summary: UEFI firmware for 64-bit virtual machines License: BSD-2-Clause-Patent and OpenSSL and MIT URL: http://www.tianocore.org @@ -75,6 +75,8 @@ Patch0033: 0033-OvmfPkg-SmbiosPlatformDxe-use-PcdFirmware.patch Patch34: edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch # For bz#1983086 - Assertion failure when creating 1024 VCPU VM: [...]UefiCpuPkg/CpuMpPei/CpuBist.c(186): !EFI_ERROR (Status) Patch35: edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch +# For bz#2158173 - [aarch64][numa] Failed to create 2 numa nodes in some hardwares +Patch36: edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch # python3-devel and libuuid-devel are required for building tools. @@ -379,6 +381,11 @@ install -m 0644 \ %changelog +* Wed Jan 18 2023 Miroslav Rezanina - 20221207gitfff6d81270b5-4 +- edk2-ArmVirt-don-t-use-unaligned-CopyMem-on-NOR-flash.patch [bz#2158173] +- Resolves: bz#2158173 + ([aarch64][numa] Failed to create 2 numa nodes in some hardwares) + * Mon Jan 16 2023 Miroslav Rezanina - 20221207gitfff6d81270b5-3 - edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch [bz#2158173] - edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch [bz#1983086]