From nobody Wed May 1 00:02:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=hotmail.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521466270556587.4643996108622; Mon, 19 Mar 2018 06:31:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A4DE022603AEB; Mon, 19 Mar 2018 06:24:38 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-oln040092007106.outbound.protection.outlook.com [40.92.7.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5FB3E224DCA29 for ; Mon, 19 Mar 2018 06:24:36 -0700 (PDT) Received: from BY2NAM03FT011.eop-NAM03.prod.protection.outlook.com (10.152.84.60) by BY2NAM03HT028.eop-NAM03.prod.protection.outlook.com (10.152.85.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.18; Mon, 19 Mar 2018 13:31:04 +0000 Received: from CO2PR19MB0137.namprd19.prod.outlook.com (10.152.84.60) by BY2NAM03FT011.mail.protection.outlook.com (10.152.84.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.18 via Frontend Transport; Mon, 19 Mar 2018 13:31:04 +0000 Received: from CO2PR19MB0137.namprd19.prod.outlook.com ([10.161.82.25]) by CO2PR19MB0137.namprd19.prod.outlook.com ([10.161.82.25]) with mapi id 15.20.0588.017; Mon, 19 Mar 2018 13:31:04 +0000 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.92.7.106; helo=nam03-co1-obe.outbound.protection.outlook.com; envelope-from=vanjeff_919@hotmail.com; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JevuguutxKliMg2D68dxkH/P/hpUKAzIea0vW9HQ5h8=; b=LL5r4C6+kSOkeLM4Yp1Bnm6v4rul+zUu0MjpfsYluujliKCO+OrFT9C8/rO1Dwj/fQwExyxYRgnvmtrrP1G43055/YEzI3tp+QqS0gNr8Wpy7IyDiFu+vAkdXoIX7VZ/SSkj/IA2F2WvVQHw+M6erztSfzg0KdrWdQC8ql2nCvVBHiZup7qk4jd2RnFi9QKUl3cl57aQ+Q4xAzbbgamHNDAQcJT3GQMjt1gBc8geEVR7Xj66kittCDlAXCs3Kqy8HJd8h1Q0UiEQsRDnKUQcC79a+Cd01b3bB5+5C/IusIfpcOo/W0S2PYczkW+j3lY11bkfXs29j3hmzH4ZXDuxPg== From: Fan Jeff To: Hao Wu , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] UefiCpuPkg/MpInitLib: Disable interrupt at ExitBootServices AP Mwait Thread-Index: AQHTv0OU3favhz90bki/ALatPvJ+66PXjfsY Date: Mon, 19 Mar 2018 13:31:04 +0000 Message-ID: References: <20180319053142.25740-1-hao.a.wu@intel.com> In-Reply-To: <20180319053142.25740-1-hao.a.wu@intel.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:69455CFEC4EB2B4DB7809E9E81686ACE86813A91901B6697BCBB69D0B17EA88C; UpperCasedChecksum:FBF84ACC50AEC3E59B21D9005274A1FBEA6F5B837A43B10553D6FE7C6FEF67C8; SizeAsReceived:7362; Count:47 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [wqnC6DZHuNrOpsbfLVlgDORIJ5c0KUw3] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY2NAM03HT028; 6:x+m1+PcVk/gQckwrrBmDL7spYMhaseo5SP19eazLsR9HtPeVguCKu1Ma+Yowk5+yaeWrkum/21PMEmqmHA/5R2LklALBLUDV/wNDvOs6k5PeyAuVscPBrcLYdNptKxoA8TTrNwn3sDD9KBAp8s7Fxbv+EAdT5VBybQB9b53NeA4kK8Efl2auhqgfWtQjB+bRjKNlCXXHCn91Itjx2nou3pdOQPnGlx53KU4bSN+Vae4t3Lhog4S2Z1QVxHFCZKxgGDPJb1NA1wf+OS4mQB/qk5xl79KPix86q8G9f1U32+ObPx26EHnfuq3O/gR6pNfGdb3aGeHhEG2AQiLUYcmdn6anOnC4TYSdXQgulRONPz8=; 5:96w8iHAE7YUflhfeHyG9P/DMmYMTtvSrudvgFfwJVXlyk46fHsFsQEZpLo0hC9Pp8b7g7fOCN9+b1TMjNtnaNF3ZIdkCaIZxF1p7KbRPNitD7Loze1uOxKjoQH+BxSokcKsUYnJo2W2RUHNFcEXHRsy9+MCF5R2fcpX2g+F1OGg=; 24:+FREAwoTeLZ4m+IpxqmJ1t7wGZZvT+JZvHCOo38ddG4KuZlapzTFmNIBDI3P9YSjVJBGi9bu3kY/HXddkUlumW6wlpQpGbT2rYEjuN2CJ4Y=; 7:BKFFv/OnNryKFSBiOxgE7ei4+55C6lFbBRti9sJSXDfg8jKTUqa9oG4hA0uV8knRxegIveuIqhx2sl6aG5iLQRT7OwvsqfFnCrSx+8guTK3jfbySJRvVmn+XCk+9LcBXF1lfCkaF4m0ihqkbxBOV5htdBJ45eXHBICbSU2KF0hO+1nK9OozV3ZijsilodgaKgw0sTvUkOvGBUcBMP21vld42CwFogrqUJIXkm1w1FD+d32Oci1zORgw9ZuaB1HxD x-incomingheadercount: 47 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125374)(1603101448)(1701031045); SRVR:BY2NAM03HT028; x-ms-traffictypediagnostic: BY2NAM03HT028: x-ms-office365-filtering-correlation-id: 4672b042-bf2b-42c1-eb13-08d58d9da9ff x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:BY2NAM03HT028; BCL:0; PCL:0; RULEID:; SRVR:BY2NAM03HT028; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:BY2NAM03HT028; H:CO2PR19MB0137.namprd19.prod.outlook.com; FPR:; SPF:None; LANG:; x-microsoft-antispam-message-info: EF4qmE8OuVUN0KDPq77iKkkkq6YAHKBjkBhQWUbgNo53yssTEt0fi1b5rJIDc8U42XyEpfJ7ncquPSUfIPhTALa7DJoHLt4RWa3YqTdZL3WjtW2Q30YneBaQSKz8dbOxOWrLek5oVCcSeSAg/KpeRxkuYJPtDXwSqdNx2+IpIawgv9PPR15Gsy/2r51bhuOd spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4672b042-bf2b-42c1-eb13-08d58d9da9ff X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 13:31:04.3515 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2NAM03HT028 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] =?gb2312?b?tPC4tDogW1BBVENIXSBVZWZpQ3B1UGtnL01wSW5pdExp?= =?gb2312?b?YjogRGlzYWJsZSBpbnRlcnJ1cHQgYXQgRXhpdEJvb3RTZXJ2aWNlcyBBUCBN?= =?gb2312?b?d2FpdA==?= X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Hao Wu , Jiewen Yao , Laszlo Ersek , Star Zeng Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Thanks! Reviewed-by: Jeff Fan =E5=8F=91=E4=BB=B6=E4=BA=BA: Hao Wu =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2018=E5=B9=B43=E6=9C=8819=E6=97=A5 13= :31 =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel@lists.01.org =E6=8A=84=E9=80=81: Hao Wu; Laszlo Ersek; Jeff Fan; Ruiyu Ni; Jiewen Yao; Jian J Wan= g; Star Zeng; Eri= c Dong =E4=B8=BB=E9=A2=98: [PATCH] UefiCpuPkg/MpInitLib: Disable interrupt at Exit= BootServices AP Mwait Within function ApWakeupFunction(): When source level debugger is enabled, AP interrupts will be enabled by EnableDebugAgent(). Then the AP function will be execeuted by: Procedure (Parameter); After the AP function returns, AP interrupts will be disabled when the APs are placed in loop mode (both HltLoop and MwaiLoop). However, at ExitBootServices, ApWakeupFunction() is called with 'Procedure' equals to RelocateApLoop(). (ExitBootServices callback registered within InitMpGlobalData()) RelocateApLoop() never retuns, so it has to disable the AP interrupts by itself. However, we find that interrupts are only disabled for the HltLoop case, but not for the MwaitLoop case (within file MpFuncs.nasm). This commit adds the missing disabling of AP interrupts for MwaitLoop. Also, for X64, this commit will disable the interrupts before switching to 32-bit mode. Cc: Laszlo Ersek Cc: Jeff Fan Cc: Ruiyu Ni Cc: Jiewen Yao Cc: Jian J Wang Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 3 ++- UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Li= brary/MpInitLib/Ia32/MpFuncs.nasm index bd79be0f5e..59e88d3f8f 100644 --- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm @@ -1,5 +1,5 @@ ;-------------------------------------------------------------------------= ----- ; -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+; Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BS= D License ; which accompanies this distribution. The full text of the license may b= e found at @@ -239,6 +239,7 @@ AsmRelocateApLoopStart: cmp cl, 1 ; Check mwait-monitor support jnz HltLoop MwaitLoop: + cli mov eax, esp xor ecx, ecx xor edx, edx diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Lib= rary/MpInitLib/X64/MpFuncs.nasm index 7595988884..76f8c078ab 100644 --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm @@ -1,5 +1,5 @@ ;-------------------------------------------------------------------------= ----- ; -; Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+; Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BS= D License ; which accompanies this distribution. The full text of the license may b= e found at @@ -253,6 +253,7 @@ RendezvousFunnelProcEnd: global ASM_PFX(AsmRelocateApLoop) ASM_PFX(AsmRelocateApLoop): AsmRelocateApLoopStart: + cli ; Disable interrupt before switching to 3= 2-bit mode mov rax, [rsp + 40] ; CountTofinish lock dec dword [rax] ; (*CountTofinish)-- mov rsp, r9 @@ -288,6 +289,7 @@ PmEntry: jnz HltLoop mov ebx, edx ; Save C-State to ebx MwaitLoop: + cli mov eax, esp ; Set Monitor Address xor ecx, ecx ; ecx =3D 0 xor edx, edx ; edx =3D 0 -- 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel