From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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; 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 From: Leo Duran To: CC: Leo Duran , Feng Tian , Star Zeng , Laszlo Ersek , Brijesh Singh 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 (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+KBD?= =?us-ascii?Q?obSc0gfHaDWNmOibbFVA4eYmGuEfiFXfcaICt/rp/lFo4bWWSz3gpYpgsYMO?= =?us-ascii?Q?jMG+8Xt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TvY+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: [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: , X-List-Received-Date: Wed, 08 Feb 2017 21:13:28 -0000 Content-Type: text/plain 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/MdeModulePkg/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_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES diff --git a/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf b/MdeModulePkg/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 +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES + [Depex] FALSE 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 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 @@ -187,7 +188,7 @@ Create4GPageTables ( // // Make a PML4 Entry // - PageMapLevel4Entry->Uint64 = (UINT64)(UINTN)PageDirectoryPointerEntry; + PageMapLevel4Entry->Uint64 = (UINT64)(UINTN)PageDirectoryPointerEntry | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask); PageMapLevel4Entry->Bits.ReadWrite = 1; PageMapLevel4Entry->Bits.Present = 1; @@ -198,7 +199,7 @@ Create4GPageTables ( // // 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; @@ -215,7 +216,7 @@ Create4GPageTables ( // // 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; @@ -223,7 +224,7 @@ Create4GPageTables ( // // 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/Universal/CapsulePei/X64/X64Entry.c b/MdeModulePkg/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. 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 = Address | IA32_PG_P | IA32_PG_RW; + *Uplink = Address | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW; PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] = Uplink; PageFaultContext->PageFaultIndex = (PageFaultContext->PageFaultIndex + 1) % EXTRA_PAGE_TABLE_PAGES; @@ -183,7 +185,7 @@ PageFaultHandler ( PTIndex = BitFieldRead64 (PFAddress, 30, 38); // PDPTE if (PageFaultContext->Page1GSupport) { - PageTable[PTIndex] = (PFAddress & ~((1ull << 30) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; + PageTable[PTIndex] = (PFAddress & ~((1ull << 30) - 1)) | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; } else { if ((PageTable[PTIndex] & IA32_PG_P) == 0) { AcquirePage (PageFaultContext, &PageTable[PTIndex]); @@ -191,7 +193,7 @@ PageFaultHandler ( PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & PhyMask); PTIndex = BitFieldRead64 (PFAddress, 21, 29); // PD - PageTable[PTIndex] = (PFAddress & ~((1ull << 21) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; + PageTable[PTIndex] = (PFAddress & ~((1ull << 21) - 1)) | PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS; } return NULL; @@ -298,4 +300,4 @@ _ModuleEntryPoint ( // ASSERT (FALSE); return EFI_SUCCESS; -} \ No newline at end of file +} -- 1.9.1