From 867bc965bc874dcc3aaeefa9fadb26811a0ec7b6 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Mon, 16 Jan 2023 10:47:12 -0500 Subject: [PATCH] * 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] - Resolves: bz#2158173 ([aarch64][numa] Failed to create 2 numa nodes in some hardwares) - Resolves: bz#1983086 (Assertion failure when creating 1024 VCPU VM: [...]UefiCpuPkg/CpuMpPei/CpuBist.c(186): !EFI_ERROR (Status)) --- ...anium-leftover-data-structure-RH-onl.patch | 97 +++++++++++++++++++ ...lashDxe-map-flash-memory-as-uncachea.patch | 67 +++++++++++++ edk2.spec | 14 ++- 3 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch create mode 100644 edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch diff --git a/edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch b/edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch new file mode 100644 index 0000000..d4df4b3 --- /dev/null +++ b/edk2-MdePkg-Remove-Itanium-leftover-data-structure-RH-onl.patch @@ -0,0 +1,97 @@ +From 0517c19dff1e3fd8e16a38533d39e4b9bd32f54e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= +Date: Tue, 15 Nov 2022 01:02:51 +0100 +Subject: [PATCH 2/2] MdePkg: Remove Itanium leftover data structure (RH only) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Pawel Polawski +RH-MergeRequest: 22: MdePkg: Remove Itanium leftover data structure (RH only) +RH-Bugzilla: 1983086 +RH-Acked-by: Gerd Hoffmann +RH-Acked-by: Oliver Steffen +RH-Commit: [1/1] d7f46e0657016668a3c00309ed1d95aea7c55c97 + +Itanium support has been removed from EDK2 aroun 2019. +ITANIUM_HANDOFF_STATUS data structure looks to be +some leftover from that process. + +There is also positive sidefect of this data structure removal. +Due to HOB allocation type used in PEI stage there is a limit +how much data about virtual CPU can be hold. This limit result +in only 1024 vCPU can be used by VM. +With Itanium related data structure removed more allocated space +can be used for vCPU data and with current allocation limit +will change from 1024 to around 8k vCPUs. + +Signed-off-by: Paweł Poławski +--- + MdePkg/Include/Ppi/SecPlatformInformation.h | 44 --------------------- + 1 file changed, 44 deletions(-) + +diff --git a/MdePkg/Include/Ppi/SecPlatformInformation.h b/MdePkg/Include/Ppi/SecPlatformInformation.h +index 02b0711f18..fbcd205acd 100644 +--- a/MdePkg/Include/Ppi/SecPlatformInformation.h ++++ b/MdePkg/Include/Ppi/SecPlatformInformation.h +@@ -84,49 +84,6 @@ typedef union { + + typedef EFI_HEALTH_FLAGS X64_HANDOFF_STATUS; + typedef EFI_HEALTH_FLAGS IA32_HANDOFF_STATUS; +-/// +-/// The hand-off status structure for Itanium architecture. +-/// +-typedef struct { +- /// +- /// SALE_ENTRY state : 3 = Recovery_Check +- /// and 0 = RESET or Normal_Boot phase. +- /// +- UINT8 BootPhase; +- /// +- /// Firmware status on entry to SALE. +- /// +- UINT8 FWStatus; +- UINT16 Reserved1; +- UINT32 Reserved2; +- /// +- /// Geographically significant unique processor ID assigned by PAL. +- /// +- UINT16 ProcId; +- UINT16 Reserved3; +- UINT8 IdMask; +- UINT8 EidMask; +- UINT16 Reserved4; +- /// +- /// Address to make PAL calls. +- /// +- UINT64 PalCallAddress; +- /// +- /// If the entry state is RECOVERY_CHECK, this contains the PAL_RESET +- /// return address, and if entry state is RESET, this contains +- /// address for PAL_authentication call. +- /// +- UINT64 PalSpecialAddress; +- /// +- /// GR35 from PALE_EXIT state. +- /// +- UINT64 SelfTestStatus; +- /// +- /// GR37 from PALE_EXIT state. +- /// +- UINT64 SelfTestControl; +- UINT64 MemoryBufferRequired; +-} ITANIUM_HANDOFF_STATUS; + + /// + /// EFI_SEC_PLATFORM_INFORMATION_RECORD. +@@ -134,7 +91,6 @@ typedef struct { + typedef union { + IA32_HANDOFF_STATUS IA32HealthFlags; + X64_HANDOFF_STATUS x64HealthFlags; +- ITANIUM_HANDOFF_STATUS ItaniumHealthFlags; + } EFI_SEC_PLATFORM_INFORMATION_RECORD; + + /** +-- +2.31.1 + diff --git a/edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch b/edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch new file mode 100644 index 0000000..5d776d6 --- /dev/null +++ b/edk2-OvmfPkg-VirtNorFlashDxe-map-flash-memory-as-uncachea.patch @@ -0,0 +1,67 @@ +From a7e155d9d0be18b9db31dd7135e9da2bc955e6b4 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 11 Jan 2023 19:00:23 +0100 +Subject: [PATCH 1/2] OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable + +RH-Author: Gerd Hoffmann +RH-MergeRequest: 21: OvmfPkg/VirtNorFlashDxe: map flash memory as uncacheable +RH-Bugzilla: 2158173 +RH-Acked-by: Miroslav Rezanina +RH-Acked-by: Oliver Steffen +RH-Commit: [1/1] 819cd72096fa9f253eef7b532122183b608c0064 (kraxel/centos-edk2) + +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 +Reviewed-by: Ard Biesheuvel +(cherry picked from commit e5ec3ba409b5baa9cf429cc25fdf3c8d1b8dcef0) +--- + 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 ff3121af2a..f9a41f6aab 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.31.1 + diff --git a/edk2.spec b/edk2.spec index f23c654..4097437 100644 --- a/edk2.spec +++ b/edk2.spec @@ -16,7 +16,7 @@ ExclusiveArch: x86_64 aarch64 Name: edk2 Version: %{GITDATE}git%{GITCOMMIT} -Release: 2%{?dist} +Release: 3%{?dist} Summary: UEFI firmware for 64-bit virtual machines License: BSD-2-Clause-Patent and OpenSSL and MIT URL: http://www.tianocore.org @@ -71,6 +71,10 @@ Patch0026: 0026-ArmVirtPkg-Remove-LinuxInitrdDynamicShellCommand-RHE.patch Patch0028: 0028-Revert-ArmVirtPkg-make-EFI_LOADER_DATA-non-executabl.patch Patch0032: 0032-Revert-OvmfPkg-PlatformDxe-Handle-all-requests-in-Ex.patch Patch0033: 0033-OvmfPkg-SmbiosPlatformDxe-use-PcdFirmware.patch +# For bz#2158173 - [aarch64][numa] Failed to create 2 numa nodes in some hardwares +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 # python3-devel and libuuid-devel are required for building tools. @@ -375,6 +379,14 @@ install -m 0644 \ %changelog +* 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] +- Resolves: bz#2158173 + ([aarch64][numa] Failed to create 2 numa nodes in some hardwares) +- Resolves: bz#1983086 + (Assertion failure when creating 1024 VCPU VM: [...]UefiCpuPkg/CpuMpPei/CpuBist.c(186): !EFI_ERROR (Status)) + * Thu Jan 05 2023 Miroslav Rezanina - 20221207gitfff6d81270b5-2 - edk2-use-rpm-build-flags-rh-only.patch [RHEL-177] - Resolves: RHEL-177