From nobody Sun May 5 23:22:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486588409305202.1734084112145; Wed, 8 Feb 2017 13:13:29 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 176C3820BA; Wed, 8 Feb 2017 13:13:28 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::60a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 722CC820B9 for ; Wed, 8 Feb 2017 13:13:26 -0800 (PST) Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 8 Feb 2017 21:13:24 +0000 X-Original-To: edk2-devel@ml01.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RrnHeOHNLye1Ev7K4vR2T8dzxAT/p0wTDCf+px6+QJc=; b=1yRkaqsIrH/6UYZbPnMi+suB4ydWIvWysbvsGWQ7bBJsXW9MY3y9Dkb6lFtvuzOLY/zUZsRJYZKTsNZpjO9dkEI8/gDMn6i6tyf+dMd7pzzmwmlR1SOfi02077YOTs/C+20iKRs4lIpNP5CocYIDILQHcSaE3NWBXeYaOQErjws= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; From: Leo Duran To: Date: Wed, 8 Feb 2017 15:13:04 -0600 Message-ID: <1486588386-2146-2-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486588386-2146-1-git-send-email-leo.duran@amd.com> References: <1486588386-2146-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0001.namprd17.prod.outlook.com (10.173.147.11) To MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) X-MS-Office365-Filtering-Correlation-Id: f13b8e81-642a-45ff-1310-08d4506751da X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 3:Jl/9H1IfWw8TtKb+ZFCQBXHWcPss+XUcAU0RBPBmd538Yxpg0zo+eRqQmp+caGo4Q8VhbT0kDzu58aQtjyI4AVHX8zScD6PSXbvZV9guel+Jo7HgsUWkyV06O2NC/aOcsZfrleog6qUEIxd0HEW3YZ9AukrPwNByVYp9ZlL4d8jy+IpTDybzMN3bSstHbRfCsJqpqfQzoaiF4XqUzleJj7z29V9WjUBQv9VsMw1cRpymMf0Mr1AdtE9N5MhZykZ0QNrgFPSefWsYJ0oBZpEgX7/gQYE5BVzpQiaGw9pE6Wk=; 25:YYreljkXznUPVYcePLJNOiWdbboZO7USw5TOpuV26SyJ9h4XcY6zpsWS7JcDdsMqzH2pjpP6kR7CoKmqw1fMkT7KhqbaumK5ONbzGy/LGz4D6Yla/KD+4o/4oDuztSpgF5KJ1QDVANHO/w9ONEAMwQ/9B3h7rlbIg4uZ/VYKMPen1ykuEoqrW4UvCyJ2G8/xny/+L9iP//n6TgoVpVYezIskb/X50VFbCIus/iW8kSuSlplnei47L+3XtSFTLQinHzeKSpi+DrLqLQonxLK43/aA1jbDIoi0CAgPnFyuKNLCRS6A/fUC/D7LF6Hdvw0LjjV0GjNlzBXDaIGjJaZmrfgc2Gs/aktixHRrK+ubEZZb/yopKMhX3tB6B6/aR1SMFby/2Sepeee3wQeRnl9olLlotT9w9xo6LnUS+ug9+ij+TE44co0atccOrq+Y2c59GFFNlIRqsm9GUQ9zyaW5hw== X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 31:Li+lVrQxbi8ictd6mMTV+g0CW346cEqwQdaeY9ob897YmLcgDy4yU36JN4ZIMjjhgWoysd4RTjv8VzslItAcvJFMvCe+a4pleCc/0aweCpGnV5S3kejEpLfcGcbyDRwQ+ZRXf2s+gzseuVUkPsFHpzJ6HDqXy8AibKnW/9ATFpooYY04uW1NjvMNxDWYZST99mMsX1TUU5QXVNTpcUCheExHtMD0JQ5Kb0vlzHgAW/xvg3Y0sZonJFnofbrGOYa6c7fTAfjwe/gRbAr6npHtow==; 20:vTK9HZO6Uq1N6VBBTqe7sc7A4QdRh/6NkdM+5ry5YkvQJ7RX1nCQ1QF7LM3cTFOOtTGcV+avL9Si9yWRBMlSZtJDIgV4THmwmAZ4vf0UsrM38fsCk0jG8HveeBTdOR94b1YEHEPkd7cM47WeG58AS+5JCh9loz2TqZS8zIaP7pcNG5W0BYO05Nn0QkPvafYATxcHZiqLmzXGVZCai+UVNdjI+0IFhOvBL7flGor0m3UxmIZ+/7oYBFvSuyYDaTLwe4iqIRu5nbs/n3JE3Snh7Tj742XQwyPVlr0+Co2izW0jA+3PlHhH2/9sQz70oFeFakWuVbwPqbhMJJXZmKC7dq5kqKyRagJV9hJ4lTDvb9KQIoVfTbCGUrqV8D9IAhKzbVbCcbjJUNVYXJnWMKzanoJW2TBDbDdGnKhPr6xcKIlFV34P8yI+46lzYnA5b+HPbql4PAR8r83DLYsWva3pHtJBQhgfnTdm30rrL1US0acabF17vcpvT/tIvz+OjVgI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(2017020702029)(20170203043)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148); SRVR:MWHPR12MB1247; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 4:MPhUi7FnmGiB2oHTl+46pHFlnW6xPbwTS2hA1O6BYAOVCh/PfSpamVVJmTSOGGlUv2rBJnvKlq3A04yZeGeawo8oQlaRV57g6UK9eK+M35NI934tCvmViIt/Q+8nMVoMPKlEAubwcxYQYVvM3pFG9Joalcs+t1APOELmMm7vd/Wr4CLev3IjQW0A1S3335lwzS2FmxZDPsNvVVdjmvNFt7szwPbd2ShAhUQ0IfuUkAl7n52/RccbuT45ndIQQD/iKaMO8gwvJJDzH96Bd32HPPbAlet5xXbyu4f4j6Yv5g8avYBIAoN/6JQm/6YVIfzPDlvsfHa8avCIWjl1uubIhGdW7Bj9p4og81Zy5bnUKbT8efB3K/9up1rolFdPV87jqox6lmxdrCJSk1GrdSZy5hNYAyTHwtdN3IVuPtntvhSeFJPIPh6zCMfW1idbGLtqwcgtrHoGuknATj/mvT/8saySaJq/30qnYi2G/CIwehXlds5Amy7MYc6DRuJgi4qCTkBNceTD9HYdEXukduK+OM8LxSa1neWODBO4odzT3S5MdnjjrVL/K7OAw79Org5DOZhF2BnCi+0NCdidRlKekzZyjsIzOOhdAd5KA/mqmqB3mgpANv9G8KeNrWQS/SsWj14n/kQLUCbv2h0k3FXS2bmj6dtpwWH2BwT3vxgKXMS9SXQksvB+ku0f3BwzsW3EDB+nMYSuV8prxcY67GSXvNLN4U471ruIcj3OcACsAciypMC9+N6eNcrB9Y6mX/YY X-Forefront-PRVS: 0212BDE3BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(7916002)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(189002)(199003)(5003940100001)(68736007)(42186005)(50986999)(54906002)(76176999)(50226002)(2351001)(8676002)(81166006)(3846002)(81156014)(6486002)(53416004)(66066001)(101416001)(92566002)(47776003)(106356001)(6116002)(25786008)(2906002)(2950100002)(105586002)(38730400002)(33646002)(6666003)(36756003)(305945005)(48376002)(7736002)(53936002)(110136004)(97736004)(86362001)(50466002)(4326007)(6916009)(189998001)(5660300001)(213903007)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1247; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1247; 23:ZZniY9OvS3xC7AYMwQCb3oesmG7YiD/Qb+Y7WyzbF?= =?us-ascii?Q?AJmhMq6utiTSEL0tiE1MjMBBRurMvUCnyhalEuuUMGBVE0+CnQwNNTtYwhOS?= =?us-ascii?Q?8fpew06yjFJIlqlGKkyPjtr5nrEEx4Igm6rQl44tMy90kDUbW/cmmCDY8bby?= =?us-ascii?Q?niiEkLje/R8eVhtC9OZPTloefO6+CBQXlSO4BbbiFmS/yw18DQDKh4n6XFBT?= =?us-ascii?Q?dtFMAOVJAlmtIiHVZa5IRNGbgl0PcnjxvqzwSJupNt+MfNTDnttzBXfHSmWM?= =?us-ascii?Q?cHObygz+obEO0vm9EFQdYbKSaRAYSJUqaOakoKiTSOC1FEffl2w0utX887gN?= =?us-ascii?Q?PxRqJX0QRybjPzXvPLlu+jBGxjdekT/FYBxtumuh61ysbTxbjy2jzYUBGfcd?= =?us-ascii?Q?ewNCMAlInUo+B/A4sPRHP7YZExqjJJDiQ40JoU7ahr7YV9MLMnd6B74pm8X2?= =?us-ascii?Q?omQ7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dHx4qcYusLW3SbrcUmp9PknAbu83BzLwYA+f/JnmxKVtlXlMOnuXJkJAz0ShcCFt6RAwdnselcqDbTW7JwiJF5b+La69D93tPv0tD5GtwWAgLnB+r0pK1L9d69F2e9BHy1DpnmInREE3L4poLtJPJNZYjOPfaXQjkjKAvjBFVkJXiuDRXm8KNaClbmPWUHarl/TGCGmxX8pKeG+Z1ZxkOiRgaujBZ1FGeMth+smP3ZhYOA==; 20:jUTDSDBnEnUFzh7KR79h/3Ja0x4HK4PJtc7k3s6PY3Nkj9tlKvvEUedU+yC3Mjij0HkDA9/U5L8cgNQnPYLzKvETWNXOMjmXcybXjDelc07E/Hsv7b49TA1ndvcs0lN36L5H9qy8fZ9D9a2ooik3/0J6lQ1Z2xThSK6umGpNHmTu73uLE7r2HYTY6l3P1VJvuyMmzsGFkMQveL9xAROmwGAPNolkxzRc97cRD4YLv7LnHmciamOJyf8WsgkkEtZ4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2017 21:13:24.1334 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1247 Subject: [edk2] [PATCH 1/3] MdeModulePkg: Add PCD PcdPteMemoryEncryptionAddressOrMask X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Feng Tian , Brijesh Singh , Star Zeng , Leo Duran Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Brijesh Singh This PCD holds the address mask for page table entries when memory encryption is enabled on AMD processors supporting the Secure Encrypted Virtualization (SEV) feature. Cc: Feng Tian Cc: Star Zeng Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran Reviewed-by: Star Zeng --- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 5 ++++- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 18 ++++++++++-------- MdeModulePkg/MdeModulePkg.dec | 8 ++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/Dx= eIplPeim/DxeIpl.inf index 2bc41be..d62bd9b 100644 --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf @@ -6,6 +6,8 @@ # needed to run the DXE Foundation. # # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2017, AMD Incorporated. All rights reserved.
+# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may = be found at @@ -111,7 +113,8 @@ [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress ## CONSUMES =20 [Pcd.IA32,Pcd.X64] - gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIM= ES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ##= SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES =20 [Pcd.IA32,Pcd.X64,Pcd.ARM,Pcd.AARCH64] gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePk= g/Core/DxeIplPeim/X64/VirtualMemory.c index 790f6ab..2c52389 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -16,6 +16,8 @@ 3) IA-32 Intel(R) Architecture Software Developer's Manual Volume 3:Sy= stem Programmer's Guide, Intel =20 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Incorporated. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -71,14 +73,14 @@ Split2MPageTo4K ( // // Fill in 2M page entry. // - *PageEntry2M =3D (UINT64) (UINTN) PageTableEntry | IA32_PG_P | IA32_PG_R= W; + *PageEntry2M =3D (UINT64) (UINTN) PageTableEntry | PcdGet64 (PcdPteMemor= yEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW; =20 PhysicalAddress4K =3D PhysicalAddress; for (IndexOfPageTableEntries =3D 0; IndexOfPageTableEntries < 512; Index= OfPageTableEntries++, PageTableEntry++, PhysicalAddress4K +=3D SIZE_4KB) { // // Fill in the Page Table entries // - PageTableEntry->Uint64 =3D (UINT64) PhysicalAddress4K; + PageTableEntry->Uint64 =3D (UINT64) PhysicalAddress4K | PcdGet64 (PcdP= teMemoryEncryptionAddressOrMask); PageTableEntry->Bits.ReadWrite =3D 1; PageTableEntry->Bits.Present =3D 1; if ((PhysicalAddress4K >=3D StackBase) && (PhysicalAddress4K < StackBa= se + StackSize)) { @@ -116,7 +118,7 @@ Split1GPageTo2M ( // // Fill in 1G page entry. // - *PageEntry1G =3D (UINT64) (UINTN) PageDirectoryEntry | IA32_PG_P | IA32_= PG_RW; + *PageEntry1G =3D (UINT64) (UINTN) PageDirectoryEntry | PcdGet64 (PcdPteM= emoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW; =20 PhysicalAddress2M =3D PhysicalAddress; for (IndexOfPageDirectoryEntries =3D 0; IndexOfPageDirectoryEntries < 51= 2; IndexOfPageDirectoryEntries++, PageDirectoryEntry++, PhysicalAddress2M += =3D SIZE_2MB) { @@ -129,7 +131,7 @@ Split1GPageTo2M ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 =3D (UINT64) PhysicalAddress2M; + PageDirectoryEntry->Uint64 =3D (UINT64) PhysicalAddress2M | PcdGet64= (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite =3D 1; PageDirectoryEntry->Bits.Present =3D 1; PageDirectoryEntry->Bits.MustBe1 =3D 1; @@ -248,7 +250,7 @@ CreateIdentityMappingPageTables ( // // Make a PML4 Entry // - PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEntr= y; + PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEntr= y | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageMapLevel4Entry->Bits.ReadWrite =3D 1; PageMapLevel4Entry->Bits.Present =3D 1; =20 @@ -262,7 +264,7 @@ CreateIdentityMappingPageTables ( // // Fill in the Page Directory entries // - PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 = (PcdPteMemoryEncryptionAddressOrMask); PageDirectory1GEntry->Bits.ReadWrite =3D 1; PageDirectory1GEntry->Bits.Present =3D 1; PageDirectory1GEntry->Bits.MustBe1 =3D 1; @@ -280,7 +282,7 @@ CreateIdentityMappingPageTables ( // // Fill in a Page Directory Pointer Entries // - PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirectory= Entry; + PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirectory= Entry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryPointerEntry->Bits.ReadWrite =3D 1; PageDirectoryPointerEntry->Bits.Present =3D 1; =20 @@ -294,7 +296,7 @@ CreateIdentityMappingPageTables ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 = (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite =3D 1; PageDirectoryEntry->Bits.Present =3D 1; PageDirectoryEntry->Bits.MustBe1 =3D 1; diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 273cd7e..15119d0 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -6,6 +6,8 @@ # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# Copyright (c) 2016, Linaro Ltd. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2017, AMD Incorporated. All rights reserved.
+# # This program and the accompanying materials are licensed and made availa= ble under # the terms and conditions of the BSD License that accompanies this distri= bution. # The full text of the license may be found at @@ -1682,6 +1684,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynami= c, PcdsDynamicEx] # @Prompt A list of system FMP ImageTypeId GUIDs gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x0}|= VOID*|0x30001046 =20 + ## This PCD holds the address mask for page table entries when memory en= cryption is + # enabled on AMD processors supporting the Secure Encrypted Virtualizat= ion (SEV) feature. + # This mask should be applied when creating 1:1 virtual to physical map= ping tables. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0|U= INT64|0x30001047 + [PcdsPatchableInModule] ## Specify memory size with page number for PEI code when # Loading Module at Fixed Address feature is enabled. --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 23:22:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486588411672469.6514692769415; Wed, 8 Feb 2017 13:13:31 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4C794820CE; Wed, 8 Feb 2017 13:13:30 -0800 (PST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0612.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::612]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6C51D820CE for ; Wed, 8 Feb 2017 13:13:28 -0800 (PST) Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 8 Feb 2017 21:13:26 +0000 X-Original-To: edk2-devel@ml01.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wBREXBMXK+1/T+Tq7/VJAOGqqOQGek1qMXuY3tMGEkM=; b=ebdlOwoTwwRcVNU7j8wknwUiU3PbovwI2869txjw3Gd2/bGy/obxd4m9O1M907uHW67Bvwy7oosKw1/PIhgB0YslpEjWonnWjN48Oa4T6mbJwawGs7XoFKKd6+MwYLY1NHdJiU1W0tPTEWEsyPn/BaGbmRw2xR+0My2M53ltvQA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; From: Leo Duran To: Date: Wed, 8 Feb 2017 15:13:05 -0600 Message-ID: <1486588386-2146-3-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486588386-2146-1-git-send-email-leo.duran@amd.com> References: <1486588386-2146-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0001.namprd17.prod.outlook.com (10.173.147.11) To MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) X-MS-Office365-Filtering-Correlation-Id: 77d5a44f-a70e-41c3-9be7-08d4506752fd X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 3:s6a2DyortLahxhaXBSf+AW6QUNqnBKyJRHqkQk1t11xWuYNfEBb8QCjH/TuQiCObXGbq34LN794UBAnZdwWJLaIeTqGdzewCH8EBBu1eGCMwC9xmW+J208xEQnynFifmSohrBdLOa/IxCXOgqj2t0+CWrRyP8FBRvXu6Lryoikp+tZldGHM6BKyvO4tswgadZIuRtk9Ory1JfGKZr6VkcUGv1IB9Xu2XjpXoTp7Ln14sJUr9bT2B89cAXhFfzMvAgTvCq1gj3yCj1Mxp1A8alfkFNwTj19TCn3EGbM6wu1s=; 25:WMvwely5+XLdtWsaukdo90nZehfVYF/0lgYDbFmfIZ7WfxK0YqhRbdi0yMxfLEIdXtvSq5wQHXXm1h0j0WncKdtoDHGv/e4Im0YmkPNrTXGBsWE7uKtuIl7btX+cXXyVrpZyRpWFferCOj3ALgM9w2M4/0gewEMJqxRFIGLFR04KpY58EA8HiD1zU5RXr4UsDXnXP+/1sTDAVQnbqUvXnoPm99uKhWV/BW7/xas/AZ15XlZxhqCHoWRKrRseGzM+V54tzK/WLUsa+XblLk/lCwHOXfkeIrd3+J+LBWK3bYBDRacmr4mdQ7UPjbVM5gI8s6biOqmJkhpenWDB8/zuTclPv1tbleswejjllsfeDn9Dp3l+Z7PFDsCopGVDW3XcvgAMnmXpbiQMA5NPl/FmZo+BkDdr9SnAe0VF6+WpnH2psa9ebAlT+4cuczioHr/XOwQ4ff9VbXtyvMRyp074bQ== X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 31:0J5+D1WJu2cQJiVwnrKj54dsQVm9bcWsj7yOjYc2k9EEW+xuAMGjpee6LE443NrLUQ31NoQwfcE7g8c88s6Z943OehmRasFtKXQDfnkCFZkWWplW1mnwvEZzhgW9QyADGpuwporppTeVytthU5WVeENJx6qD3nija70Z8TIbQAx/8y1snEE0+CQ2OhAhyTIQXuEqdmsgJODN+/fzV/zofNvEMj3MOErXvlv4a6jS3fXAOF8snElfZQpu4JMCYG5f; 20:t5GX1yfJRz7/LMfUPP8lACqMYQLIHbe8uTjsv4zF/IQLn2hymvfwLWksDbdhxsLGBRQgKkdGevOMbd67IqnfubFJsYgElkc7HDIJk7UD9uFRA02URb6Ujw7NvSFIv44P6OEo2trNxBaSNPUFgcpKNlNcOAn4wU9qh8LuNSG+s6cHBfb1dDeL4dr1/B/hQ0f0dNaWXZkG6tw0sonQOd0tN1VPi7cthTsyTGOSParYF0D8BeCVguMvHYZOAH9IRwxEjbHwJPixJ5ELrEP2StKzfOPiMZAUNQcIZ9ymXHoAa1AcpCedO2IIKifXLywNlfykcQHnj+aj5ptViba3CoPPxEiyJJPdoM0bB248ukMTXaE94qlEtAEGAufNFj05i5ucWbg5Kbivd479WPRI1f9f7UM/sqNnPaJuRn42PyGmjjNeBuj0OklgN9McOuchQSzc565xuQtjrHmDSdh0WE47sy/ml0VAa4wGzJuuJ+xKzELWKj4ptUa9aVFoYWCV1Utp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(2017020702029)(20170203043)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148); SRVR:MWHPR12MB1247; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 4:mJHNhMCrEEPrrNvGztvsXPI2JLt216C2ab9TuhVkMLzEkuKmwf7/Dx7qBKV7iAFcQN9xRs68cDNBNWoRrG7MvjimKqqPjpibIVMuNYwULNeCOkRi9wPIXeSL2qG4I66FzAun4v7y1PFgL1IwkFpZXnr1mXQxjxXKLFl7lQp8Yq4IIsuDnYjQjh+jwHOoOhvX/cHLh1/ebRmCi38QHWqrK/oUghi7m0VavMnBh2pzAfHh25w2n3BP/ygSrPYhbrJ9muGxxpgZaJw6CdAgo/aTdxQWcZocVjOvnpRHSOje2AlG7NGVGcPQT6NxnPx/26mY9MO1KoV7k8ltcWY00x1VN3grgmDOrp+htOfosblFPcm17l4jU2VWxKEK2XnUvSMYL7GkVNc1oqhLcWb1UYO8WkCfyZwatHsotL/l644/wFC0JpqmZcOQuflplmY24rvJ2/aZuG8CFwDuszvF0v313vn7d+x0bCMZj5XaSGEq7vcO5RFWtfEZU95vFOSeK7BBqUTszZKcOS5iwiXVjaK/QbIeWO9T3T/eUTDio8buDYYEMKvR0lffZYbdNxvqUAz6o3A+rgKESTyGT23mX69xan5+JTWsC7Nrg6CuVi2n+BAtiBXV2XSXXrU7O1lnr/Ljn90OOIGnt7qn1QWA6Aw9miLMd2u2WUXh+iYQH8kC1TyoT/2h3dAj/76a5GBuqcD7s9OEI1KK2B8uPGoUYskbgmcHVsFm0Tw4wy0ySo+3sl+CJ+8EcTs2pgSR6Kdjwq0C X-Forefront-PRVS: 0212BDE3BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(7916002)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(189002)(199003)(5003940100001)(68736007)(42186005)(50986999)(54906002)(76176999)(50226002)(2351001)(8676002)(81166006)(3846002)(81156014)(6486002)(53416004)(66066001)(101416001)(92566002)(47776003)(106356001)(6116002)(25786008)(2906002)(2950100002)(105586002)(38730400002)(33646002)(6666003)(36756003)(305945005)(48376002)(7736002)(575784001)(53936002)(110136004)(97736004)(86362001)(50466002)(4326007)(6916009)(189998001)(5660300001)(213903007)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1247; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1247; 23:0Wntwmzwbp/ZnPFHbxH7KiZihtH5ntS0MvuXjLcRY?= =?us-ascii?Q?ThncJD1XpxIbcZGP3TqmWiOS2ZeDA++pkpkIa3QESORxjB4o68gRUlgUb5vg?= =?us-ascii?Q?Cpk6driWodAA3SDCPRsN8qm8CX063k8HrdIKXEctT5AE46O8HTPgBIWApMry?= =?us-ascii?Q?MuWjm4+By5Pi3NMfPkwcsr6OxX9tKk/dQ8Ta8RNuM+5iL1GG5XcsIJssFK1C?= =?us-ascii?Q?HCcm5bdn8+cCPdcoLr2nbU4Sm8R66+u1hpO1BgzYNh9HRgtEfYobhnC6g2jv?= =?us-ascii?Q?b9COnkJyCwNfFKcXk/PjQqh0seNnnWhGkHE4ru06LUyhB4Vu/YCiD3hba1Sg?= =?us-ascii?Q?vnVX1prDAEOBJv4znxQagLqqp4dlrMhXN/Wr230RAtX5po9wUlJIO0LzRsOa?= =?us-ascii?Q?MGSGCPZy4n25lNNY4zeVETZnSgHBQwTmbp2gzGVUjnA8Jl3wrFQzrk6CrEgX?= =?us-ascii?Q?R7nF6ku0pPCOzjvYPP7UHijaEFdmQveX40Np/jjnMHJ6vqXMLQLJNOFBjIQw?= =?us-ascii?Q?zZ1xrosmrh63V2p4U2eQ84Ftw5rlwdq0SCdf/jZ/ae8YW5BbcmjxzHTcoHKz?= =?us-ascii?Q?Zbi2KR4qUtQqIitwau+kSb45jrXHD8VC6iE0EpbwiZFZVErZfermCRgLiIzR?= =?us-ascii?Q?DyPaxqtNNoAQHwnzdyCsasXmY9XIPP9lcDC8vAen9NpZgqK9VkivE6Q1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F7Msb1UzJJ+kCQAkUjXpQTfER/UZstntStVQ3AUqHvIGlDgsdx4SCQ3DTz+9JfHdFJ2rsD9MXL4fkACHtXCEFaipnu1ecwLDTvY+lPproRKhwsttxuPs4kkUzErlSPKrZrIhWpTK0RMT/CClL+rxAOtNEV+YjCYw9LC7XYR/p3n/kasKMc63qnFu/FIovSHOHKTjTCoV73Ou4xuZFUfvqPrYDqR5P+B+Ghmg0HmsEG6aX/2j X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2017 21:13:26.0760 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1247 Subject: [edk2] [PATCH 2/3] MdeModulePkg/Universal/CapsulePei: Add support for PCD PcdPteMemoryEncryptionAddressOrMask X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Feng Tian , Leo Duran , Brijesh Singh , Star Zeng Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This PCD holds the address mask for page table entries when memory encryption is enabled on AMD processors supporting the Secure Encrypted Virtualization (SEV) feature. The mask is applied when 4GB tables are created (UefiCapsule.c), and when the tables are expanded on-demand by page-faults above 4GB's (X64Entry.c). Cc: Feng Tian Cc: Star Zeng Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh Signed-off-by: Leo Duran --- MdeModulePkg/Universal/CapsulePei/CapsulePei.inf | 2 ++ MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf | 4 ++++ MdeModulePkg/Universal/CapsulePei/UefiCapsule.c | 9 +++++---- MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c | 10 ++++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf b/MdeModulePk= g/Universal/CapsulePei/CapsulePei.inf index d2ca0d0..c54bc21 100644 --- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf +++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf @@ -7,6 +7,7 @@ # buffer overflow, integer overflow. # # Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions @@ -76,6 +77,7 @@ [Ppis.IA32] [Pcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleCoalesceFile ## SOMETIMES_C= ONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_C= ONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES =20 [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES diff --git a/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf b/MdeModulePk= g/Universal/CapsulePei/CapsuleX64.inf index 8318eaa..cf8543b 100644 --- a/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf +++ b/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf @@ -10,6 +10,7 @@ # buffer overflow, integer overflow. # # Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions @@ -53,6 +54,9 @@ [LibraryClasses] CpuExceptionHandlerLib DebugAgentLib =20 +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES + [Depex] FALSE =20 diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c b/MdeModulePkg= /Universal/CapsulePei/UefiCapsule.c index 9ac9d22..77bc68c 100644 --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c @@ -2,6 +2,7 @@ Capsule update PEIM for UEFI2.0 =20 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Incorporated. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions @@ -187,7 +188,7 @@ Create4GPageTables ( // // Make a PML4 Entry // - PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEntr= y; + PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEntr= y | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageMapLevel4Entry->Bits.ReadWrite =3D 1; PageMapLevel4Entry->Bits.Present =3D 1; =20 @@ -198,7 +199,7 @@ Create4GPageTables ( // // Fill in the Page Directory entries // - PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 (P= cdPteMemoryEncryptionAddressOrMask); PageDirectory1GEntry->Bits.ReadWrite =3D 1; PageDirectory1GEntry->Bits.Present =3D 1; PageDirectory1GEntry->Bits.MustBe1 =3D 1; @@ -215,7 +216,7 @@ Create4GPageTables ( // // Fill in a Page Directory Pointer Entries // - PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirectory= Entry; + PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirectory= Entry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryPointerEntry->Bits.ReadWrite =3D 1; PageDirectoryPointerEntry->Bits.Present =3D 1; =20 @@ -223,7 +224,7 @@ Create4GPageTables ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 (P= cdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite =3D 1; PageDirectoryEntry->Bits.Present =3D 1; PageDirectoryEntry->Bits.MustBe1 =3D 1; diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c b/MdeModulePk= g/Universal/CapsulePei/X64/X64Entry.c index 5ad95d2..f3f68ee 100644 --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c @@ -2,6 +2,8 @@ The X64 entrypoint is used to process capsule in long mode. =20 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Incorporated. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -128,7 +130,7 @@ AcquirePage ( // // Link & Record the current uplink. // - *Uplink =3D Address | IA32_PG_P | IA32_PG_RW; + *Uplink =3D Address | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | I= A32_PG_P | IA32_PG_RW; PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] =3D = Uplink; =20 PageFaultContext->PageFaultIndex =3D (PageFaultContext->PageFaultIndex += 1) % EXTRA_PAGE_TABLE_PAGES; @@ -183,7 +185,7 @@ PageFaultHandler ( PTIndex =3D BitFieldRead64 (PFAddress, 30, 38); // PDPTE if (PageFaultContext->Page1GSupport) { - PageTable[PTIndex] =3D (PFAddress & ~((1ull << 30) - 1)) | IA32_PG_P |= IA32_PG_RW | IA32_PG_PS; + PageTable[PTIndex] =3D (PFAddress & ~((1ull << 30) - 1)) | PcdGet64 (P= cdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; } else { if ((PageTable[PTIndex] & IA32_PG_P) =3D=3D 0) { AcquirePage (PageFaultContext, &PageTable[PTIndex]); @@ -191,7 +193,7 @@ PageFaultHandler ( PageTable =3D (UINT64*)(UINTN)(PageTable[PTIndex] & PhyMask); PTIndex =3D BitFieldRead64 (PFAddress, 21, 29); // PD - PageTable[PTIndex] =3D (PFAddress & ~((1ull << 21) - 1)) | IA32_PG_P |= IA32_PG_RW | IA32_PG_PS; + PageTable[PTIndex] =3D (PFAddress & ~((1ull << 21) - 1)) | PcdGet64 (P= cdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; } =20 return NULL; @@ -298,4 +300,4 @@ _ModuleEntryPoint ( // ASSERT (FALSE); return EFI_SUCCESS; -} \ No newline at end of file +} --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 23:22:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486588413812238.8855350876114; Wed, 8 Feb 2017 13:13:33 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 81C74820B9; Wed, 8 Feb 2017 13:13:32 -0800 (PST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on062a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::62a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 95920820B9 for ; Wed, 8 Feb 2017 13:13:31 -0800 (PST) Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 8 Feb 2017 21:13:27 +0000 X-Original-To: edk2-devel@ml01.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=VIWICYlwZEfzHmkep52E8sieNzWCvlyu+d5foU3gfLM=; b=SLvXN1XGUH3329bqjKc73++8Sto5cCGCg51TR8x+5QgJNcnSW6CTptqpC9NTalIHjbmPIsmvkFDj/28xHUx9ecpnVL1hfX1Pub2ZjUfzeIWBfCGZGp21xz/WDk3LV7mn0N1FffAoy3bhe1YuGMuxmYtZ5TCpVTmOyhkstz1M3jw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; From: Leo Duran To: Date: Wed, 8 Feb 2017 15:13:06 -0600 Message-ID: <1486588386-2146-4-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486588386-2146-1-git-send-email-leo.duran@amd.com> References: <1486588386-2146-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0001.namprd17.prod.outlook.com (10.173.147.11) To MWHPR12MB1247.namprd12.prod.outlook.com (10.169.205.7) X-MS-Office365-Filtering-Correlation-Id: 36b2d3f7-d06e-4b0d-8c1c-08d45067541e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 3:BHFJOeif2yXZE3czVmwn7U+ge8FQHlF5XoclMXwYk3beAVUOZ8BK8+qvzvdoPqXEPZiF2Y1OVQFeWgHsBlL7wIM+OAAMaeO7q1K7z1ND7wz+q4wVR5vc4x7Za1DNQpVlN9JS5WyKJaRL4ZMB9pbKGPPvmRM8nrE0W2T2zpkEY4j+SSJN311HIJW4Z++zzqRKwigpRqssJKJNE/laB7ObppWyTyEp0tXr5iG6Ogzydi4xrUfDyhpfG9dfhjJz8u8Iu+uBvr1mlKC+xDvBd07im/LV/Ix+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+d1ws+/YXtmkRLF1gTZX7aJdxwnpsOs8Jk1IW2dYyBm6/fIyp+crFl/5KOwcusVpd/Ah8dw7UzmKM+jpMbAMBHyDumGDANbmDQd9b/nu8zRA4e1XG6L/KNOCYGuG7LZ23TgV6pRH6jfzUaPx6pPHt4CZLeMgqznAnrDhOSxCv9f1sYnvAHqBCIqIUENOkJDCxS/iROpZ4Rq8OnkhORWbaLR7CMtRxkcP5+3u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(2017020702029)(20170203043)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148); SRVR:MWHPR12MB1247; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1247; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 4:kmdaVNzUqkSE21A+MkmyQYl7UM5ujssKFVKzNcxEPwfrhRwKF5FQldvBWTyqFnGIF2ETpwIx2P5IFk6hELNr3l+OP2hk9cFHs1UGtuyjSanO2t5Ej/HSmERnW7/kQaEtrCLhbqJRDrpUiZn+IClom8CK0WxM94ka3bBE70aR3ReBcRtqhu3o1rpKiUUj0Iuvn/yRU57RNeSWhn8DrmHpbNRSI79+Nih2aaS7uCjyHg86itwT+Xr8UlyPXh0zomi2dxUuRAaHGfYxv5IVrQueJVbF2ZOpicbD+5DFYJGVEtXJJQLJVVOrWs/7CWEp36x/LC1WDWnYqBPdjx45hJSVbHbwxnLHeu947GNIIhuS+GWdyzORrN0KgQNBUCCnFoy8VT2L1WZJYFzVSacnmCEVCRMxUP66gFM/dVj5AInDDuHhhRWhOH9QdUvOqiW/zIYxJvXetEm42SbqHpqc6XvGxtbWTTsf2wSbdN+QblTx+XiWKFVkIqxUioPXCGtVLnKaxLXEcmLTjS72y3HdPFIusQ4UiUe5yxKFfsjtijWYz6THlydQwNZ35l8Zm/S6Ye9EZAdUkgN9EJ6L0i9rSRpO3YSL42f9q1p/kn4Y/bHDKyDjz1KAxroE4lN5z8CMCa3Bh2Jtt3XEBlNvT4lZxIRutWHo2Pf4VksIzNFa1y89RIAiIh8v0ZwTlEXeNgXxlUziZfzpHyS1V8EhrCyWduPX2qCnbDQuLhTPkTZn/+sbla+dl+bYupvRhKaQkQ/lLmPS X-Forefront-PRVS: 0212BDE3BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(7916002)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(189002)(199003)(5003940100001)(68736007)(42186005)(50986999)(54906002)(76176999)(50226002)(2351001)(8676002)(81166006)(3846002)(81156014)(6486002)(53416004)(66066001)(101416001)(92566002)(47776003)(106356001)(6116002)(25786008)(2906002)(2950100002)(105586002)(38730400002)(33646002)(6666003)(36756003)(305945005)(48376002)(7736002)(53936002)(110136004)(97736004)(86362001)(50466002)(4326007)(6916009)(189998001)(5660300001)(213903007)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1247; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1247; 23:5s8WAQL5fCk5c4kvAPv3V2i2xZdYveKaZMYUsVOiX?= =?us-ascii?Q?i1LKT2oSqIf0N281qJ/hOlNx7rS9vw/2BCWlCQE2MvC8EkZf0/hu3mMkSe+h?= =?us-ascii?Q?uQmWYb+tynDZChEeTngO6slIqIjXp76Xg+jLgGTnxSgJKsWDwvW7OGBSXubW?= =?us-ascii?Q?PiuZxBUF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iagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1247; 7:u/YR7eA83TpebpYsQRLcVLVqYjJYSwvcTZtnVews4OtCmM6FiPTuJb4oXsF36gDTetwQggkiSap/5tz1uFwW29ltP0w2GLL77+Yq5YqOD6Rmm9g3LpLHdkNoInKR5dM1H17NMhZqxsHS15ltuA7tN4YJSNXxvcuVIHbBFU8q+IafqDjMsM6fMrFJfFI0B83yfKfMZUrQdRGunFvffQwSwOL6q6e2lvhTmak7iBvhp0C7UNXDhaCob09Uy848IH9zi5GRtQVVcq+LnLvMGH68cQzUxjGIqT5Ji7MV1KT91jSQUiFvmT4WL67zKS0IOS3qWpdhKvPxccdfKZMJIZtB2ZKnBpmifzL5TYGlV47hPmNSyOD/z+stlxiuk0aoh1tafcowh4FAGf6ilco2M+QPwu0iRuhTkJ2qw9NCR76pOtVLr+PXYINXpicSe5dOyKLRIllE8jBMUVISlsdK7zn/m2HqudYc5nGz2hBsJG4REnsOWOb8SmLyNqgJtHgQL4+9luVgju32G4fOqE3D1Fb1gQ==; 20:mfQ8gw9Ayl2uKWABU02RIMaEFccK4BwEERgz+lfEgF/gHujLYLnuc++qmnCq7zelnvoqy+rYLTRu602vQ77kvg+6t+mz4MfuLq58UpvYhJp6x4wFHXZzdEBT3gBfm+sygVwcdTGGmaugusW3lENMxNmpCqnp6SWAeemFoCQKsuofI3qRuW0cyePGv+vHHGJ06dnUbmVPnyaJo9wGT+21LokF8pLL8PCEFpYC8aiPXh+hTczuvHuxe/y2FeoAiznE X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2017 21:13:27.8485 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1247 Subject: [edk2] [PATCH 3/3] UefiCpuPkg/Universal/Acpi/S3Resume2Pei: Add support for PCD PcdPteMemoryEncryptionAddressOrMask X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Feng Tian , Brijesh Singh , Leo Duran , Laszlo Ersek , Jeff Fan , Star Zeng Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This PCD holds the address mask for page table entries when memory encryption is enabled on AMD processors supporting the Secure Encrypted Virtualization (SEV) feature. The mask is applied when page tables are created (S3Resume.c). CC: Jeff Fan Cc: Feng Tian Cc: Star Zeng Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh Signed-off-by: Leo Duran --- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 9 +++++---- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg= /Universal/Acpi/S3Resume2Pei/S3Resume.c index d306fba..ee1e2cd 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -5,6 +5,7 @@ control is passed to OS waking up handler. =20 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Incorporated. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions @@ -696,7 +697,7 @@ RestoreS3PageTables ( // // Make a PML4 Entry // - PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEn= try; + PageMapLevel4Entry->Uint64 =3D (UINT64)(UINTN)PageDirectoryPointerEn= try | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageMapLevel4Entry->Bits.ReadWrite =3D 1; PageMapLevel4Entry->Bits.Present =3D 1; =20 @@ -707,7 +708,7 @@ RestoreS3PageTables ( // // Fill in the Page Directory entries // - PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectory1GEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 = (PcdPteMemoryEncryptionAddressOrMask); PageDirectory1GEntry->Bits.ReadWrite =3D 1; PageDirectory1GEntry->Bits.Present =3D 1; PageDirectory1GEntry->Bits.MustBe1 =3D 1; @@ -724,7 +725,7 @@ RestoreS3PageTables ( // // Fill in a Page Directory Pointer Entries // - PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirecto= ryEntry; + PageDirectoryPointerEntry->Uint64 =3D (UINT64)(UINTN)PageDirecto= ryEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryPointerEntry->Bits.ReadWrite =3D 1; PageDirectoryPointerEntry->Bits.Present =3D 1; =20 @@ -732,7 +733,7 @@ RestoreS3PageTables ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress; + PageDirectoryEntry->Uint64 =3D (UINT64)PageAddress | PcdGet64 = (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite =3D 1; PageDirectoryEntry->Bits.Present =3D 1; PageDirectoryEntry->Bits.MustBe1 =3D 1; diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/Uefi= CpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf index 73aeca3..d514523 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf @@ -6,6 +6,7 @@ # control is passed to OS waking up handler. # # Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # This program and the accompanying materials are # licensed and made available under the terms and conditions of the BSD Li= cense @@ -91,6 +92,7 @@ [FeaturePcd] =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES =20 [Depex] TRUE --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel