From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on060c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe44::60c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 23E6581FBD for ; Tue, 7 Feb 2017 11:53:55 -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=JluFdA5ldZHwAq/UvwURiHI5WtFfyrHd5a1IJomzj3c=; b=PuywTrk32R7PPjGpRTXh3gCJNngvQAsYr3ve1VtkwDVArK87INeW6p+EC3+rd56JdnidgxcS9TCtowGkUZZhMQdtN/S6rYTLsfnM6N5vARwP3Hx1ZbhewC9hAxiuAH+1Jn13UygBLUd/ePEM+9CF2MwlNJDLez4lI7XyOYHYogY= 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 CY4PR12MB1239.namprd12.prod.outlook.com (10.168.167.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Tue, 7 Feb 2017 19:53:53 +0000 From: Leo Duran To: CC: Brijesh Singh , Feng Tian , Star Zeng , Laszlo Ersek , Leo Duran Date: Tue, 7 Feb 2017 13:53:43 -0600 Message-ID: <1486497223-22694-2-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486497223-22694-1-git-send-email-leo.duran@amd.com> References: <1486497223-22694-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR12CA0060.namprd12.prod.outlook.com (10.175.83.150) To CY4PR12MB1239.namprd12.prod.outlook.com (10.168.167.14) X-MS-Office365-Filtering-Correlation-Id: fd536914-a364-4df7-2e70-08d44f930b87 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:CY4PR12MB1239; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1239; 3:RJMd9UBr18evtaLPw7ohymnU4vz+RjvPqzcRgojE6ttOwxp+LrOpYyzxq8GGfpeiSw2qd1jMpzWusodqJiw/inB9hsqk6bYelhcoK2C+UavMAZl7xFvXPNGO9kk3BD7A9pVJ9s/UBMybGL//wksQKGcipLgcqYOr0pQAZJDu4G3WAxAEVcnPJ62Wetpq9tO7Wc1Bp8fajLDVW571kK2Rti+itOsDVRMtoUSBi0goRyZkDYFn5jfIVhq1AxSJad2ARDe2nxiSaxFwOwIyUSeS8VBXrjVfeP1FjCrpZkSlVBI=; 25:f579vBu1DuQCcVwtJdrbKN3kNjyolJ0EK9ZaGJUQzjMe48/QMypV4V1O/L8xd4G0+JXg+GcaFgBWBEZx3nX4/YbAZxjOgKHIHTiSi0NTZry4tseBj9aKkIEcXQ+IDIjR6kA/Fj+H1s/XNUPKPBx4VkcU3WE1ef5fmUwUzLj3mq/g+63ACcMYLlfPc1p8LIBbV4KkV/jd/gc8YjX2uuX3XkdYaFlXjWIlRrSGOupBDZ+/VuQkTrI0NMoLoJSmcZx4YwykfYLiHy5YESAJ2arD1nisGE9JQO4/bEU41SDNh1IoG12iLIS3sgIGOIZd4POlqXARQJai1FEUWyUeYD9B95Mwyf6dcAkh7WGQLW0fX3NI2+PcbLkcXMahkTfW+NV1cPeMoakXK4/xOdsXFNNYw714QCJ6T/q3AyQ1ir3+3PEJcZrNsTGS7106Ic4Bzk/F X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1239; 31:L9ViFQazkLKCqUI0v/TnGLMRBLjGIRaqiOiZqU42IWN/zqT4m0lnz4uxzPfdkJAGTmeMJ2pfuQhRSI4uFjBM5SsMtX09wyGV2tgy5YWoZJWnHm1u5X9G9oTtWUXSm4UpYAAKjnsPXuXP/tRfPrBL353ioA4t5Nj0OLV3DGPMJBS8p4ElnDSqbmsWD+NA9nM1rDikPlFqp3O4ZrwgncicXB7y0xicZ5BS3OO9sqDtDLjFa7UYhh0ETh8OKuK66IGaaMDH2Uh6aNQVmpoS1q3Zupq55fsk2Ojx19QRzlK/lKs=; 20:4fEyiTs8qlj8bw9aJJkfzfA0fUo2GzcEhni1Yz8nxyBBl/MIyRB6O+fcO7CEVDrXVES5zW/k/7IpN2q9qZbFpK99u+4UdEM5YG37j8x1NBbmH0MUFzdWBMPMzxnbKc5Pldh93vCqt+7gKv0Hqao+n3JbrOzrrTNzQU0UwzglaX38BrOFCREJUwZbKOlvAKzm1rdSw+oDuT7AjTZWP4VkdkL70CFQPz+wZhfhFH2/kjMRM+s7Bu+wVAnWsv/yV+JHxHdsGBWh+WH0FCpHDtwklzTV/ulBsyv7PdVmyBWHmkwpeTqKFHj8CJHjLkbmd660g9ptt8lIeWWIJ7Yqoq0L+u/cKLUoELWnnvGr0QoGtbODX3D/O1l8T59p/AeHlTfzS39YsmZQyZO+cffnQZwhugACPDNkEMYFd/L37H8ivUlTWTGg6AvQzcckknpQvihKlCyGiFwHsQH9BOG65W1J1sYG0VCdN7Nywx1Cb6VdCD0IwfYsqSOEkH9dySjPofxg 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)(8121501046)(5005006)(2017020603029)(20170203043)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(20161123558025)(20161123555025)(20161123562025)(6072148); SRVR:CY4PR12MB1239; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1239; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1239; 4:Ea4FXhPuTS/26niU3qEWK92qljBa/Jix0M0w22lvplIPLVRb11jPdHV3zfipmQ+MfCxVOoufnr9N413akutyXuRcwDF2/l446WiARGNDW2i9kNFeFG5I0/Y0K5rhDnC6rc0Jxv60r/hZWSNKXonTVgwDAL1Q9lVdNHKfqyI9wF5mI2ZM6LbseuuHQf5+u2KAPdzfe+X99tj2MUMkH6LGGEf7w/upvH5LLSJpFojeoHjubEtpV4dnjLvGidvAy0NUpgHDvnEcqDydLP7rYNI/zW0tW25uLBL0c1dXuAUf2B+hQ+DhUik+nBAM6QH79I1vClW3nCz55HUPxpfim72Z2RTH02f+1A1UFXYEl8TK9ypDnln5QRl4/99IiqJ4wMwtt39pQ7BtFQofLAHnq9HWBx8dLJhchSJLK5IhsOu2DZdw7rUUGFZHX4ldOXpa5aX4KagXH26EH2vbXPbL+71D6Y8BCm9o2iy9Dyl0KhLm3xn59Xfamu16jQeBXGn05Or+JP2R4IEL/tJ6QVvqCg3nlDr4ofFuPUml4YJTk+OhUsk9R6XndHhoX7+Nn/F4LRl04V6OJS+B4kFGpvQnxm1XsLC53RcUn1ILO80zZr9PEluV7fUtNIx8VwVrFE6cp6YMl3ZY7SqqCZpHh0vcNgaKi8lt6u0OJWT6kDz6LClLokDE8Yyb9K7YDYyQb8u8wAFLOlVpi22br5H/jGOkDqz3OXeUcWM6g93gAqurrwq33xr5TTknA1lt/P3/vqMivQsK X-Forefront-PRVS: 0211965D06 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6029001)(6009001)(7916002)(39450400003)(39410400002)(39850400002)(39860400002)(39840400002)(199003)(189002)(47776003)(66066001)(48376002)(36756003)(53416004)(6116002)(50226002)(3846002)(2351001)(42186005)(106356001)(5660300001)(76176999)(50986999)(101416001)(86362001)(2950100002)(6666003)(6916009)(189998001)(6486002)(105586002)(305945005)(7736002)(25786008)(4326007)(97736004)(68736007)(54906002)(8676002)(81166006)(33646002)(53936002)(50466002)(2906002)(81156014)(38730400002)(5003940100001)(110136004)(92566002)(213903007)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1239; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; CY4PR12MB1239; 23:6tdDXTEYnWStXTczNGSiLpqTwDeW+xkaVoMlmVsac?= =?us-ascii?Q?YzNscKZOYif97WwDaTYr/n7fll4JLa/pok63JZiTUH/mRDoXOXduH4bccUwB?= =?us-ascii?Q?MBR3auL4xXD2dGyPAi5N88ZYQ+tOqvfNHVgeoCFbHXRLZhpbyx72oAHSznQc?= =?us-ascii?Q?sVdfqKo816K1JN/l0MeWGy9pOsCwxbqwKjY0b0o8wcQAGtl8WoOAXcwaaftF?= =?us-ascii?Q?zbENkPemVspmQjIEKukDAKfwzolO9a90NW8+B0TPIXj/9kzK5H10bSGVhM+8?= =?us-ascii?Q?gxmQhvpVq78M/y87N+UJk4WV1WJqsBu6KSQv1RwhIOYc+m6/xxq9rfQeMJyt?= =?us-ascii?Q?CGa/QHuYRlHpeoBnQ4yH4XERYJCStnuYf4cm/iFyUfrHMcQGFllh2R9mpq7V?= =?us-ascii?Q?3wmepCHQb+eahP8AqRxzu+dL5xyJTTyo8WvGwKx6hQZzAmzD7m0+Dx4RN5U/?= =?us-ascii?Q?lkz8K4r0ynLbJC1iSRnMb157FwIlk3tvweV+pLnMYmgagW6gspWnBEINVh50?= =?us-ascii?Q?5bescHHoOAQLru8mL6nhIgVHBXMEw60dya+WdnY+ebs1GcM6KHlLrUzS4wMf?= =?us-ascii?Q?51/cTni23H46b+UuH0+jBHBy/rBljszaqYfb42vfdMdeHlK/HGa+YXcKGrtw?= =?us-ascii?Q?PNkH1UayMe6ZmZKEhysApLT8JhHYEA2nFz5yfdNyeYVqeJcEx4aGftGQ0lTb?= =?us-ascii?Q?tudIh8dHyFBFk/Yxnxe7wslBmnR/tuYv8OhF+fO4kWDiXxQPADwZSyV+vjvF?= =?us-ascii?Q?GSlYA1vwdEecPemxBsr7WzTed/a/WFRKvJR6iXkcOkCYuUy2XvJJ4t37kzhr?= =?us-ascii?Q?XGocn6KN9bK1eZZgyFks4V9iyTApplvtzMa4RDmnR89Ajw8hvgmIpDm2t0eE?= =?us-ascii?Q?QoYfELUTMUFR/ixkXLQfgrKyXS+ly2efbmHMvn5kSoCSOgE2RVjqxLy+bHfT?= =?us-ascii?Q?QdbbanJf5jRInFhFzL2mOyH8Zq9e9P3Ho8hkuzPy5zldxPyommmjFmjc5X9f?= =?us-ascii?Q?E+3yIlUqooB5ki+JMGYeu2To2qnTavGhALye1mk9pb4uVJExQBpM17ebTKJv?= =?us-ascii?Q?g1XJeb1E4kc/ogJPtSPRG7Fk7fyVq2G+9tscZKvXyP+gf1mcf3JAx7eZ7isY?= =?us-ascii?Q?CbV+uQJlCI0ZFlall8o4ep6IK4FGjKjr08+kbor5I2FSN1Xepq4sMNYsYYJy?= =?us-ascii?Q?u+3Y+ObIFmNzyHBiHAXYVYBN+ewESPjTnsTN5uGocqC0g/YtN3HT2qPI6jNc?= =?us-ascii?Q?zKQORUW8CAJf7/4nvcy4kZVeQ7E2vWX2FY+IObgcWQfwra1sXIzyvQr6iCcS?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1239; 6:BSekgD2BHPuH9AL5c6uKi3g58QRiPwgPK1OMn3oTtEZyBEk/mOh+oMgkRpRz6ZUakbzNoQr2YC/erzhs0Vi75tw1MmTpcbihVZeVkLZEoS4+RTaomJptOgn2uxh6z3BhmcaDQc5fxqbiAC5oNOfFbFuqxIz2ZT2cbbn2cP0vnLgVMzm18GyvoV8dr29aC5P44PgOeOWzAKRyW+LbmjvgV9EpnJ173EqCwectdZdj335104sP3gY3tfIErsGcyIAk2aPpOTf6e9oS15ycl09msT/P07Rhfjs0G2ChV8YjJPToK6rwDtDEhjJ0y8bBODd4ZmisAOt8Uxavq8m1iKTmqCGId9krnM2D68BYQjdVbftrzNmv1MYiBJxqR3JeNr/od49ds4hH2UArhbVHpDQB4zpqu31Z6MU5k96XfxWd+wc=; 5:vSt5jV+a+i8lI6TtnqiN+4C28SCiQWc/EJ2LROp5QcMexJHBKSWJApue52de00yH+lFqhDNWyhoekhPhMaeX6ZMKpUd2RbzuqO1qo1KApugUOvmlLtLTylC9q7kV+nSP4HbKxBPXz1ty2FA4bDtQaA==; 24:pYStOUrvDDLp5KIPUYunQr76apSE9roczeSGfWsncdq7W3MtWF8IGG2Md8+T3hBiSMHRxRO24dIwHxC2jx5toZSPAaZjg+YiXaL11ViTdJ8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1239; 7:GHL2veNgZ8vqvkWlDmAJdH43x0yhF/nkedRevQQ0/peKK+ITRWJLHTzbMFtrfH0vAiPVI9makwg1pFK29qrJJvUxbGJZUKAMHqsTiNtx0VQSJf7yamToZwzWDY/ttuG5uT6YGKVTiE/f0dZSF437PQhvUHuwWNkuxjeuzBJWu7xDNPyqEnnqZ1rjryvxBTBayi5zg6qD0V5QgZGTCpkdKEZ+a+gmjuE0uy81uEmX00nvA3mkIw4hJFCI9usFPAo8WRMY6cuPytVo2MJgR8I8YrBWuiN1rkU9aKi3J2yRock3vmcuHtZSqRYN4t0bgUSVfmAc+gsXaqy3BO7w20MADe3lwlGS76zzEioACBQ+YO0ZKh5/a60jUtHqkK72Nt1sdBVlGupNsBYT5AMp045HfQrNMQLDI2fJH6DcBvHRCLPG++6X+7qbwLXyDurAgEPkLmm097J0a+hTOCFp6jNzBmddphYFTwF00t3w7MOpekK6xXwIga9YrLU+I//x6jL1DJqH2ieaHaPXgooyBqGADw==; 20:2EbgCiWrwl6RZ2MCD6eJ6bsTPzuVB9dUMzrh1rG7j8nljZlYbSVOxQTE3G/k4NZo5zfwn05KAFgRyrES6M0trP2dNv6MGMRGXKN5FTgShUApATf2Z53A/1qLnJfd5oAApEEOG+oUQ5Aai8Djk99nCcQ4IdlktvH7ola0/WZGHD9z5xcLlCVfTcIQYuOl7gsAclL/NEu06Xiv32MsFs1oDfvfQc4heZJY7jvelI7F/2yWa6N3PDqklnUsLyK/zowq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2017 19:53:53.5315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1239 Subject: [PATCH] MdeModulePkg: Add dynamic 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: Tue, 07 Feb 2017 19:53:55 -0000 Content-Type: text/plain From: Brijesh Singh This dynamic 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..207384f 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 @@ -1738,5 +1740,11 @@ [PcdsDynamic, PcdsDynamicEx] # @Prompt If there is any test key used by the platform. gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed|FALSE|BOOLEAN|0x00030003 + ## This dynamic 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|0x00030004 + [UserExtensions.TianoCore."ExtraFiles"] MdeModulePkgExtra.uni -- 1.9.1