summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-11-04 15:45:13 +0800
committerJeff Fan <jeff.fan@intel.com>2016-11-09 16:01:13 +0800
commit14e8137c8223f6d78135af6180b5e3145351da17 (patch)
tree09abc02974c1b509c4853c25de31bd2a345afd37
parentb028c1021cdfbfaa0202711f2a008c801752917f (diff)
downloaddevice_linaro_bootloader_edk2-14e8137c8223f6d78135af6180b5e3145351da17.tar.gz
device_linaro_bootloader_edk2-14e8137c8223f6d78135af6180b5e3145351da17.tar.bz2
device_linaro_bootloader_edk2-14e8137c8223f6d78135af6180b5e3145351da17.zip
UefiCpuPkg/MpInitLib: Do not wakeup AP if only one processor supported
If MaxLogicalProcessorNumber is only 1, we needn't to wake up APs at all and needn't to register callback functions. It could improve boot performance on single supported system. https://bugzilla.tianocore.org/show_bug.cgi?id=204 Cc: Feng Tian <feng.tian@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/DxeMpLib.c7
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c39
-rw-r--r--UefiCpuPkg/Library/MpInitLib/PeiMpLib.c8
3 files changed, 37 insertions, 17 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index b399f1c24..eb36d6f78 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -290,6 +290,13 @@ InitMpGlobalData (
SaveCpuMpData (CpuMpData);
+ if (CpuMpData->CpuCount == 1) {
+ //
+ // If only BSP exists, return
+ //
+ return;
+ }
+
//
// Avoid APs access invalid buff data which allocated by BootServices,
// so we will allocate reserved data for AP loop code.
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 56b870e52..a0edc55f5 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1143,6 +1143,7 @@ MpInitLibInitialize (
} else {
MaxLogicalProcessorNumber = OldCpuMpData->CpuCount;
}
+ ASSERT (MaxLogicalProcessorNumber != 0);
AsmGetAddressMap (&AddressMap);
ApResetVectorSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
@@ -1209,10 +1210,12 @@ MpInitLibInitialize (
MtrrGetAllMtrrs (&CpuMpData->MtrrTable);
if (OldCpuMpData == NULL) {
- //
- // Wakeup all APs and calculate the processor count in system
- //
- CollectProcessorCount (CpuMpData);
+ if (MaxLogicalProcessorNumber > 1) {
+ //
+ // Wakeup all APs and calculate the processor count in system
+ //
+ CollectProcessorCount (CpuMpData);
+ }
} else {
//
// APs have been wakeup before, just get the CPU Information
@@ -1238,19 +1241,21 @@ MpInitLibInitialize (
sizeof (CPU_VOLATILE_REGISTERS)
);
}
- //
- // Wakeup APs to do some AP initialize sync
- //
- WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData);
- //
- // Wait for all APs finished initialization
- //
- while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
- CpuPause ();
- }
- CpuMpData->InitFlag = ApInitDone;
- for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
- SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);
+ if (MaxLogicalProcessorNumber > 1) {
+ //
+ // Wakeup APs to do some AP initialize sync
+ //
+ WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData);
+ //
+ // Wait for all APs finished initialization
+ //
+ while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
+ CpuPause ();
+ }
+ CpuMpData->InitFlag = ApInitDone;
+ for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
+ SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);
+ }
}
}
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index e242d37b3..1f2fcb8b1 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -321,6 +321,14 @@ InitMpGlobalData (
EFI_STATUS Status;
SaveCpuMpData (CpuMpData);
+
+ if (CpuMpData->CpuCount == 1) {
+ //
+ // If only BSP exists, return
+ //
+ return;
+ }
+
//
// Register an event for EndOfPei
//