diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-08-23 11:55:31 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-11-25 12:22:38 +0000 |
commit | 8c8e05db24d8578cf87669e491f983fbd8357d55 (patch) | |
tree | b5568a31764597228ff450fb55f85c618ab13ffc | |
parent | 800205678fc9f4d290890de2db1e1de87759da66 (diff) | |
download | edk2-8c8e05db24d8578cf87669e491f983fbd8357d55.tar.gz |
OvmfPkg/PlatformInitLib: enable x2apic mode if needed
Enable x2apic mode in case the number of possible CPUs (including
hotplug-able CPus which are not (yet) online) is larger than 255.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | OvmfPkg/Library/PlatformInitLib/Platform.c | 6 | ||||
-rw-r--r-- | OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c index 715533b1f2..afe8b0abd6 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -30,6 +30,7 @@ #include <Library/QemuFwCfgS3Lib.h>
#include <Library/QemuFwCfgSimpleParserLib.h>
#include <Library/PciLib.h>
+#include <Library/LocalApicLib.h>
#include <Guid/SystemNvDataGuid.h>
#include <Guid/VariableFormat.h>
#include <OvmfPlatforms.h>
@@ -720,6 +721,11 @@ PlatformMaxCpuCountInitialization ( ));
ASSERT (BootCpuCount <= MaxCpuCount);
+ if (MaxCpuCount > 255) {
+ DEBUG ((DEBUG_INFO, "%a: enable x2apic mode\n", __func__));
+ SetApicMode (LOCAL_APIC_MODE_X2APIC);
+ }
+
PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber = MaxCpuCount;
PlatformInfoHob->PcdCpuBootLogicalProcessorNumber = BootCpuCount;
}
diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf index fb179e6791..c79b2ee106 100644 --- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf +++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf @@ -48,6 +48,7 @@ HobLib
QemuFwCfgLib
QemuFwCfgSimpleParserLib
+ LocalApicLib
MemEncryptSevLib
MemoryAllocationLib
MtrrLib
|