From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.68690.1670920862601721539 for ; Tue, 13 Dec 2022 00:41:02 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=XtAkYCZz; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: star.zeng@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670920862; x=1702456862; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=msBG26IWTou/6H1P3EliSA90wCu/4F6gw5YBIwAoR/4=; b=XtAkYCZzRbr0gKWOyXnFHUW76RzrLXsO5xLIaZr8CaGfRFbKPlMvsUBI uW7BarmT4HE+cQXjUb9Kn4Blt7Tb6CFjywVOxflxh1nIUIHtuD7Wo4Pet NvJVEvDsOWkqErhIwscUHNgpKcQHHSKn3wPA6Fjf43W/iMnYUOKp8ntdG NkFOZ9eSvVszAv9gvhFXCsCLGoWW75Y3G8IG6ic04EqF43b0FnWhlaT7h Np1z6zdBzn4TIIIG1dh8Qt+ZCoLIcVQYGJtmkk5V4OnsDWPdjsM/4xoYG LFKtwjpRd0Wy2h2s7/bVVlA2hppe1o60GdxCe3kW4bnOw/HXZVXQPZUPS Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10559"; a="319934523" X-IronPort-AV: E=Sophos;i="5.96,240,1665471600"; d="scan'208";a="319934523" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2022 00:40:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10559"; a="717158042" X-IronPort-AV: E=Sophos;i="5.96,240,1665471600"; d="scan'208";a="717158042" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga004.fm.intel.com with ESMTP; 13 Dec 2022 00:40:49 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 13 Dec 2022 00:40:49 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 13 Dec 2022 00:40:49 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 13 Dec 2022 00:40:49 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Tue, 13 Dec 2022 00:40:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eo6P5C2yYUB0mHGPAajBO3LlrqcQbHWbVQt5z+jpPcryQcVuWWoj/8nnKy9I3+EemnXus+9nsy4GckX/lLF+pfgg8afL3WbUMRdq7iAatx1w6d1S4GdP6LM9z1Se/gjtEMpNeC1w8HNlqiOTzFH+rWFpgomI28H/amTVROGWceGAh90eAEnYYgdlxIIITj1cHDjNna03PPVU9eG8ax+MJ+ZuF6g5RRbWHI/7GrLvuBqVJPOpxtxWdWu1wmDsXrxtDVUARwWrzprQ9Urco4/BDLt1D+A0bbdllFJkoRkVTsEQGez7B2DJeDH4amjMqjhm7j9EZcRcipu20HNM73rq2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lwjL7BYGrAZhgy9oT4179pwDAz59TL2tB1kaK/NztQ4=; b=OeBkPUX9IJqq52rt63B4HKyQMf0NIWNPwR+XaUip1dmtobXvU6aJE6WMc30pmunERMGbCZvAfwPr5wpDOlUuaHnH6aFnK+7yZb/5QuS1VAqPEf631ScvmKelgayt7kSJJ2J2dhipOXH9fNrqE1Y1Fux1gox7QC4Fn0QJ/YoQXNvSll2GWXqdm7iavaVPfRQ9gfv4wi0mZbxDRZ/x0FNbUiJ805IX8/yuPe2pugNdEsPL01txCeONwkXHUtlaPkjzeS4uNvKI0ZdHRWnoqCH3+l8UXbt0APTSPsw3hxh+2mm+Zsy6r/m7awLtLdOqau7Y1aZNUxVBk8cqXSKSXKWOFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM8PR11MB5623.namprd11.prod.outlook.com (2603:10b6:8:25::20) by SJ0PR11MB5616.namprd11.prod.outlook.com (2603:10b6:a03:3aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Tue, 13 Dec 2022 08:40:46 +0000 Received: from DM8PR11MB5623.namprd11.prod.outlook.com ([fe80::36e3:3e93:1ac7:ac3d]) by DM8PR11MB5623.namprd11.prod.outlook.com ([fe80::36e3:3e93:1ac7:ac3d%8]) with mapi id 15.20.5880.019; Tue, 13 Dec 2022 08:40:45 +0000 From: "Zeng, Star" To: "devel@edk2.groups.io" , "Wu, Jiaxin" , "Ni, Ray" , "Guenzel, Robert" CC: "Zeng, Star" Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Bug fix in 5LPage handling Thread-Topic: [edk2-devel] [PATCH] UefiCpuPkg: Bug fix in 5LPage handling Thread-Index: Adj1CvpW46tAdlIWQQ+9dW0j49U6vQES0p3wAr+ld9ACnmhssA== Date: Tue, 13 Dec 2022 08:40:45 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8PR11MB5623:EE_|SJ0PR11MB5616:EE_ x-ms-office365-filtering-correlation-id: d18d403a-2c48-4c9d-aa55-08dadce5ba6a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JYW5i/N3MPrpU0gujOwGvfbscBD+XKbtdTmwucA9aLF+Mw5Prh8i0Kaof6q/aMXWWxnvQAigyuJMU0WM+W9Hl/Z/wK+YCNfQF81OYtUs1W2uAinjEAHdkP+xwhBITRjrbXsIVnSlbZ75YngDTGhcpfc3H/LAJSo/Aj/YmmUSWR9y0J4DociVAjDEhpzGhzwapccMqy5wAwhe8yAEvN8pt+hs3uloLXT4QmhwZ4eSkPIQKuhDsGf2jvETeGYdYLMMMeYVydMoC8PApbXxEOgsCu+yiCW7RiMbcI88iCl9VCRj45oe80w+1xWhoJSJfqOGafN6J2ZAjSpuBtSsql1610ISjEmI6hQEun1U/smK/UKbGz0l5JxT8KhJM2D2kmnL3k6+AAlKkknS+wjM0Fnfj9xWBndYSY3AsUWz5hKtcjE1CIsv4ySyLtisSLFglfdrNA5LTlSOHlgckTbRDruoZAECPVZalHGfGrAXc8lsr80w2RkcdTq79CJgTyqjeOYPj6v6mguS6cCQvTJd7L/cwZtSdzzHn33iOO4OUrNufuAppOt1jn3QcfcmNAc+AtHOaG+yLLjEA8mSGSIpO4ymAmUsS3g4UDiKQPnuGGel+Ib0ClL5FqaH31Feb3mEu2uOozttS4aueTKXG4hH4E2V8mtipB7XEgNfaHjdYgL7F9eRnvt99wX2n2knVG7hIymBMOVaf0XFsgpYDls5p5socS9Oc8pUCFqMcUszALUXfWdZLK7m8+V6/feBP8+zLgTjOyDVr+cnYAkxXPbUhEns/A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR11MB5623.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(122000001)(38100700002)(82960400001)(966005)(41300700001)(38070700005)(55016003)(86362001)(478600001)(52536014)(8936002)(107886003)(71200400001)(4326008)(186003)(66946007)(8676002)(66556008)(6636002)(64756008)(19627235002)(110136005)(76116006)(83380400001)(2906002)(7696005)(26005)(316002)(6506007)(9686003)(66476007)(53546011)(5660300002)(66899015)(66446008)(15974865002)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?loEo/Tc+NBGSt3NrdlX94TAuXR0D2osSyE/xYpPAg0pV8++WXYH1sv+RYLCc?= =?us-ascii?Q?fqWVxs24+reNG8BKYcCtPfMw9u7zri9ZpQp50PQVxBbJX2kj9hrSbv/ik2O9?= =?us-ascii?Q?+mFdsPvVm9Ev2y9GckfVW/ITIyfUhF1lNqVf32uLy057h/05FzN6eG0Sn5YP?= =?us-ascii?Q?UZx2fTqX/w6aF6HL5UIM6mKE3avGWsr4TSDq1pMB51aQc1AcklzALf64DopK?= =?us-ascii?Q?Flxcc4sQXY9u7E0lY+lskIi1h8dVv+IA5MrwMHY/lJKQ7aPGsZNrita9nmQB?= =?us-ascii?Q?5CNUHYBzpYKF38Jp6krwkxsKI5NJF8itYhKFqi+3itbHFwjUHHGD6HMWh5kG?= =?us-ascii?Q?t4c8wCrlUsRlUaDX3IWunUa8uDzcISa5IbCqj9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H4Y/O/tj8gOzeaEy01Ct6PHE4yeZAcfyXsgAzBczT8I49Ifz?= =?us-ascii?Q?ffqb7TOh5txGqbv57i21LnZEFga9NyrLk7FGUXQbwBG7hTqGIOF3u0jChF7y?= =?us-ascii?Q?1mQJyEREX/xGMQ5SlzN+5TDq65RY5RKTIPtKR3nJvBC/fQaE1WIMgfv61p/9?= =?us-ascii?Q?S+z52Fegx6eMphrzwYp5B2EN8sAerlQ95Cj5y9uhiy2cG0i+xlspGrBBc1II?= =?us-ascii?Q?soUvYB13oAEpZvj20fcdnUHNLJp499zdp7/Yusj6AgmRDsg1rbgdhoNwHWv4?= =?us-ascii?Q?01ChmWFNZeoBVwLm/yB3+Zq3GAiQ4EeeuAfNzXQL?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5623.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d18d403a-2c48-4c9d-aa55-08dadce5ba6a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2022 08:40:45.9208 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fMkwUETElWvfP6gYcE/CZc9lBcg5Qja6VJWphmgZpx4MouhSZJ7aQaeC1TuNgDGH2RlFEM+IRoV6kZoHMk7GEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5616 Return-Path: star.zeng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, When could the patch be merged ? Thanks, Star -----Original Message----- From: devel@edk2.groups.io On Behalf Of Wu, Jiaxin Sent: Wednesday, November 30, 2022 8:47 AM To: devel@edk2.groups.io; Ni, Ray ; Guenzel, Robert Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Bug fix in 5LPage handling Glad to see this fix, could you add/include the existing Bugzilla in the co= mment? REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4168 Thanks, Jiaxin > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Wednesday, November 16, 2022 8:57 AM > To: devel@edk2.groups.io; Guenzel, Robert > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Bug fix in 5LPage=20 > handling >=20 > Reviewed-by: Ray Ni >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of > Guenzel, Robert > > Sent: Thursday, November 10, 2022 9:51 PM > > To: devel@edk2.groups.io > > Subject: [edk2-devel] [PATCH] UefiCpuPkg: Bug fix in 5LPage handling > > > > When build in DEBUG, the code asserts that 5LPage support is there=20 > > when the physical address width is larger than 48. > > In a RELEASE build it will just force LA57 to 1 in CR4 even if=20 > > CPUID(7).ECX[16] says it is not supported. > > > > The hang (in the ASSERT) in DEBUG is not warranted as there are=20 > > legal configurations with CPUID(7).ECX[16](=3D=3DLA57)=3D0 and with a= =20 > > physical address width of larger than 48 (like 52). > > > > This is also supported by this code: > > > https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/PiSmmCpuDx > eSmm/X64/PageTbl.c#L221 > > There (as long as physical address width is smaller or equal to 52)=20 > > any address width above 48 will be reduced to 48 and the system can=20 > > and will work without 5LPaging. > > > > The forced setting of LA57 in CR4 (in the absence of LA57 in=20 > > CPUID(7).ECX) is a spec violation and should not happen. > > > > Hence the proposed fix > > a) removes the assert. > > b) only returns TRUE from Is5LevelPagingNeeded if 5LPaging is actually > > supported by HW. > > > > Signed-off-by: Robert Guenzel mailto:robert.guenzel@intel.com > > --- > > UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > > index 6587212f4e..f8b1ac31f1 100644 > > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c > > @@ -104,8 +104,8 @@ Is5LevelPagingNeeded ( > > ExtFeatureEcx.Bits.FiveLevelPage > > )); > > > > - if (VirPhyAddressSize.Bits.PhysicalAddressBits > 4 * 9 + 12) { > > - ASSERT (ExtFeatureEcx.Bits.FiveLevelPage =3D=3D 1); > > + if ((VirPhyAddressSize.Bits.PhysicalAddressBits > 4 * 9 + 12) && > > + (ExtFeatureEcx.Bits.FiveLevelPage =3D=3D 1)) { > > return TRUE; > > } else { > > return FALSE; > > -- > > 2.34.1 > > Intel Deutschland GmbH > > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany > > Tel: +49 89 99 8853-0, www.intel.de Managing=20 > > Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva=20 > > Chairperson of the Supervisory Board: Nicole Lau Registered Office:=20 > > Munich Commercial Register: Amtsgericht Muenchen HRB 186928 > > > > > > > > > > >=20 >=20 >=20 >=20 >=20