From nobody Tue Apr 30 10:12:26 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 Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516613769768645.7932018855671; Mon, 22 Jan 2018 01:36:09 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 929AF222CF1A3; Mon, 22 Jan 2018 01:30:42 -0800 (PST) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-oln040092003011.outbound.protection.outlook.com [40.92.3.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DF61B21D2BEF7 for ; Mon, 22 Jan 2018 01:30:40 -0800 (PST) Received: from BL2NAM02FT063.eop-nam02.prod.protection.outlook.com (10.152.76.57) by BL2NAM02HT108.eop-nam02.prod.protection.outlook.com (10.152.77.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.428.12; Mon, 22 Jan 2018 09:36:04 +0000 Received: from CO2PR19MB0137.namprd19.prod.outlook.com (10.152.76.52) by BL2NAM02FT063.mail.protection.outlook.com (10.152.77.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.428.12 via Frontend Transport; Mon, 22 Jan 2018 09:36: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.0428.019; Mon, 22 Jan 2018 09:36: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.3.11; helo=nam02-bl2-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=eeVJngljr8iIY4Ahyssf1x1Tbqh0HzJzCZjrV+qvjvc=; b=MRPGE4fwiHpHSJegxQVvvSzrI3C003ZghOpF8Y2ZIuJ4qT8CQCjgbkZVtlxRj+RIipry8E280XVxWpDkXMpvq5BUltwvZfyC+QpBrlJqSOcXctGUMyWUD/M6DW4rIc0zyTF2pepawIVE03RloCFZYW0vH3WYeHt+M7BEyICJ/iocil3sQlfrv3IXLRnMvyEJtbgY48mM6xttcWTHmNHeEIfU+2bhIwqUCt9omg5D5Jnz9PXgGpahIVspORMKxjRn6x12hUZwHN8cWZMgFgMl0tSLRj39rcKbwjvDVhgbY65GPq3lvgJlQL4VZIO3G3RgxbwqEy9i2UeE+sJFb7Z9eg== From: Fan Jeff To: Ruiyu Ni , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] UefiCpuPkg/PeiMpLib: Fix a system hang-in-pei issue. Thread-Index: AQHTk2HGf1xpTre3BkyoYhJINImoOaN/oas5 Date: Mon, 22 Jan 2018 09:36:04 +0000 Message-ID: References: <20180122091659.283656-1-ruiyu.ni@intel.com> In-Reply-To: <20180122091659.283656-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:870EE6E883360C412CB0D79363B8A54D508420F435E912D7E6497A8328C49ED1; UpperCasedChecksum:F387461EFC9F43385CCC72BC9C003BA1560A1CCAABDA7A56C538FE386C58A8A5; SizeAsReceived:7167; Count:47 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [WgiKPozfduI/yajKPcfCG52dUDKacBdV] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BL2NAM02HT108; 6:Bfdt160xKMo7CRUhMt3SPjHmkELkaPijhc6GepGzYKpohTF/MM3HS1iR7herLGiSoZJ4pluD24Bw2CcyBY/EO9f9Q+CL5sFW4WDwaRwr9lT+AfucRvFlAsQ9bdieht8fDibIwhP6Vf4XS6DC+J9XAnikZSbN0oFT7u8zHGf/g5JpRPpfdUKaML7x/TxXtXoKnki4KmdKuJuHRxLgAO66GWKZZw12t15DrQkyftd6jCD86en0C0DyTjrdMYRc5yQD9vYNtOfBRQWum0pEzOXFUcsL+v9NmVhYk49qC8Di0XTuUTUWJk7m/vJPKXIq1PpDeJ1zKWtLvo3mXOdlUJEM4Yt0ld6jzPGevXH9bSmjjus=; 5:DtbQnKfds7y5XYLj8JwVIbWmEzh//7v9ywJUSlM8XYiwCY32zl2LgnFuqLHZ2rKwgKWuFn3DSEnKjchAFvFbpJmdp+TPM3B699XTgXGVto7i63PNKcgGjEZQoWrHr6iiufP4Vlt62L+I7lWDDQjhjjc/QvLy9Ee2QG4j9Enanw0=; 24:VHTjH6dhGBakb2e83LAxlH/J2f7Hts6IfwsgIyPE7oWhFvHkTbWNBVRbPSnvcQfQhonueEZlBA5AVZPMi+qin+EcO2LLIpABDW+Y9TIRlAE=; 7:IphopJP3WGOMZoj1GX1OPQ3WPdwpILlGyuzhC1R2Pf76+r7g6EVn1Howz9EU/1QgOg4HO09AlzdqY4CfFTOK2w1DeAX3OT4owYVoOgigBfaWk67Mc3zwQOY6F+l1WUgCQYfZ9T+TSlR+Tr0VGHTDKZ1U1veb5UjIJ7usaOkEbvoWt/iwHoGhN/t1kt1hFSDMb77PxSjhOCVWi7gIevR3xN4l99P2XLbQpYViVVHjyIJ4tDqRbTz78IQnKI0Ys3bC x-incomingheadercount: 47 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125374)(1701031045); SRVR:BL2NAM02HT108; x-ms-traffictypediagnostic: BL2NAM02HT108: x-ms-office365-filtering-correlation-id: e1617d69-7e23-4af3-d754-08d5617b8eba x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:BL2NAM02HT108; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BL2NAM02HT108; x-forefront-prvs: 0560A2214D x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:BL2NAM02HT108; H:CO2PR19MB0137.namprd19.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1617d69-7e23-4af3-d754-08d5617b8eba X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2018 09:36:04.5493 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT108 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] =?gb2312?b?tPC4tDogIFtQQVRDSF0gVWVmaUNwdVBrZy9QZWlNcExp?= =?gb2312?b?YjogRml4IGEgc3lzdGVtIGhhbmctaW4tcGVpIGlzc3VlLg==?= 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: Eric Dong , 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" Reviewed-by: Jeff Fan =E5=8F=91=E4=BB=B6=E4=BA=BA: Ruiyu Ni =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2018=E5=B9=B41=E6=9C=8822=E6=97=A5 17= :17 =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel@lists.01.org =E6=8A=84=E9=80=81: Eric Dong; Star Zeng =E4=B8=BB=E9=A2=98: [edk2] [PATCH] UefiCpuPkg/PeiMpLib: Fix a system hang-i= n-pei issue. When HOB contains a system memory resource which is above 4GB, the (UINTN) typecast truncates the high-32 bits. It causes a memory range above 4GB be used by CpuMpPei code as the waking up buffer. The patch fixes this issue by using UINT64 type. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Eric Dong Cc: Star Zeng --- UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/M= pInitLib/PeiMpLib.c index ad43bd33f5..791ae9db6e 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -1,7 +1,7 @@ /** @file MP initialize support functions for PEI phase. - Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 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 @@ -75,15 +75,15 @@ SaveCpuMpData ( **/ BOOLEAN CheckOverlapWithAllocatedBuffer ( - IN UINTN WakeupBufferStart, - IN UINTN WakeupBufferEnd + IN UINT64 WakeupBufferStart, + IN UINT64 WakeupBufferEnd ) { EFI_PEI_HOB_POINTERS Hob; EFI_HOB_MEMORY_ALLOCATION *MemoryHob; BOOLEAN Overlapped; - UINTN MemoryStart; - UINTN MemoryEnd; + UINT64 MemoryStart; + UINT64 MemoryEnd; Overlapped =3D FALSE; // @@ -96,9 +96,8 @@ CheckOverlapWithAllocatedBuffer ( while (!END_OF_HOB_LIST (Hob)) { if (Hob.Header->HobType =3D=3D EFI_HOB_TYPE_MEMORY_ALLOCATION) { MemoryHob =3D Hob.MemoryAllocation; - MemoryStart =3D (UINTN) MemoryHob->AllocDescriptor.MemoryBaseAddress; - MemoryEnd =3D (UINTN) (MemoryHob->AllocDescriptor.MemoryBaseAddres= s + - MemoryHob->AllocDescriptor.MemoryLength); + MemoryStart =3D MemoryHob->AllocDescriptor.MemoryBaseAddress; + MemoryEnd =3D MemoryHob->AllocDescriptor.MemoryBaseAddress + Memor= yHob->AllocDescriptor.MemoryLength; if (!((WakeupBufferStart >=3D MemoryEnd) || (WakeupBufferEnd <=3D Me= moryStart))) { Overlapped =3D TRUE; break; @@ -123,8 +122,8 @@ GetWakeupBuffer ( ) { EFI_PEI_HOB_POINTERS Hob; - UINTN WakeupBufferStart; - UINTN WakeupBufferEnd; + UINT64 WakeupBufferStart; + UINT64 WakeupBufferEnd; WakeupBufferSize =3D (WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1); @@ -149,7 +148,7 @@ GetWakeupBuffer ( // // Need memory under 1MB to be collected here // - WakeupBufferEnd =3D (UINTN) (Hob.ResourceDescriptor->PhysicalStart= + Hob.ResourceDescriptor->ResourceLength); + WakeupBufferEnd =3D Hob.ResourceDescriptor->PhysicalStart + Hob.Re= sourceDescriptor->ResourceLength; if (WakeupBufferEnd > BASE_1MB) { // // Wakeup buffer should be under 1MB @@ -174,7 +173,7 @@ GetWakeupBuffer ( } DEBUG ((DEBUG_INFO, "WakeupBufferStart =3D %x, WakeupBufferSize = =3D %x\n", WakeupBufferStart, WakeupBufferSize)); - return WakeupBufferStart; + return (UINTN)WakeupBufferStart; } } } -- 2.15.1.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel