From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.4569.1685677049964962558 for ; Thu, 01 Jun 2023 20:37:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=UcMS0el1; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685677050; x=1717213050; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=6qdXv6lnofT/A9HcmduDUJxmWruzc6L7uuZiHzfu/0g=; b=UcMS0el190NjKK8Iv6kXmnp9lpHFopuiBeedbJVMWTWFh2LX71j3PJWQ QOVMQFU0+bIXKSV3OcKbXhyxZJ/CF1r1AQMAKPwOa9LPkyfplhHAITlRK OAeqahnYGK6DQslUzmsvEf17MX+voBrlm04oIXqCwtlLNmedkoPQhNMY5 6O/HncJkTrtxFMUTTWHmlG3EnO7ED1YujqH4nO17/Pr/lF3hi8zyWeNLL aJvaOgx4FQg5cV6r9tVTa+PeXcq+mQ6K3u9vU9hnjKNP3TOEJYAEUPo7h K/zHrbed7BMh6Rs6AbrwS1e49V680gN1s0DoXrM+5MSW2kSWYn8YnppyL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="340382084" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="340382084" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 20:37:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="658068590" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="658068590" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP; 01 Jun 2023 20:37:29 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 20:37:29 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 20:37:28 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.23 via Frontend Transport; Thu, 1 Jun 2023 20:37:28 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) 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.23; Thu, 1 Jun 2023 20:37:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PfDdUORXf1PPhQqGlh5514XIaTCyUjwoaDvE0KBT0+o78ziK1ntpNmMo1pJOB8Dc2ZqrTT1lO3Dfos4ep75ZFA4buexhmMfc6pKFTF3vOveg/yGTMFy+NqBpFEBdXQm6hq47jIaIpXgXkCZwE1rCKiRajly1ONDAkTZWtngiVEeeIXNJF8BDoEsBoWh82PhwOU4nEwHi9uhsPAtCA8VsnEHYUZ7IDPiL8NfnZktVhwtiC74LPol+Sni2OuFhiRLcWR/mpU6d+ZvjgNqURjOJXFsCuLf0ckXK8+Tz4kHnLZ5qZIpadfa+vm/PJKZLyswpJEMONySJSJ584Fv3YPvpTQ== 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=Ay9cbUM+zetrh4zn8WCQrrN1LtwA3aj4utedoTFrmos=; b=gpksCr5Z9BkG2SIa6JUSSACoWInSENg55CpGS3TXLwJDnqtu0zyAgZuMWOlHeCaF5A3xlKEoQIFiwKQB+89V7oH57wIM2usMYtPcKldPpj7r98TkudNA4yod5IjlUz1j/r+73cGurODIBnNzDV0LIO1JEbo8USpkeiJ3PhSvOwbB1bfgFcnLJoPeS+VkzFs0CNjxj5qHwLSmTkbynn2+wSqgUvhymWWCIziS7bfoOCt6UGT0g5oyV2Zh1eIhG6SrBhmLwPNSuNHep0rptRcuuxF6Oxsnsnmfnc5Z7car0JGKdT9hs/Nggpo5isX59xiisjc26d1jmBB4UsHCeYdapw== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by IA1PR11MB7679.namprd11.prod.outlook.com (2603:10b6:208:3f1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Fri, 2 Jun 2023 03:37:27 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3023:34d3:bd4e:7901]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3023:34d3:bd4e:7901%3]) with mapi id 15.20.6455.024; Fri, 2 Jun 2023 03:37:27 +0000 From: "duntan" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [edk2-devel] [Patch V4 11/15] UefiCpuPkg: Use GenSmmPageTable() to create Smm S3 page table Thread-Topic: [edk2-devel] [Patch V4 11/15] UefiCpuPkg: Use GenSmmPageTable() to create Smm S3 page table Thread-Index: AQHZlQK3fdctzvxeuke+yLaYUdb7tq923Mew Date: Fri, 2 Jun 2023 03:37:27 +0000 Message-ID: References: <20230516095932.1525-1-dun.tan@intel.com> <20230516095932.1525-12-dun.tan@intel.com> 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: BN9PR11MB5483:EE_|IA1PR11MB7679:EE_ x-ms-office365-filtering-correlation-id: d9fdc474-0465-46bf-7ddd-08db631aafba x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7lnkz4e2fnqisMxoXhjHMqreCC5EEc25CL8k/K85HEHWn7ctpc1Xdn4cINbjahX1SVzqKzzwgYjKyATMAleGGIo1ZS6nWdoozmk4vJirCkz2ZyigxwEllzrU3MFdoZiApDBDKazu1b1YpSY2ibx20CN6S+W2HD+jprJcfzVbboYpNWI+jNQlR+Jcpk398h4dcTBZxdhWjZG5jLM+IKBYjTgfVDkrPfFDdCHsx2BFUayJ8hGN2iV8Pkd87JhDD/Ej00gCelaHFJ0BLDGtO2zLHKdBvlNzjmw4RCQyDcC3hfWzpyyWCUqSkDHASGvoOiwfHMKeJtrnaAFjD7PTFuDNFw6CQk3qca95zSbX89hxaiDlCZ0PffHrpxb2GtJLVtsRJ2DU9JfDLk+cVoAsYFn6wUZcrO8CDYyBFSA4vS4sqgyF5K+KzivrMydgCsN9Op3AOys2ZzKz13nkzp8C0DH7uZzTOtedzYNfBsrNvaawOwULTyf4stbnrpF1yaIgK0WWYTDM78sm+9+G/XQfoG/+Znh+VoLrpLtThiZDy+ZiIk7NywG3fk/3lKCk9pAgblSR/CB9oQasAAkGa3x25PEdLPJLVsSAUiC86eQTQIIrUY0aIf557zmIQG6L6wcFsoRH x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(136003)(346002)(366004)(396003)(376002)(451199021)(86362001)(33656002)(82960400001)(122000001)(38100700002)(38070700005)(478600001)(71200400001)(110136005)(54906003)(66476007)(7696005)(8936002)(5660300002)(64756008)(66446008)(2906002)(52536014)(66946007)(66556008)(316002)(76116006)(41300700001)(4326008)(8676002)(6506007)(53546011)(55016003)(186003)(83380400001)(9686003)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?EjmVrBoz4n0QrwW23JJjfIiiMaw8NkKSA/CCVLNdWapa+KZZql9WWe80PynD?= =?us-ascii?Q?x6OkmaCJ8/QzwDKDsHEa8YhlqbeLnQJiiGJAsYCRB4F7VfSjHwlDU0Mbn+z2?= =?us-ascii?Q?ddErrnwF+Np7eebj7MyyZ7E7uHsEmESEfSJHVIVswkMGkrjHWAlYbqjCcXk5?= =?us-ascii?Q?xSLQ4U1Szgm1HZnQ8SDrBbFmbEQiHNfiJfGgro9qA4TO6ZJfKmB7c+nHJ5i8?= =?us-ascii?Q?mcrKHrd8Myhmf1O1ULN2M7y1P1Xlsr7rsTYjvzR5DuDlQ8CQnrGtXKetFau9?= =?us-ascii?Q?+SWYftPc4lTwub6dy5nlH+6u7BSAXJJ6+BbzZ7+mIe6qjrpSpfQbolW3Uw4z?= =?us-ascii?Q?x4eIpIn8YnQ/aX8KVy3ANdGhqY8ZucpgmK9ht0qENIUUxfeXE//X1Y9XoO1D?= =?us-ascii?Q?Qyc4q5O5Zy2FY/XSWpKwhRFfHn5f+oZ5lfg5t2u7v9SLwjoQg2F7fCC20UO/?= =?us-ascii?Q?RYD7Bfmj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1E7FUbR?= =?us-ascii?Q?NM4CrF0XdI3jQZPuN8SAODl7sPfM/rpGBvs5ZA8VYsyuxA0vv4USRst7vcE+?= =?us-ascii?Q?8xDLT2/rzsh0fbfgclZxQMgXiaQsR2nkls6+Vi14xW1KQyPCBf02bbDtXmP5?= =?us-ascii?Q?Tbx9NnI/ENRfuqsEjFIECQMALUiZ4mcYwXtv0AI3llxc2SZKwqs70y7lzxjg?= =?us-ascii?Q?zvgUw+ib1uan7/WajqI=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9fdc474-0465-46bf-7ddd-08db631aafba X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2023 03:37:27.1580 (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: BjlfNU6IBPGpUpOB7THH8g/M5ZSZd3Cblwe7VocaK4821D+pTjWsSKdHGiHmcX/peQlZw0PyvKTv8v2i7X6/mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7679 Return-Path: dun.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sure, it's to align with the old behavior. Will add comments to explain it. Thanks, Dun -----Original Message----- From: Ni, Ray =20 Sent: Friday, June 2, 2023 11:31 AM To: devel@edk2.groups.io; Tan, Dun Cc: Dong, Eric ; Kumar, Rahul R ; Gerd Hoffmann Subject: RE: [edk2-devel] [Patch V4 11/15] UefiCpuPkg: Use GenSmmPageTable(= ) to create Smm S3 page table > - mSmmS3ResumeState->SmmS3Cr3 =3D (UINT32)(UINTN)PTEntry; > + mSmmS3ResumeState->SmmS3Cr3 =3D (UINT32)GenSmmPageTable > (Paging4Level, 32); Why is "Paging4Level" used for S3 page table? The S3 page table is used by S3Resume module: if (SmmS3ResumeState->Signature =3D=3D SMM_S3_RESUME_SMM_64) { // // Switch to long mode to complete resume. // ...... AsmWriteCr3 ((UINTN)SmmS3ResumeState->SmmS3Cr3); ...... AsmEnablePaging64 ( 0x38, SmmS3ResumeState->SmmS3ResumeEntryPoint, (UINT64)(UINTN)AcpiS3Context, 0, SmmS3ResumeState->SmmS3StackBase + SmmS3ResumeState->SmmS3StackSize ); The S3 page table is only used when PEI runs in 32bit mode, which revolves = my concern that CPU in 64bit mode cannot switch from 5-l paging to 4-l pagi= ng. And I guess your code just aligns to the old behavior. Can you add comments to above to explain the SmmS3Cr3 is only used by S3Res= ume PEIM to switch CPU from 32bit to 64bit? With that, Reviewed-by: Ray Ni