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.web10.39323.1681294668272869404 for ; Wed, 12 Apr 2023 03:17:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=VodOPxkN; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1681294668; x=1712830668; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=/4h0YgO9wtLwiwiKUbdc/1SThaihLUJAX+NIRqH24Nc=; b=VodOPxkNAmOoYG/byVYZUgql6dFP/5vBgtc/z2HZ0lOdXpaeWbCly2Is TYJjKuh9uZfPviS6jiTKzDO2tn9U1WIKdExqkDTmtlRziwOuc4INMs+Ix ep2u0BK5mPO7xTOiBONpnat09qKHEh6w+D2Z49Cawzhadc/sjTGagz6HO T2zTxsQWjVO86m4kWsKnb8xAVn9/1QSSt4KDtXm97QZCzyuMnsijShdsy 8Ms+0iQG3lHH/wc7KLkx4ahYt90Cohb5vyOmL0VPoyZmrUmIxBcdC8ATe u1mL2fGJmxmYwqPsN+GfL5ydkB+Owzl5O1AVueeq//mke4vdwpPe244Uf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="341345589" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="341345589" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 03:17:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="688911708" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="688911708" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga002.jf.intel.com with ESMTP; 12 Apr 2023 03:17:47 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 12 Apr 2023 03:17:47 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 12 Apr 2023 03:17:47 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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; Wed, 12 Apr 2023 03:17:47 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 12 Apr 2023 03:17:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hjUrQ2ndc2f83WJgwD7OpR9/WxV83++N3rUQaOHAZX4I/9kfD55YJHdImSt4hp81gfcpz67BVEsbHArr1TBeipXOZesms1WmqagVebfoEkeSk9gS//n5KWRaMTu4w78jIGSLm1Z9cGTXaQdCFp0pOU06hIeNgKpy2+blgM+Ek9rk40Llg8uD5mBzOJZL6Nwe3WZyUbH/kOGBzrbCYg5qcVRiUb8ost4yI0jYqneZ+yzDJItlryAfdvNmim0BiJfAwgPm1ODHRrmW1S4ml91vAJmNx/p3h4xKIVz0QFD52CZwZyBvBb4pZXj7mKD0sovu37TbSWFlbmgbho9EwcVI2g== 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=kdOf/tXJZxzokfm1AEQGSgcU7mPju7Nh4Wi35kWvMBw=; b=ZvCW6a0Ecz6YGoL1rhCPMbf+ZhDg255PpuNi6ftnLZNUB+4BipwFPy96t49/cQLVCgm3pF8/4YthwYmH4t3b90HbZEA14XUt87PDA2gVM3U/dmwIJBXq9ZwChOi3NrChQSVYKYRu3aA/9vIqFlwitqv7L4N3d2m76EhwKYpFuAJ8wu57iGjc29VttmrqZk00zm+Dg/7EWlzlaaEk5o3Q22//JtBbZOvRlEAtHXBSWdmmFY1V4aTXNV7x+GwkzO2Vxe75YNSO9Ie/LZpJkzCOzuRGinlCW1NW2uEf1ULKAv7ZLe+dK70xjsdu4gIGQV42eLUTzhgNVbmzkTRpxM/GYw== 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 CY8PR11MB7340.namprd11.prod.outlook.com (2603:10b6:930:84::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Wed, 12 Apr 2023 10:17:44 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::1eb1:2222:1823:8e7a]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::1eb1:2222:1823:8e7a%6]) with mapi id 15.20.6277.038; Wed, 12 Apr 2023 10:17:44 +0000 From: "duntan" To: "devel@edk2.groups.io" , Tom Lendacky Subject: Re: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and update smm page table Thread-Topic: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and update smm page table Thread-Index: AQHZbRyoGhev/k0Lh0ak5MT8foi7/q8nX/cg Date: Wed, 12 Apr 2023 10:17:44 +0000 Message-ID: References: <1755241E6695EAE7.1885@groups.io> In-Reply-To: <1755241E6695EAE7.1885@groups.io> 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_|CY8PR11MB7340:EE_ x-ms-office365-filtering-correlation-id: 39d9412f-6713-4cb9-ee4b-08db3b3f2819 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Iz+G56w8Vg59LE7SgNil5/sY+CCkcZzWBJmsBlfG4AUQK+72M6HX85EEwRpJp1ehutKycLM9Cg+rLhXxEzR9fTyj8kbPgJl/hBpVGhXh87edarcK/Ul70EfcmOSOw3nskhsmyKRzhulty5wXSD02Cpc9QgjDIlh/WHxthLk6P2ZAeP8Sc4aSY0L0OZkNWhm1UNJ4Cr4qlkefdAaDse/80QwysPFsDllI/wKHEFmzeZNWr5e52HbqOIYyH1WvtpnpDXaqQUukz4PgCbHGht2rW7GUG3vb/XeJ/fw2Dik4mvrkPforbFyax1dX7iRH1c5nIyzAXylLvsX2Am4UVUJa9Rd2jrJeyYLtB6NAy4gPIrY9kcnO56AE+CYGoPErnOaIISDlEUgQBkGISyRfglEVDGUIcRMVorC4bySAzsIBPRrxwELYkg9x8B3ySstUkP4KVGGeJjl5eGmjPdflMAeP7ggqncLS3wpYDo87LLwdM9rmEkoKN/cH+Xvw84N6h9FX9SoRW34sadyhGHhCrhz/hZNniIpqJSj5NECTqRsYCdnsSCPeI1pH4Fi0fVGQVdUGrVqBhMy1biMlMenARdXcr3Hv3F2sVdCZzifPxGDxH4HGFZLsOseMX5uDlEMuDasAf+lBgBBdcO+3TTq7dQyN/A== 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)(366004)(346002)(376002)(396003)(451199021)(66899021)(71200400001)(478600001)(7696005)(52536014)(33656002)(83380400001)(55016003)(82960400001)(122000001)(38100700002)(86362001)(38070700005)(19627235002)(316002)(2906002)(6506007)(186003)(5660300002)(26005)(53546011)(966005)(110136005)(66556008)(9686003)(66446008)(41300700001)(64756008)(66476007)(8936002)(8676002)(15650500001)(66946007)(76116006);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RsZml6FF8/crZZ4bTpQo3ajsQAbiYkRGb+ww9bLOWKFjtwsGFgFqkffvG2r9?= =?us-ascii?Q?Egcvh1oBrp59cdbg1pqkGjUkxmE4eIIwGOrWZ0tO72bDqOQNkPC5t6NGMhDm?= =?us-ascii?Q?sJwiyAAJS7HtGL9LfY8jArROKjWndXfPN/ixDvIAp6Y7fhJ4oxmrsLGLS9zT?= =?us-ascii?Q?AycS4JuJYpsT0ztwUsGYmGtNm9dNFVhpyb99I1PmIrJCrgmgoNH3egsg4OKE?= =?us-ascii?Q?bBMNBsjeNdIm+vzqVq8fx0kNqzY+LHT+iu4AbTf/wr1RNhtjcGowb+Xyq7FM?= =?us-ascii?Q?ZiYmizqmg4SHg8TNZ3bV9opSYyBkrXTN/T8roRKNkU4OLg+kfVd8+VZw9KkB?= =?us-ascii?Q?Vlnr5umKo98nhRmoIg14umlBUo56PFTzqCg186clrpVuFIx8yyJ/lBaYlMna?= =?us-ascii?Q?SD1PA2vuzMzCoAhKziB2bpVJt+hyhT2l0jkhXASbR69/a52WW7O7K4eXGhxo?= =?us-ascii?Q?/oboR5NwdVUO2HO17mxutDIVOof58NIlwl/hCIfdy/LrO2p5ZmVubKg9/dBz?= =?us-ascii?Q?wH0SwD6xZiNNbjMqP5nb+afjQoafShmlDogp8smGFwTGV57BuzbSRn6/rQGA?= =?us-ascii?Q?5Xcr5CKl4Iajv8JXY7SeXaaw96/d8+7/6Gpf4klJy1/z9pTAJpWsctK+k5GB?= =?us-ascii?Q?vd/t4xI+lbaOsqPezudNfDslM12BkzXMZrzqXIrexrNZHLn1midsLrOBKvTd?= =?us-ascii?Q?Xq+NuGYSrpHBKOgzVPkr7a6IjKkeieX6H3L2eJDwRTX476snG+r62tC02GVb?= =?us-ascii?Q?GZTWlY0SAH5sLjkyg7spwJROC4nGIuhJLDoSZ+PVPn5RLnM22qVrPSdXNumT?= =?us-ascii?Q?S5xC2L/n4PL50vbofRSa/5UVFdeVrHsik09tTMCcCaYP1ZVot0ZF+GSNl+Dy?= =?us-ascii?Q?/PiDbUkssOJDiTUzgIMqE8kYcE9L+oFbrgBETUoMu9CDthPTXWv3dow78++T?= =?us-ascii?Q?pNudidYy/MMyu8hfyAuQxJN1KyrQk9pX/wvA9dVic4lMUXvUZk/8jpAbhsKy?= =?us-ascii?Q?sY3fmpVVgf5FaioKtYvZqauB73Xu97NzqvyXxLLetTaSEWX0HHWK5bkAJTn8?= =?us-ascii?Q?7G8B+X/N+81vfpdapkcqQgWhVF60QwAHY239gzeT0OGNjbUMlfG53g5nC9of?= =?us-ascii?Q?whxpACaslTnBwBmQEpJ8tijTkECsQI3a0U2U+lveES+Mr/HNbrfj/y/cXCjI?= =?us-ascii?Q?jQL83ZQ51OAl1xLAuENKF9hzXkPFGeqVQEqK022k9F4UitiC7PJLgAT0Zspl?= =?us-ascii?Q?J+4N8s4TsHVQgQOJD0XB4ShPyf22l4PKipiM3ltzzDUfRXWZT7qR8HyOUC6J?= =?us-ascii?Q?Vehgmg5SA3R95bI1hwAeaiO38P6x/2Z3SRV3xZticfI809JYFNTpl7jNc8U7?= =?us-ascii?Q?HzPvd1axVsht9p9C3VYKYVy2TEKQaCUgoEsPUiVTNAc9Kxgi3gqxIoaCAosV?= =?us-ascii?Q?UJmliLZWaqrTON+VNeSyBLQYmjLKANnk/c/Xn1AqhczZYjkT0PndURNN2Uvt?= =?us-ascii?Q?6UnXMSurCTaSjocgGttK4YkFTDIkHLNgMUYFwaB7AZ2+3zdwyBcCJ0bRfPq8?= =?us-ascii?Q?VmYU+dFmy7KW3Iw9Lr8=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: 39d9412f-6713-4cb9-ee4b-08db3b3f2819 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2023 10:17:44.4649 (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: ewGjP/EGhv1KglIBhrCbXJeV6wlZhUY5KINwzqkI6W8mKWsuS/sH/WT6XF0UX1786hjedNhTIncw1Aq3sdejbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7340 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 Hi Tom, This patch set is to change PiSmmCpuDxeSmm code to use CpuPageTableLib to c= reate and update SMM page table. The Pcd PcdPteMemoryEncryptionAddressOrMas= k is also used in PiSmmCpuDxeSmm code and the whole range covered by page t= able is mapped encrypted, which is different from the situation in DxeIpl m= odule. So could you also help do a test to make sure the AMD SEV feature still wor= ks good in SMM with this patch set? Here is the code branch in my fork repo: https://github.com/td36/edk2/commi= ts/SmmPageTable_V2 Thanks, Dun -----Original Message----- From: devel@edk2.groups.io On Behalf Of duntan Sent: Wednesday, April 12, 2023 4:54 PM To: devel@edk2.groups.io Subject: [edk2-devel] [Patch V2 0/8] Use CpuPageTableLib to create and upda= te smm page table In V2 patch set: 1.In 'Refinement to code about updating smm page table', use QuickSort() in= BaseLib instead or PerformQuickSort() in BaseSortLib. 2.Remove the patch to add BaseSortLib in DSC file. 3.Add a new patch to add CpuPageTableLib in UefiCpuPkg.dsc. 4.Add a temp patch to add CpuPageTableLib in OvmfPkg dsc files for test(A p= revious patch I sent before '[Patch V2 4/8] OvmfPkg: Add CpuPageTableLib re= quired by DxeIpl in DSC file' contains all the changes in this patch) Dun Tan (8): OvmfPkg: Add CpuPageTableLib required by PiSmmCpuDxe UefiPayloadPkg: Add CpuPageTableLib required by PiSmmCpuDxe UefiCpuPkg: Use CpuPageTableLib to convert SMM paging attribute. UefiCpuPkg/PiSmmCpuDxeSmm: Avoid setting non-present range to RO/NX UefiCpuPkg: Extern mSmmShadowStackSize in PiSmmCpuDxeSmm.h UefiCpuPkg: Refinement to current smm page table generation code UefiCpuPkg: Refinement to code about updating smm page table UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary function OvmfPkg/CloudHv/CloudHvX64.dsc | 2 +- OvmfPkg/OvmfPkgIa32.dsc | 3 ++- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/OvmfPkgX64.dsc | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 5 +++-- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 3 +-- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmProfileArch.c | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 132 -----------------= ---------------------------------------------------------------------------= ---------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 8 ++++++-- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 97 +++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++--------------------------------= ----- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 629 +++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++-------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------ UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 348 +++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 229 +++++++++++++++++= +++++++++++++--------------------------------------------------------------= ---------------------------------------------------------------------------= -------------------------------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 3 +-- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c | 19 ++---------------= -- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- 17 files changed, 510 insertions(+), 977 deletions(-) --=20 2.39.1.windows.1