From: "Dong, Eric" <eric.dong@intel.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
Chandana Kumar <chandana.c.kumar@intel.com>
Subject: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.
Date: Wed, 22 Apr 2020 09:34:55 +0800 [thread overview]
Message-ID: <20200422013456.1053-2-eric.dong@intel.com> (raw)
In-Reply-To: <20200422013456.1053-1-eric.dong@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
This patch used to fix a ASSERT because AP can't find the CpuMpData.
When AP been waked up through Init-Sipi-Sipi, the IDT should
been restore to preallcated buffer to make it can get the
CpuMpData through IDT base address.
Not when CpuMpData->InitFlag is ApInitReconfig or ApInitConfig,
AP will be wake up through Init-Sipi-Sipi. Current code already
has logic to handle ApInitConfig, but miss the handler for
ApInitReconfig. This patch fixes this gap.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 64a4c3546e..ac7f92fd48 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -664,8 +664,9 @@ ApWakeupFunction (
BistData = *(UINT32 *) ((UINTN) ApTopOfStack - sizeof (UINTN));
//
// CpuMpData->CpuData[0].VolatileRegisters is initialized based on BSP environment,
- // to initialize AP in InitConfig path.
- // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a different IDT shared by all APs.
+ // to initialize AP in InitConfig/ApInitReconfig path.
+ // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a
+ // different IDT shared by all APs.
//
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
InitializeApData (CpuMpData, ProcessorNumber, BistData, ApTopOfStack);
@@ -673,6 +674,16 @@ ApWakeupFunction (
InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
} else {
+ if ((CpuMpData->InitFlag == ApInitReconfig) && (CpuMpData->ApLoopMode != ApInHltLoop)) {
+ //
+ // CpuMpData->CpuData[0].VolatileRegisters is initialized based on BSP environment,
+ // to initialize AP in InitConfig/ApInitReconfig path.
+ // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a
+ // different IDT shared by all APs.
+ //
+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
+ }
+
//
// Execute AP function if AP is ready
//
--
2.23.0.windows.1
next prev parent reply other threads:[~2020-04-22 1:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 1:34 [PATCH 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure Dong, Eric
2020-04-22 1:34 ` Dong, Eric [this message]
2020-04-22 7:54 ` [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs Ni, Ray
2020-04-22 8:22 ` Dong, Eric
2020-04-22 11:26 ` Ni, Ray
[not found] ` <160816A4F32AAED9.20374@groups.io>
2020-04-22 9:00 ` [edk2-devel] " Dong, Eric
2020-04-22 1:34 ` [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI Dong, Eric
2020-04-22 8:00 ` [edk2-devel] " Ni, Ray
-- strict thread matches above, loose matches on Subject: below --
2020-04-22 8:52 [PATCH v2 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure Dong, Eric
2020-04-22 8:52 ` [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs Dong, Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422013456.1053-2-eric.dong@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox