From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.15424.1671431872723754903 for ; Sun, 18 Dec 2022 22:37:53 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=AQcurxbv; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671431872; x=1702967872; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=cpqVbFlzPiaZlQYMsi9OWNbx4pT6Hrw37wI6AVDv/vo=; b=AQcurxbvGHNGneYIPU7nY22nh54zMbyDXOol41OVC02qu6JwQAY5yLY6 je4k7VjWT9q0gYZloVkrHPwp1vY2Yzlt0ZbjwxP+cwcIZkLY4edB1UVL0 G/pTvOQVf+57RNjIOBrCZaS53B08jfYbI8SBhhwvXT/8Y+AFVqFVJh5Um EhnDYmR643EsIZ4J7pykNX4rgJ5nzkeW39rwqUf3cQXk017vEoJvvD4z4 mjCz2byXjnDLi3E3zmJOkFg9qDSLIBkaxig+m3gMeGwejljf4aGSMKgnJ APhARteb9dbspuVixjXrLsK7p6jXiZ6BA0WYExLoBlt9i8mFLxD0etqxF A==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="316917357" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="316917357" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2022 22:37:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="628203686" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="628203686" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga006.jf.intel.com with ESMTP; 18 Dec 2022 22:37:41 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 18 Dec 2022 22:37:41 -0800 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.16 via Frontend Transport; Sun, 18 Dec 2022 22:37:41 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) 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.16; Sun, 18 Dec 2022 22:37:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fbNXKVTxhCv0cjtsYmyqZSzYh2j+6cNz0mJw3bjt0vCxQAIMH0qHhcp2Rzne5vuNVah77SpT0avrIvv3cpKXbB+OH+Dcg2bR/akCOhSLuyCELd23FZgJvDNWTCnM8to5vlgt7cxI+ungsicgKb+VOu4hTtL4fch4YHQKhzaJBu9XrIIX0pXyW+xaP+Cqj3sPDEqXiri0//1Cen5awO7ubGX4/sqDOhz2UBtlmaJo7csBI0LJXf9IP96ViSxRYUhOaQ8QmNkOWO8P4wMMvxOJYs2aYIu9rCLTtaAC504R4FuT5/uCSXBpPGB/oOyn5nbLTbtT7h0MewTm3eCjRNQQVw== 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=z/zdEQYsfCs0FUZgR1Kh7H3KeUZiraPpGDR3IAvKIDA=; b=hdpZwqLtZPVdbk4nrHIpqKmp5Szq+pRMzauQaKEELx7doPc4lefAqxTNXEWBCSMly1EY39lpvcA4qJa/UxJR5WZ0MiSXw6N0gryxmEZkB05eUmQ4X1LnwFG6agq4DZWPSWOO8alkUyQjueCdP3KkSbjhUuo4TVDMdsqjHAbcUwX9Ox7sjn9UesXlqPjwze2JeZJ/v6HN1hoBwVzpb7Bc97f7+jHQqsV1Uzd9nEGazx1q3OkhK6Npy5TUeeC3Cfey3BwKhuYvIQHHRxPjQnzypbLC67v9WAT4v9D4fpVLlxPkTI5yu1lAUoqcAm9JUrCy+3QB+33YgOSe9czGYzMGSA== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by SA1PR11MB5825.namprd11.prod.outlook.com (2603:10b6:806:234::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 06:37:32 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::994e:d3c4:7608:3405]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::994e:d3c4:7608:3405%4]) with mapi id 15.20.5924.016; Mon, 19 Dec 2022 06:37:31 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [PATCH 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: Introduce page table pool mechanism Thread-Topic: [PATCH 1/3] UefiCpuPkg/PiSmmCpuDxeSmm: Introduce page table pool mechanism Thread-Index: AQHZEPqz3NjmhK5uOUqaJ+sOWI8JEq50xlVQ Date: Mon, 19 Dec 2022 06:37:31 +0000 Message-ID: References: <20221216030059.1373-1-dun.tan@intel.com> <20221216030059.1373-2-dun.tan@intel.com> In-Reply-To: <20221216030059.1373-2-dun.tan@intel.com> Accept-Language: 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: MWHPR11MB1631:EE_|SA1PR11MB5825:EE_ x-ms-office365-filtering-correlation-id: e747dc01-c681-4734-b340-08dae18b81b7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XFREmmnI6dSTlcxHhi6OQUSeyrxj0lqCA1qCTtH1G58zAuuXsR8tTaAnFAS16wPht/IZShmcqW/E8Y1k39u6YnJtA5FlysMKE6RfYWLYB+ia4AHREmyRx/k/yeSf/h7t5jQP8e49Kq65ve4LIGZJvqLJkw0UK4oJaj1kUnOT9lxsfoq2RV49mjsclK/WAQMsYw1t7cVznLguLMZEmyMKI92yKxIjtrfuv268kNkXJnJQ0b93OenSycB/Kefc53naHviCvZqekLBjb0KVCA04LZFaOrVDSb6cdqnt79Vd+DX3/OrcinSOBu6NAFiqR+9FZBwt7DjwtG5ohuJfE+ypqAtqYH4uTjdqmMVjLD0som/5GEC6DCNsboQBv/1KV2tH1iZFwULA1UmAcTZRtThS+CNfPbLWtTt28fochNIgz0cQcFMWARgTtvWKWszzSRuEzcnUqkchLc50AfcmJPJvObiuAQIQQHLZCNK/ff0WC3x7bbvhDb29cP4RDH1sNSe6d9Q3Hf4LbJvttlwjy4ExVyyB0mcUVQEtQuiwRaie/YVHVGjwEl78UDm+Foa0N5PUgp4GmFsbUa8sPvKfabJ/ULUuUqeIqZa4KyCX+7RA7hKGTLjd/2vHjTkTu/yqZQB7hdsXLN/xwE+AYFVFxf7e6nQpyRddyE/NmCpTjWTCtRt49CJrdZ/nwRRjJkDPzHk26T4bUAPAcYJDikCgmbKbAQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(6029001)(39860400002)(136003)(376002)(396003)(346002)(366004)(451199015)(2906002)(41300700001)(86362001)(8936002)(52536014)(76116006)(64756008)(66446008)(5660300002)(66946007)(33656002)(66476007)(4326008)(4744005)(8676002)(66556008)(110136005)(316002)(54906003)(38070700005)(71200400001)(38100700002)(122000001)(478600001)(26005)(9686003)(83380400001)(6506007)(55016003)(7696005)(107886003)(186003)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Alu7ND8BVTM/C/jHldH5mnqy0fSY1f/AItjZ9Vq7hK5KUM81HyaBrZJoIZCj?= =?us-ascii?Q?UEU9uhbnXGx7dLoZ0mOf6vGvKnas87XU9KAZ1Mt+AqbO0DaJiDtVWaEQXeYx?= =?us-ascii?Q?rEgH4S1w9tvJQ/HsIJOdS0fS+KE8flTOYdzEu+OUHqzYQkFm5AEn/BTjLSGl?= =?us-ascii?Q?XhgU0gKO4Pq71zbHmUPd7cpLOdWhioGPTMLxdOweW6nXfvixg+uRRZtYh2JX?= =?us-ascii?Q?SxFnzDXPJejNTHTgsRya4H/MPwoy26WoQmYBF4Wj/7bO8qIc3o5R0bN2pta9?= =?us-ascii?Q?bV+dGUlpqXHKQ90aSIZAGM6FTwxFHusAqRzd/Gj2ApuOJLiI74M84o3fBw+a?= =?us-ascii?Q?VoDjqdWYWXiHwoVKPnHZ0RzoqTOUzYLLy2OuKr2tnMwi75LvcVo8K66OhW6e?= =?us-ascii?Q?1707dVyarXd0VCqTHe12lSnhvDlh72qotlHSRlaTgUqarWEZCGhhBAtdTTv3?= =?us-ascii?Q?EkWKFGu9HCqI60zjx+LxIK8NoP//B8tzAyOf9Jdtt9AQ/qlykfc0hpvNOWF5?= =?us-ascii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EMV?= =?us-ascii?Q?5yGBROwyLbu7R3ZLqnL3jv2PI/qX3AQN5u4QJQ2lAFbMd88ApB7FVK2GidKQ?= =?us-ascii?Q?150o66oY2dUwPwveA0k2vgY9LHNVTVlaxeNq8X4w5DSXlpOTvIjObsqJV3Q0?= =?us-ascii?Q?ljOkC08YGUz5iki3Uoc=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e747dc01-c681-4734-b340-08dae18b81b7 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2022 06:37:31.9193 (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: Pog5psIS8ohhrBfuKGFoxn2ZncwjoiZFvJflDY0TEUs5RzIJz7OFhGJpeqSVazoEH9ejwnfNmkCeKM4QQojucA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB5825 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > + // > + // If page table memory has been marked as RO, mark the new pool pages= as read-only. > + // > + if (mIsReadOnlyPageTable) { > + AsmWriteCr0 (AsmReadCr0 () & ~CR0_WP); > + SmmSetMemoryAttributes ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, EFI_PAG= ES_TO_SIZE (PoolPages), > EFI_MEMORY_RO); > + AsmWriteCr0 (AsmReadCr0 () | CR0_WP); > + } > + If you check other logic that clears WP bit in CR0, CET is disabled before = clearing WP. You need to follow the same pattern here. Other looks good to me.