From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.5715.1686220398933281632 for ; Thu, 08 Jun 2023 03:33:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=A8eGPyqJ; spf=pass (domain: intel.com, ip: 192.55.52.136, 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=1686220398; x=1717756398; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=YAS9gkOt9Ex4ZmC32J2ppsZgphkJUnMl1GLvnp3EB1w=; b=A8eGPyqJ3Gu9HPBY7dRNjYUQ45v6PrNe+A/xJK+TXP8oL/aN65JF+Gli CJdBUxIU8hrD+a9kWdV2AtGfGtDRewN8Xnyr7o2lTLz6aj9/tFBLJKDbW /7LjQFdeEKsRx+kWc/aOqK8zH46j1+OtbjkpIGMMH7lPn2VQpHlh5lC7f OetgJWpwqs8pD4xJ2u8otMZ4RmUhzdueKKfZW3o3g5LHqGT0fbhM+PxKf 00WbEIQb3CFHsT844JXpIk93c7eGwZ7XINTcUYwP0IyNRNUs5N2JDvm/O N8lgi+nRfxbdepgbc89Rr5zFXvuxeg3QI9r3Snf6wsuP6CNxPOW2He8za A==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="336900659" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="336900659" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 03:33:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="743064762" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="743064762" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP; 08 Jun 2023 03:33:18 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.23; Thu, 8 Jun 2023 03:33:17 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 8 Jun 2023 03:33:17 -0700 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.23 via Frontend Transport; Thu, 8 Jun 2023 03:33:17 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.105) 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.23; Thu, 8 Jun 2023 03:33:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OgpNcUBO34+CQtVPJep/+dJ+8sW7jA/hOuEXW8r9CRJ71LzX/EN7JFIa+R5V3vKdyjZSIw4cZAzZq5XkpQvXxfESRA+WXasxGbsEXvAIkN/gq4Yd0EutfNAXPAuojdl749i+2+FrUfjqg3VGXn3do2CgCOXkNzDnU6jy1XhGDR2nQQt8W+i7Mo7rYemLSf8gfnAXcPDncegnUGIT3OX2HOOCWx52Ftr99fwYYFx75YboL+VE8B2masmg0ZiLogbHOuOSLzBJIJwrdP9vl8tOqbf6ZKBt4UOaSJAxduQ3+fQeDcM/1Hd1FnMtzVOLJcz9rOnkOGkD6GXRRNC3bcOTEA== 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=lfGyTKR1Eyug9lzAPNqwHD2yyFVtiV/jKFHRfXyT9+w=; b=E4GItihMu0s7Mlm0guXxX5V8WIi4LDZh3+cqUI0GNqpO/JbcUQcnHfaFOOZfNcx1Ld+yA7BTPb7nTpnjW/US8CsZ+tK18qbPy/V5BOezhIDdvTp5uh/vTLaS9gEmq3DXLFrrYrU3lEqzFs+NM/v5XuU/NWD3oAShJa950EHP4yTuPXKJCGa3d7CEDwz1ArqiFEXpdwD6GEmpkM2m6kaDDRlWYOSPaowKojMqGeuQkcxVCswC6SzTvkHObBFslQW82oCZ7m1AGQ9dLIQMIsaNfyL/8xDhC2r4AeM8aBMaIv1XQC8pLywVfi8KyvedjNYbSOW9xO2kFQXlZlTFfAOE5g== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ1PR11MB6250.namprd11.prod.outlook.com (2603:10b6:a03:459::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.39; Thu, 8 Jun 2023 10:33:13 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%2]) with mapi id 15.20.6455.034; Thu, 8 Jun 2023 10:33:15 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: Ard Biesheuvel , "Yao, Jiewen" , "Justen, Jordan L" , "Gerd Hoffmann" , Tom Lendacky Subject: Re: [Patch V5 01/14] OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry Thread-Topic: [Patch V5 01/14] OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry Thread-Index: AQHZmbDru9jHnYjm10CTUK008kj6x6+Atdrw Date: Thu, 8 Jun 2023 10:33:15 +0000 Message-ID: References: <20230608022742.1292-1-dun.tan@intel.com> <20230608022742.1292-2-dun.tan@intel.com> In-Reply-To: <20230608022742.1292-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: MN6PR11MB8244:EE_|SJ1PR11MB6250:EE_ x-ms-office365-filtering-correlation-id: 9c72ca19-268c-49eb-c8ce-08db680bc46f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1pVjbGPpe7d2ZrV3bZDkUGYoyyx9k/oRxDNyTBjdloSjrA2zjje3HRiIvkJVJx2WEU+Tr5OSgS6xctr6Ezmican4tCpc9HgEj70iLYKHMvyvJRRWzeTrquZtV1GB1xB3r2u+IqepjXcpE4DtFxbgafhmZDNpN3o+BKZd4KIDraCDTA+IE4oGEZIsBbQnL/uN0iy2r1SLfCthz4bZDiHlaaYALEnMqycfRXiYYA7JRpqswAqqp2xpTVrm9xgTK9QZ8CkyqvN9qYi/kL+lRH4eaHxAR1LmK4m5Jx/QzehBnoJ597m/iGQHJ7Sr3x7nF/plXW63cp+hC0sFm1cVxh3OOXCCyZfK642tqFv+15DyfdjwluTATuaNdBJA/b71GerHwNxCpruhA6/Ewg2uFAiQLxrA9J3EyngMrTsCVyA58rzDZ5YI6Ibc5yMViR2/20vptdkOiCKz5impFVd+on1K6EY31+WVoQArj9Ad18xeC6jjRpK1zXMEaTHqOmJxMzhCkObFhttvoWCwPLVQLR0IdS1Tz98M/NGH6bBBr7lqCm+PuGP/4MCXKuS2bq51dKULAevG8tBSp4Zl2jFcpDMKaOZFxxMy9v+xFVCbBm1xAzWMYekssrdt/qDoQN2i6nMG x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(366004)(136003)(376002)(396003)(346002)(451199021)(66946007)(66556008)(66446008)(64756008)(66476007)(76116006)(478600001)(54906003)(110136005)(8676002)(52536014)(8936002)(5660300002)(71200400001)(4326008)(316002)(41300700001)(7696005)(38100700002)(82960400001)(122000001)(55016003)(9686003)(53546011)(38070700005)(26005)(186003)(6506007)(83380400001)(86362001)(33656002)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QquFk/fe9D7AaQoljkjdx9KOWAASDcZ3IRIuYsXQytkqol4aE6ZA52/vSwwD?= =?us-ascii?Q?uXhXt62eaB5f/x72OZ7C0JCtiaZKslht5uMnKhgHjJPLt9kAuHxpcyMvJuAA?= =?us-ascii?Q?cUot9PLknvPwiQ391zSC76sV/5yhI/LVx3naC3725K76JPJyAfjLMh+bkvoO?= =?us-ascii?Q?8bVIwcSUHuiULT+TbBbcN60dPSTG6FgQkNp3xJlH2SoPrdnWxr2iw/ojGYaJ?= =?us-ascii?Q?zlWbfozvK5bjPauKYvUw9ti3Oh2CiDag4kpAbrj46InzLGrfP0FhSL1PkvvL?= =?us-ascii?Q?ivG5uiwI1D+pa1btk30FWO5JGv0X2C+jkPz6x8Ld9s6dK7RpiScsUDZoQj3W?= =?us-ascii?Q?gDhpWH+aB171rhYGtv43NYPBAlvymkyzTC/GwGEhbAXcjEMIEkPlvWZeMkyq?= =?us-ascii?Q?P+yiPxLYugiWkfidHnnRgWPmrTVefYcfNz7w2FiaCMUNUkh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mXs3sRklA4Wn30wszCmUWMcVykBsQSuPhOUem?= =?us-ascii?Q?6FA4e4vxaZdnojPRvmnI44IV7/Z87DwZbVg44BIiaSewknJse8gUdkE7Dhzs?= =?us-ascii?Q?Xm+KBDYKIpJfer44ryfbrRBPQbxd/MWuzYvKpE3+Wc7HqBbHCJJr9iamPFQq?= =?us-ascii?Q?IgfDVssaIAZxnsJ8dt6sLCf2ALD7pkOSTZB8fQBAnu/MkAW80+Vhh4uJ7QgV?= =?us-ascii?Q?HSqnfo0uX2a3lPPxUoMrpOVi3MYMYYih9mhv1Ffa?= 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: 9c72ca19-268c-49eb-c8ce-08db680bc46f X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2023 10:33:15.2421 (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: 4p7WqY7l4Z6sE56S8K+fXJivtgNgDT/IBcc58+K8/eWjB52VEZXPNHmClUImWCN1qP7TNUIL4gd/0CAbEGK/mA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR11MB6250 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 Reviewed-by: Ray Ni > -----Original Message----- > From: Tan, Dun > Sent: Thursday, June 8, 2023 10:27 AM > To: devel@edk2.groups.io > Cc: Ard Biesheuvel ; Yao, Jiewen > ; Justen, Jordan L ; Ger= d > Hoffmann ; Tom Lendacky > ; Ni, Ray > Subject: [Patch V5 01/14] OvmfPkg:Remove code that apply AddressEncMask > to non-leaf entry >=20 > Remove code that apply AddressEncMask to non-leaf entry when split > smm page table by MemEncryptSevLib. In FvbServicesSmm driver, it > calls MemEncryptSevClearMmioPageEncMask to clear AddressEncMask > bit in page table for a specific range. In AMD SEV feature, this > AddressEncMask bit in page table is used to indicate if the memory > is guest private memory or shared memory. But all memory used by > page table are treated as encrypted regardless of encryption bit. > So remove the EncMask bit for smm non-leaf page table entry > doesn't impact AMD SEV feature. > If page split happens in the AddressEncMask bit clear process, > there will be some new non-leaf entries with AddressEncMask > applied in smm page table. When ReadyToLock, code in PiSmmCpuDxe > module will use CpuPageTableLib to modify smm page table. So > remove code to apply AddressEncMask for new non-leaf entries > since CpuPageTableLib doesn't consume the EncMask PCD. >=20 > Signed-off-by: Dun Tan > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Gerd Hoffmann > Cc: Tom Lendacky > Cc: Ray Ni > --- > OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c | 6 > +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git > a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c > b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c > index cf2441b551..aba2e8c081 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c > @@ -233,7 +233,7 @@ Split2MPageTo4K ( > // Fill in 2M page entry. > // > *PageEntry2M =3D ((UINT64)(UINTN)PageTableEntry1 | > - IA32_PG_P | IA32_PG_RW | AddressEncMask); > + IA32_PG_P | IA32_PG_RW); > } >=20 > /** > @@ -352,7 +352,7 @@ SetPageTablePoolReadOnly ( > PhysicalAddress +=3D LevelSize[Level - 1]; > } >=20 > - PageTable[Index] =3D (UINT64)(UINTN)NewPageTable | AddressEncMask = | > + PageTable[Index] =3D (UINT64)(UINTN)NewPageTable | > IA32_PG_P | IA32_PG_RW; > PageTable =3D NewPageTable; > } > @@ -440,7 +440,7 @@ Split1GPageTo2M ( > // Fill in 1G page entry. > // > *PageEntry1G =3D ((UINT64)(UINTN)PageDirectoryEntry | > - IA32_PG_P | IA32_PG_RW | AddressEncMask); > + IA32_PG_P | IA32_PG_RW); >=20 > PhysicalAddress2M =3D PhysicalAddress; > for (IndexOfPageDirectoryEntries =3D 0; > -- > 2.31.1.windows.1