From nobody Sun Feb 8 12:39:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57773+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57773+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1587519302; cv=none; d=zohomail.com; s=zohoarc; b=PtLnoVKzHV8wLThG8McG3Zm59hYQCiBk9EwVdd8TIeDy/VJPdVKl3Atr8Ui04QUdDUg/qk0MT5n6m61JL3O8UC91Z4Cgq6Svktd3NYXVEZ4/d8X0mEs7ioGqTYMQ3OH7stBABUSjRuuJsocCTmZOdNzBOCJdCHKGUSTu1DmQa0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587519302; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=YA4DPs+ORacXYLPGvTv7w5zt/L8J9OH8T4etX67+Ga8=; b=MMhDJ8ikPop7LuUI943Rqn0H9EwAMmhJSrDbxmhYWm241OL6LYz/OFyqaerESJQFNLvPrkHHPWeGfd0UZeya7AMTS0JZtrXti/rEFmttAukghownOhjP5WPsntd4e+G72y6FTwbsBvVWmIu787WlNg87bw1MKyFOLBiFwphVsJI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57773+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587519302492122.87992369366225; Tue, 21 Apr 2020 18:35:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0YLfYY1788612x5uciGQVxkp; Tue, 21 Apr 2020 18:35:02 -0700 X-Received: from mga03.intel.com (mga03.intel.com []) by mx.groups.io with SMTP id smtpd.web10.3030.1587519300506659025 for ; Tue, 21 Apr 2020 18:35:01 -0700 IronPort-SDR: X7PrRVrteLmgmbMrS6YZqiZVugKvsxO8IjTEv2Y5znNtoGcxMFslsWNuS51XMBhK1recoZuokf 5ranP0ElBsrA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2020 18:35:01 -0700 IronPort-SDR: 9JBAcNGeWZ63Dfa49Wa5bOBe7KPhyKDV2VoxuZ8OdUjXP5XD113u1SlrcEkhSfyt5CtBPIkXZt HKPXqg9su6aw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,412,1580803200"; d="scan'208";a="429730940" X-Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by orsmga005.jf.intel.com with ESMTP; 21 Apr 2020 18:34:59 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar Subject: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs. Date: Wed, 22 Apr 2020 09:34:55 +0800 Message-Id: <20200422013456.1053-2-eric.dong@intel.com> In-Reply-To: <20200422013456.1053-1-eric.dong@intel.com> References: <20200422013456.1053-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com X-Gm-Message-State: xPn6DDQqxzxtT68r3dZg9XB2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587519302; bh=rAK7o+V07bbUUP6v1LQRMORWIFPFzPQLu69zJmv4Nqc=; h=Cc:Date:From:Reply-To:Subject:To; b=YSVCknw6lX+6mDjxilGNP7WOscQRS/QY7w6t69nLtkKt2LZR4xKufcymVHsK18f0izB kQsDIBn94ALQnUH5MMLeaXq4kSMFiL6wNMW4yI8f/8TlNiNk4/3CtbEjNzR6ybwr+UkOK 3y7IpzPk41rufmt9ji2NkZ4HhsLRMnhZthU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683 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 Cc: Laszlo Ersek Cc: Chandana Kumar Signed-off-by: Eric Dong --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 64a4c3546e..ac7f92fd48 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -664,8 +664,9 @@ ApWakeupFunction ( BistData =3D *(UINT32 *) ((UINTN) ApTopOfStack - sizeof (UINTN)); // // CpuMpData->CpuData[0].VolatileRegisters is initialized based on B= SP 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 ( =20 InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumA= psExecuting); } else { + if ((CpuMpData->InitFlag =3D=3D ApInitReconfig) && (CpuMpData->ApLoo= pMode !=3D 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].VolatileRegiste= rs points to a + // different IDT shared by all APs. + // + RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters= , FALSE); + } + // // Execute AP function if AP is ready // --=20 2.23.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57773): https://edk2.groups.io/g/devel/message/57773 Mute This Topic: https://groups.io/mt/73187416/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-