From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.2872.1587546075137554060 for ; Wed, 22 Apr 2020 02:01:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: eric.dong@intel.com) IronPort-SDR: llLatmGTFdSYZkD31vNm3OAGr6/Y6kuOmRHnl4BcCfucSuwR0CviDKcGypiG7FlVTgCr77A5GZ FvYYXRAwKcdQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 02:01:14 -0700 IronPort-SDR: eW+OBeMZuQgG8LSQsrHRA16sxSgEgZt1noSIoNkvjTyaI5fog1UIaKvZ8xYA+nzHy94QbIkSxQ Uj2CDLO36Mkw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,413,1580803200"; d="scan'208";a="402476152" Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by orsmga004.jf.intel.com with ESMTP; 22 Apr 2020 02:01:12 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar Subject: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs. Date: Wed, 22 Apr 2020 17:01:10 +0800 Message-Id: <20200422090111.423-1-eric.dong@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683 This patch fixes an assertion because AP can't find the CpuMpData. When AP is waken up through Init-Sipi-Sipi, AP's IDT should be restored to pre-allocated buffer so AP can get the CpuMpData through the IDT base address. Current code already has logic to handle this when CpuMpData-> InitFlag is ApInitConfig but misses the logic when CpuMpData->InitFlag is ApInitReconfig. This patch fixes this gap. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Signed-off-by: Eric Dong ---=0D V2:=0D 1. Enhance code comments.=0D UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 64a4c3546e..2e87aa1f06 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -692,6 +692,16 @@ ApWakeupFunction ( //=0D RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].Vol= atileRegisters, TRUE);=0D } else {=0D + if (CpuMpData->InitFlag =3D=3D ApInitReconfig) {=0D + //=0D + // Initialize AP volatile registers in ApInitReconfig path.=0D + // ApInitReconfig happens when:=0D + // 1. AP is re-enabled after it's disabled, in either PEI or DXE= phase.=0D + // 2. AP is initialized in DXE phase.=0D + //=0D + RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegiste= rs, FALSE);=0D + }=0D +=0D //=0D // The CPU driver might not flush TLB for APs on spot after updati= ng=0D // page attributes. AP in mwait loop mode needs to take care of it= when=0D --=20 2.23.0.windows.1