From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 73A2D740034 for ; Tue, 6 Feb 2024 01:23:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KLKFiDXWdf/ASZ1CV0hKLdMmWUbvLgHm6yzK1vYmB98=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707182632; v=1; b=pBCoNxIVS8ecxzuWDFKs3qHOaKmMNU4DoPbsSrRx9tpxWqpqR6QypEhGD35OaJtJgJuDB7og Z8d2rrIdBc21O3jkmnL4Kqy4W1V3EpR+ZLTRu/7P+aKg9lNKuz7GjjrTXBUa67nzopJ7U7Im+8N FcWvJiKPyiG5hrRLTiD8NOvk= X-Received: by 127.0.0.2 with SMTP id aRZVYY7687511x8XvkvVGsBE; Mon, 05 Feb 2024 17:23:52 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mx.groups.io with SMTP id smtpd.web11.11908.1707182632409214743 for ; Mon, 05 Feb 2024 17:23:52 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10975"; a="3602398" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="3602398" X-Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 17:23:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="1194572" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Feb 2024 17:23:51 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 5 Feb 2024 17:23:50 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 5 Feb 2024 17:23:50 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 5 Feb 2024 17:23:50 -0800 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 5 Feb 2024 17:23:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CURK388hjdkyuE1X4kYhNMCASD+Jtl9ZcxUoRb4xps8+JkR2GhJTivL4sFq6BEqitKTi7MPRR7YVppEF489EhpjgdKjkXbFQBR21yCMW3+oNs2BBJJVv5gqXWgJjutK0cOmusKxxraC61lnf5qPdLhlFDYTCVBKJEYPBfSPrt2jT90Z6gFYYD1PCi0+qHJbxBSGv8slMT9Lg4skJy3w2gicONZEIQdFcyeLTruJFTfslTLzpAfX4JUxsF9wBRhY90I7COACOssVaCTqNa7EitDKq5YzBLbTC0cPXzVkqEodqX1jubFPBZWxw6sVOqCZHQ0xnMuLut729WfVuOrOaDA== 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=qosPosvoknX4yf4oUmvhSvmta+d32K+D64TAicvm1aE=; b=KPjyYgBt5L39u50oqEa5xReSf6OZs8j0KdY7Y4dcKzcJ+foYSWsjh7nbUnpxpWr7PPkGR8Pc0FRJGnrVqlmYXgP0B6SH4iWqVMu4bfKXhuia2DkmIHOHjCFPFzBXiVf+2nlqHZZO6W3HImoHMZ9BTQP2YIeWFVkHsDA6dF88QVCXGljB1ZMB6Ro2A5xesOyxHzF60czMYmn6zDvoeKQzPfNWaUic0nGT1a/13B3BFlVKmYLVD3pCjKqnUdlX3BVQU0ZW6zGVwmVQH328ta4WrOyq60nl5t4JXblfTGSVgy172wAXXMxyCs4RDQIh0kD5til51zSbP1Hpy4yJ5P9zUw== 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 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by CY8PR11MB7083.namprd11.prod.outlook.com (2603:10b6:930:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Tue, 6 Feb 2024 01:23:45 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f4e6:157c:2058:8b1d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f4e6:157c:2058:8b1d%4]) with mapi id 15.20.7249.032; Tue, 6 Feb 2024 01:23:45 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [edk2-devel] [PATCH 3/3] UefiCpuPkg/PiSmmCpuDxeSmm:Map SMRAM in 4K page granularity Thread-Topic: [PATCH 3/3] UefiCpuPkg/PiSmmCpuDxeSmm:Map SMRAM in 4K page granularity Thread-Index: AQHaWDxakS9i46qSHUSXvSBLq9L40rD8hSGA Date: Tue, 6 Feb 2024 01:23:45 +0000 Message-ID: References: <20240205140345.1437-1-dun.tan@intel.com> <20240205140345.1437-4-dun.tan@intel.com> In-Reply-To: <20240205140345.1437-4-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|CY8PR11MB7083:EE_ x-ms-office365-filtering-correlation-id: d4141a65-d3bc-4d20-c93c-08dc26b2431a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: Tt/RKVAPuF4EIH0uvKxGezyifxGJ+ySsOzi4ZObE3mUVlzMAT7h26M1OU1TVulZvoVe3xOCCFuZS5mDDPRJIjFwkNZAm2fF4vlSpH1ckQaOw3xOa/q2ho+/bXMWGOVcoEOusm/QSHMVStzuKR9bhwa7Qj/mn0/rG61DdywyIP4wk4A6IckwgVUpiUuqet1Wd7QoCA/CGaXq+UcB2U99CaCWMbnWMmCjF70VetYY2L46XCgQAGPZ1nKpA9hnBa+NvVBZxsIsSKbXy9hwByk8V1Oo6ZoR6wbHT2Ho56MRJCPEABXQfQdClMgnd1api1+cjrKF4G29KSbq7P21m7eSHC9YdwJOOHEfjVBeCFtndDRsPjPOh0j/iwomCwRHcAyXeO5s4XcU3ZDlBQl10muP9jJjPE+US1/NdsKYtYov94ejspowOiOym6MfsBJyoYpTdzBEgnYLPxsaMeU9gi3ZeoXhdYuljTQ2pmdCXMf86T0+7LQX45789zBIlD9aK/tEVCI7mOLPki90Q5xTsF9K8skh+1mlqGO5XfSOw/J2alLFSKK5AVmCVEr0cz+FkjsUn+HcrFpaJL9KDlXsThSqEWl37s8UeItCrlOHOq+wP+07TTB52JtrL/Fb7xZyol2JU x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6dowuVwIvAn/4N7BYj9SGxtVJPoUQOomb4AtquVOAiDIKA5YFhUMS3ADaJC9?= =?us-ascii?Q?QN4n+uAcCaRqf9nq4D9jRQvjT96o053+UFpk6CwOjndrRL96L9uvIwJ0aaOI?= =?us-ascii?Q?cXgZ3oQi8lWp5aKqOyCN6Qu9bbzxE07hPq4Ix7TWqLU8VPpQrwIDTF9q/I59?= =?us-ascii?Q?2KsxKGnQp7EDqGprii7eBZEVdtKWKECd84hYUBUYOcrOhV45HjkQrHI1w9KM?= =?us-ascii?Q?jhK8+RJpXiVqLT6BUs3p4D01Ugh6Gvq9U+OQTlSeJfnmrNCGErSrQBI2lVDg?= =?us-ascii?Q?/M5RKSNQRbJiLot5kmQnaECJWT82se5dm7yLgaFDa/IIi+W8RcfXjHbpsy0j?= =?us-ascii?Q?vu+8v+VrNS4lB9b9AfzLtlIGWxVwkauBfyzXgLBLKMoXUI2MI8/jzLLcIEYF?= =?us-ascii?Q?3aLzeccnU/royyOkNCs6yeImn5IXEA0POOlD1SeqWRg4h0xpe9OO7XzPcxxE?= =?us-ascii?Q?hIticPb7BRf8UmhCEGZrNRzt/oNIyBG9YP46RniG5d7eo/caRMVoiV6mg0Ro?= =?us-ascii?Q?ud6kPmH/aPxnBUFQsJRw4iOH59o2Yf2o5dEggAkICYWpZYGpYB1oq7eo2kSV?= =?us-ascii?Q?9YfVStoV1AsiUU93WKsKghOsZ8Se+BY9qqdafZxHYNz7wP1DORP2M/WTOfQa?= =?us-ascii?Q?TKyatPOpgQdG/r1sbjmbCIaR9otmWU8gGMM39Q5oZwYpHJ6rw8CIKEBoX0cE?= =?us-ascii?Q?tW4DmXcoXpCspnShqZxGcPehoyXcP0JOf5cgdazoFsYbtnrulH7ikMygns0V?= =?us-ascii?Q?UGssF7JH/jHDHFQW8XAxtxM+4AYTc6ZsdWbn1MKAZ3wKlubklJ7ZDXBFsjjk?= =?us-ascii?Q?QLcKVI+k8urGDO/8nH8BGKgDKwz6zNvcshkEvf0+dUIN9LHcdYiLrudP8xF+?= =?us-ascii?Q?5+0ZWsnGStWCDfGSOeF3/25uT+4IphA2GPrECAzyuum1+LZEJg0fwWNon3Qi?= =?us-ascii?Q?02KSnJ0/2Im40R/FMpFL9lBGtt0FDYBCHknM143iwSqB8w9RQAOc4pM6s1uj?= =?us-ascii?Q?rrcbahVihdf0/qF3csx6sUaq1C5rafV+9nJmy51rP0Q364H0EUcQVwj/v8xq?= =?us-ascii?Q?sfAo4/c60rcQ86NHuLJlebn7pZ5DYwrsoWzLA+u+5iIngTZKDDhCms9z7A1i?= =?us-ascii?Q?yvn1mmwAUgEPnDw3mtiEaUl5aD5xHedQoem6acsXZQCWuFomdj0z5gUPzvOR?= =?us-ascii?Q?3DHfd+9ZgzsZlvwtk71cxcSHaI6HmXambVwR1VC7yYup/MXsCx7XN7576wgf?= =?us-ascii?Q?MTCMVaVJC+QRg15wvwjBLgj3V33GR6/diCYJlCExwVqNtcrJOuo1sjtq+KOU?= =?us-ascii?Q?Yp+s0F/vLnaIygp2odhg1Uy9DaQixW6vCz/9PAfgcatgc/BlA/zFE5GEFyb+?= =?us-ascii?Q?pomoOje6y+HlSp3yVF06x734LKwdaTLK/PTu8MxglR03V7zZYlJy+vTS/B1d?= =?us-ascii?Q?T5Cjg9gFYjMDLYn3QHmnjdbCl1LyDrgH7gna2uxm4LtZ5U9jLmp1xmUt35U+?= =?us-ascii?Q?e+XvkI+N7kyZa/dxcR3I31oL8ZzJfLGZt3YMxozv1h1rRkDPX1RqKQjbAZ5Q?= =?us-ascii?Q?uqrGVVq9i3yK7niPyeU=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4141a65-d3bc-4d20-c93c-08dc26b2431a X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2024 01:23:45.1361 (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: /VZKWIWW83MeV5JzDuLmOutBsvGV4QE9B+BxanznJDPqxmkft9vgyXSlj3/YkM3ox1VCqPa6zbQv2wtuMDbOew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7083 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: 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,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: XDDpTreEyUW80S9Fi8OciaQ0x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=pBCoNxIV; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") > + > + GenPageTable (&PageTable, PagingMode, 0, mCpuHotPlugData.SmrrBase); > + > + // > + // Map smram range in 4K page granularity to avoid subsequent page spl= it > when smm ready to lock. > + // If BSP are splitting the 1G/2M paging entries to 512 2M/4K paging > entries, and all APs are > + // still running in SMI at the same time, which might access the affec= ted > linear-address range > + // between the time of modification and the time of invalidation acces= s. > That will be a potential > + // problem leading exception happen. > + // > + ASSERT (mCpuHotPlugData.SmrrBase % SIZE_4KB =3D=3D 0); > + ASSERT (mCpuHotPlugData.SmrrSize % SIZE_4KB =3D=3D 0); Can you please move the above 2 assertions in front of the first call of GenPageTable() because SmrrBase is used there? With that, Reviewed-by: Ray Ni > + GenPageTable (&PageTable, SmramPagingMode, > mCpuHotPlugData.SmrrBase, mCpuHotPlugData.SmrrSize); > + > + GenPageTable (&PageTable, PagingMode, mCpuHotPlugData.SmrrBase + > mCpuHotPlugData.SmrrSize, Length - mCpuHotPlugData.SmrrBase - > mCpuHotPlugData.SmrrSize); >=20 > if (FeaturePcdGet (PcdCpuSmmStackGuard)) { > // > @@ -1698,6 +1764,7 @@ GenSmmPageTable ( > for (Index =3D 0; Index < gSmmCpuPrivate- > >SmmCoreEntryContext.NumberOfCpus; Index++) { > GuardPage =3D mSmmStackArrayBase + EFI_PAGE_SIZE + Index * > (mSmmStackSize + mSmmShadowStackSize); > Status =3D ConvertMemoryPageAttributes (PageTable, PagingMode, > GuardPage, SIZE_4KB, EFI_MEMORY_RP, TRUE, NULL); > + ASSERT (Status =3D=3D RETURN_SUCCESS); > } > } >=20 > @@ -1706,6 +1773,7 @@ GenSmmPageTable ( > // Mark [0, 4k] as non-present > // > Status =3D ConvertMemoryPageAttributes (PageTable, PagingMode, 0, > SIZE_4KB, EFI_MEMORY_RP, TRUE, NULL); > + ASSERT (Status =3D=3D RETURN_SUCCESS); > } >=20 > return (UINTN)PageTable; > -- > 2.31.1.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 (#115132): https://edk2.groups.io/g/devel/message/115132 Mute This Topic: https://groups.io/mt/104176237/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-