From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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; 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 From: Leo Duran To: CC: Brijesh Singh , Feng Tian , Star Zeng , Laszlo Ersek , Leo Duran 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 (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?omQ7QDFvoj1ccichkBUFsb0uYIj7BoztEqQx7TrfuELTml1B6JoUtAN/B4Lp?= =?us-ascii?Q?WIyesNr2Zyz5EIPkz/s42JEXyIc7TaGbjJyMjmZbjDllpIRp2t4t2Bz0zJwz?= =?us-ascii?Q?gDnk3NUecUUhRkQPmXzAAoOilDYagTdheZohezNdxztqhtjAgpMRCOtjoma3?= =?us-ascii?Q?hjOqFGKwPrtuLU43rmp+g6Y/zsywJ3kDLQaDnfr9tKTz5j5V54IP49RPGLol?= =?us-ascii?Q?tB372etcczMRcUop9eBxPJDm4aUdDk58E+i3nXEHok/oZ8s4Vmj6uUvz4q3U?= =?us-ascii?Q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7b49TA1ndvcs0lN36L5H9qy8fZ9D9a2ooik3/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: [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: , X-List-Received-Date: Wed, 08 Feb 2017 21:13:26 -0000 Content-Type: text/plain 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 --- 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/DxeIplPeim/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 BSD License # which accompanies this distribution. The full text of the license may be found at @@ -111,7 +113,8 @@ [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress ## CONSUMES [Pcd.IA32,Pcd.X64] - gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES [Pcd.IA32,Pcd.X64,Pcd.ARM,Pcd.AARCH64] gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/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:System Programmer's Guide, Intel 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 = (UINT64) (UINTN) PageTableEntry | IA32_PG_P | IA32_PG_RW; + *PageEntry2M = (UINT64) (UINTN) PageTableEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW; PhysicalAddress4K = PhysicalAddress; for (IndexOfPageTableEntries = 0; IndexOfPageTableEntries < 512; IndexOfPageTableEntries++, PageTableEntry++, PhysicalAddress4K += SIZE_4KB) { // // Fill in the Page Table entries // - PageTableEntry->Uint64 = (UINT64) PhysicalAddress4K; + PageTableEntry->Uint64 = (UINT64) PhysicalAddress4K | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageTableEntry->Bits.ReadWrite = 1; PageTableEntry->Bits.Present = 1; if ((PhysicalAddress4K >= StackBase) && (PhysicalAddress4K < StackBase + StackSize)) { @@ -116,7 +118,7 @@ Split1GPageTo2M ( // // Fill in 1G page entry. // - *PageEntry1G = (UINT64) (UINTN) PageDirectoryEntry | IA32_PG_P | IA32_PG_RW; + *PageEntry1G = (UINT64) (UINTN) PageDirectoryEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW; PhysicalAddress2M = PhysicalAddress; for (IndexOfPageDirectoryEntries = 0; IndexOfPageDirectoryEntries < 512; IndexOfPageDirectoryEntries++, PageDirectoryEntry++, PhysicalAddress2M += SIZE_2MB) { @@ -129,7 +131,7 @@ Split1GPageTo2M ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 = (UINT64) PhysicalAddress2M; + PageDirectoryEntry->Uint64 = (UINT64) PhysicalAddress2M | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite = 1; PageDirectoryEntry->Bits.Present = 1; PageDirectoryEntry->Bits.MustBe1 = 1; @@ -248,7 +250,7 @@ CreateIdentityMappingPageTables ( // // Make a PML4 Entry // - PageMapLevel4Entry->Uint64 = (UINT64)(UINTN)PageDirectoryPointerEntry; + PageMapLevel4Entry->Uint64 = (UINT64)(UINTN)PageDirectoryPointerEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageMapLevel4Entry->Bits.ReadWrite = 1; PageMapLevel4Entry->Bits.Present = 1; @@ -262,7 +264,7 @@ CreateIdentityMappingPageTables ( // // Fill in the Page Directory entries // - PageDirectory1GEntry->Uint64 = (UINT64)PageAddress; + PageDirectory1GEntry->Uint64 = (UINT64)PageAddress | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectory1GEntry->Bits.ReadWrite = 1; PageDirectory1GEntry->Bits.Present = 1; PageDirectory1GEntry->Bits.MustBe1 = 1; @@ -280,7 +282,7 @@ CreateIdentityMappingPageTables ( // // Fill in a Page Directory Pointer Entries // - PageDirectoryPointerEntry->Uint64 = (UINT64)(UINTN)PageDirectoryEntry; + PageDirectoryPointerEntry->Uint64 = (UINT64)(UINTN)PageDirectoryEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryPointerEntry->Bits.ReadWrite = 1; PageDirectoryPointerEntry->Bits.Present = 1; @@ -294,7 +296,7 @@ CreateIdentityMappingPageTables ( // // Fill in the Page Directory entries // - PageDirectoryEntry->Uint64 = (UINT64)PageAddress; + PageDirectoryEntry->Uint64 = (UINT64)PageAddress | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageDirectoryEntry->Bits.ReadWrite = 1; PageDirectoryEntry->Bits.Present = 1; PageDirectoryEntry->Bits.MustBe1 = 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 available under # the terms and conditions of the BSD License that accompanies this distribution. # The full text of the license may be found at @@ -1682,6 +1684,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] # @Prompt A list of system FMP ImageTypeId GUIDs gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0x0}|VOID*|0x30001046 + ## 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. + # This mask should be applied when creating 1:1 virtual to physical mapping tables. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0|UINT64|0x30001047 + [PcdsPatchableInModule] ## Specify memory size with page number for PEI code when # Loading Module at Fixed Address feature is enabled. -- 1.9.1