From 8d932822ced0c946de9db46406fc9c1f86f96147 Mon Sep 17 00:00:00 2001 From: Jon Maloy Date: Fri, 4 Aug 2023 21:39:28 +0000 Subject: [PATCH] * Fri Aug 04 2023 Jon Maloy - 20220126gitbb1bba3d77-6 - edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch [bz#2150267] - Resolves: bz#2150267 (ovmf must consider max cpu count not boot cpu count for apic mode [rhel-8]) --- ...nitLib-fix-apic-mode-for-cpu-hotplug.patch | 49 +++++++++++++++++++ edk2.spec | 9 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch diff --git a/edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch b/edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch new file mode 100644 index 0000000..2739061 --- /dev/null +++ b/edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch @@ -0,0 +1,49 @@ +From c32f4994552ea5835cf00ce06f2f7d88c71249e5 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Tue, 28 Feb 2023 15:47:00 +0100 +Subject: [PATCH] UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug + +RH-Author: Miroslav Rezanina +RH-MergeRequest: 29: UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug +RH-Bugzilla: 2150267 +RH-Acked-by: Oliver Steffen +RH-Acked-by: Jon Maloy +RH-Commit: [1/1] e7e332ac0e6edf207b1b9692f2e1aed4a1fe7c0c + +In case the number of CPUs can in increase beyond 255 +due to CPU hotplug choose x2apic mode. + +Signed-off-by: Gerd Hoffmann +--- + UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c +index b9a06747ed..177d15ab5b 100644 +--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c ++++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c +@@ -495,7 +495,9 @@ CollectProcessorCount ( + // + // Enable x2APIC mode if + // 1. Number of CPU is greater than 255; or +- // 2. There are any logical processors reporting an Initial APIC ID of 255 or greater. ++ // 2. The platform exposed the exact *boot* CPU count to us in advance, and ++ // more than 255 logical processors are possible later, with hotplug; or ++ // 3. There are any logical processors reporting an Initial APIC ID of 255 or greater. + // + X2Apic = FALSE; + if (CpuMpData->CpuCount > 255) { +@@ -503,6 +505,10 @@ CollectProcessorCount ( + // If there are more than 255 processor found, force to enable X2APIC + // + X2Apic = TRUE; ++ } else if ((PcdGet32 (PcdCpuBootLogicalProcessorNumber) > 0) && ++ (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 255)) ++ { ++ X2Apic = TRUE; + } else { + CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob; + for (Index = 0; Index < CpuMpData->CpuCount; Index++) { +-- +2.37.3 + diff --git a/edk2.spec b/edk2.spec index f352853..5e6bf7b 100644 --- a/edk2.spec +++ b/edk2.spec @@ -7,7 +7,7 @@ ExclusiveArch: x86_64 aarch64 Name: edk2 Version: %{GITDATE}git%{GITCOMMIT} -Release: 5%{?dist} +Release: 6%{?dist} Summary: UEFI firmware for 64-bit virtual machines Group: Applications/Emulators License: BSD-2-Clause-Patent and OpenSSL and MIT @@ -58,6 +58,8 @@ Patch27: edk2-OvmfPkg-AmdSev-SecretPei-Mark-SEV-launch-secret-area.patch Patch28: edk2-rh-openssl-add-crypto-bn-rsa_sup_mul.c-to-file-list.patch # For bz#1861743 - CVE-2019-14560 edk2: Function GetEfiGlobalVariable2() return value not checked in DxeImageVerificationHandler() [rhel-8] Patch29: edk2-SecurityPkg-DxeImageVerificationLib-Check-result-of-.patch +# For bz#2150267 - ovmf must consider max cpu count not boot cpu count for apic mode [rhel-8] +Patch30: edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch # python3-devel and libuuid-devel are required for building tools. @@ -502,6 +504,11 @@ true %endif %changelog +* Fri Aug 04 2023 Jon Maloy - 20220126gitbb1bba3d77-6 +- edk2-UefiCpuPkg-MpInitLib-fix-apic-mode-for-cpu-hotplug.patch [bz#2150267] +- Resolves: bz#2150267 + (ovmf must consider max cpu count not boot cpu count for apic mode [rhel-8]) + * Thu Apr 06 2023 Miroslav Rezanina - 20220126gitbb1bba3d77-5 - edk2-SecurityPkg-DxeImageVerificationLib-Check-result-of-.patch [bz#1861743] - Resolves: bz#1861743