2023-09-05 10:53:16 +00:00
|
|
|
From eb24212304ec31c3ae8b878a21d4b875d5942cd1 Mon Sep 17 00:00:00 2001
|
2023-06-01 05:26:54 +00:00
|
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
Date: Tue, 28 Feb 2023 15:47:00 +0100
|
2023-09-05 10:53:16 +00:00
|
|
|
Subject: [PATCH 13/14] UefiCpuPkg/MpInitLib: fix apic mode for cpu hotplug
|
2023-06-01 05:26:54 +00:00
|
|
|
|
|
|
|
In case the number of CPUs can in increase beyond 255
|
|
|
|
due to CPU hotplug choose x2apic mode.
|
|
|
|
|
|
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
---
|
|
|
|
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
|
2023-09-05 10:53:16 +00:00
|
|
|
index 6f1456cfe168..9277e06c9b4a 100644
|
2023-06-01 05:26:54 +00:00
|
|
|
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
|
|
|
|
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
|
2023-09-05 10:53:16 +00:00
|
|
|
@@ -527,7 +527,9 @@ CollectProcessorCount (
|
2023-06-01 05:26:54 +00:00
|
|
|
//
|
|
|
|
// 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) {
|
2023-09-05 10:53:16 +00:00
|
|
|
@@ -535,6 +537,10 @@ CollectProcessorCount (
|
2023-06-01 05:26:54 +00:00
|
|
|
// 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++) {
|
|
|
|
--
|
2023-09-05 10:53:16 +00:00
|
|
|
2.41.0
|
2023-06-01 05:26:54 +00:00
|
|
|
|