From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::62b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B8D2180369 for ; Tue, 14 Mar 2017 14:12:44 -0700 (PDT) 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=zn5dCJluMQHrXeiWUJYYPXF5zJylZtN55DwsfaqZ2es=; b=ovSE6MeZ97JLUIf6pPqXt4F0hEm5ifiFwUniayXR1oaU/t0pgzkiAqn9Fiswqr5KWeGbZu+gRQyl/3x1ZUn1QTn4vEX5vY5eT2IdA5LV8IBaKqLhY7nAFHJBc1NKrsXkM2Dy2755Sy/EgckmWadjOqorcX9X9zljrRDgU0Ut2sI= Authentication-Results: ml01.01.org; dkim=none (message not signed) header.d=none;ml01.01.org; dmarc=none action=none header.from=amd.com; Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.77.1) by BN6PR12MB1234.namprd12.prod.outlook.com (10.168.227.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Tue, 14 Mar 2017 21:12:43 +0000 From: Leo Duran To: CC: Leo Duran , Jeff Fan , Feng Tian , Star Zeng , Laszlo Ersek , Brijesh Singh Date: Tue, 14 Mar 2017 16:12:34 -0500 Message-ID: <1489525954-30988-2-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489525954-30988-1-git-send-email-leo.duran@amd.com> References: <1489525954-30988-1-git-send-email-leo.duran@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0038.namprd17.prod.outlook.com (10.175.189.24) To BN6PR12MB1234.namprd12.prod.outlook.com (10.168.227.20) X-MS-Office365-Filtering-Correlation-Id: ed8dc177-473a-4cb6-2553-08d46b1edb2f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:BN6PR12MB1234; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 3:kl5XoQ/AU8UrMlryHRSEH+QhoMTy2Q6IzCOfSwkJF5u6gWkJbMcVmW3jfHmf0nH8PiNnAT6TFOFgcvP8bvVuTKH7SnNajXRbfG7KICh9wA+QL/V+JAg+rR9i3I5tI7kRzIp1EhahpGD66a7ssJMcyK3iLGR61Qq7PjyW8z4tn1PK+Pktq9s07F4eXOFrpTt8OXoXvwTj8x9l9QaouLUTlwySEj6Q4h5Z2Nv+KH3/EDl4SVULi1HTyNQvMrYNv2xyu/jkMgxtki+WJBZgqs8PgVlV1RGLyKLJL65aaCyC7l8=; 25:iN/VpJTODrWQEzzEjyDF421kDv727K4LKM9MkRRklH1RNWzJFcslfuOgfjOpsnJv/8CZRqWPPfVbf2XDGYdyU1liQy3B436bJC4ovdLZwCi0VWy4dsLr5i5qpkP8Ek6Njox3X3YtJkMX5HAQQynaI3YVRiUhn6SjhPEfUe17jfnPtzqGnxYA/DMD7kXSd5TYKGxe4syzsmbKyEyGXLV2pjKRjz3LLWrBNrNpP/GV8gI0/SaKil/rgqAgHrj6tFuijPaH5Pk0yNoD6zPGG711ZlsB/7vVVO3hcAdyZL8I1OOqyMLlTvP5fikYC42A0qIn9Vt7DBKIqEhjEFJT1C3T/8BltHj6NuNXdikDPBYf68g2QRfWl8QaCohsYfniQZKuIpjHZzHSEsevukrzRtRaptbbWcl9ipNYg9pAg46mTTZLA8P7wiYPCbFo3EJpTpoe3wTfTiRH7KjmPQkmzOMK1w== X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 31:B6YQIkQjlVFMYJYxR2i0OVaqSY4HzrUWeDo3jKoO4kwTSospULNSTxNT1lA+Um7sR/VId1LGByKZ2VwfHV6sovsTkVeS2wjN75dP7vKsBaU6zwW2gOvQPc1MNxB63NLSwqMyz7FS23+jyhc7wr5SWyUVtiH9BJUZsA6V1yokFyQHtqfVntm+xwmZWzJenOqTimgGJI4KoBX7D2aTPva+VGtDlMAwq1JRTF9kw3uAwFk=; 20:LGAu84xypXfAOO7SEcREss1je2qf/KwfIcoZ2LBgWfOmUZM9WmXeYSkBeEBDHfVY8ZVtkj2ZPXIMwk/k7O5CIJRUjNBPBv/i5A08HOmcC3Pd7+kOs+sI8EgpLtQw+I+cgRBHNPuHi3W4+Kqpe6y/2glEMRRC99j5O6Uh8239rOq/+na2FywCSrL+ryCmQfNMKAgJir2HXvKLgMzRMK78pD1mL+6M4Gvt9HliYC+9/a8W2Mv8qdnykpE0+cI3v/+46PgohUgrjL1XtDlZqQwnqav+m1PUbPXccbTrgfadRo7blnd0dY0jZHCxuquBPHzrW1bNLAMGnocTv2XtqsUXgCcWSfeMYSjH8AqGn6xMCT4Q5goeH9byPHhC1AgbVmlAbXR43wKhnOoDh3yuMErOITQv6xmQ003Bbll4KFA6X1Zwap4eaMmyOb8ywkm0WKzur5pAUT65eaewVDJDSzNhBHTG5ep+N1Di4G7Pc8tvpIAOSP8yRxYLigrk9ljmzhvy 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)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123558025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:BN6PR12MB1234; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1234; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 4:54XjVuaUl3Ou91JluHUVoSGpCvYtdpgMO7M31y68qAtqdN0IJHaB35k2zvH/awmzF4uNuH4kBVlWXAykOWWKEncuRqOHmIVNnhoG1q5hBz3Oraruovm2Z6oHpsRwMx200lsCgghKqDbKcmwHjRFxudorKntbTwHVRulG/r5N7H5WLUwhfljBEdBP9OEoY2gfx+RWwh1oQegk3orJEb4XowVHW6pHxlPJq1fgrJTSim1E6L5HcY6Ld8QYLy9WATte2MU0OE4nfNyg9reaAjLokU7rEFujTppehc9Czi2c3lJ5rxBk6sVDfUUujD1HDSZZVHCM7vi70rY59/uvFbBjAZGSvcUNJuQahC1fr0a4Yn2Lxc7fa6yTw9Jck4gN1QleA9nC4ZE1DCczAUh5dWUZGR+2aYjEXEwcCz/sXSBUac2pmQIPitDPf2xwrFohlgNFXVD/AY3WXz81Xe7OW3DN4UYNWnbMZLHd3vRYI5AUIwAgkROn4IxXJM2vJFEBIbQ1unytO6oiGDP6fncNHakGi8yHkwRg70Zj3g68gTioTS232cJ/kOk98lBPCwGjMLNQV3K39i4oGs3/S06m6DoBa3CB+lKCX4qlPGOxc1eGJyz/dJUjxIu/5G4ItdPFDk608hr93Dl1g+N0srnne/OHDZW1Lmer9kWdVRvn4QjUmppR9fzfvSRnmboeVHWLwDngqGA0mZwaQiq5Jr+KmnuDVw== X-Forefront-PRVS: 02462830BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(39850400002)(39410400002)(39450400003)(39840400002)(3846002)(2906002)(6116002)(48376002)(50466002)(6486002)(2950100002)(81166006)(8676002)(50226002)(25786008)(7736002)(189998001)(6916009)(54906002)(305945005)(76176999)(50986999)(86362001)(2351001)(33646002)(36756003)(5003940100001)(110136004)(6666003)(53936002)(5660300001)(47776003)(4326008)(53416004)(42186005)(66066001)(38730400002)(213903007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1234; H:leduran-Precision-WorkStation-T5400.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1234; 23:tnFgIToXbh/p+w2dc9IC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zAg60khzm1T2Z2KL6B1aIHuRGSD3MVgJw/BJGd?= =?us-ascii?Q?hCmiKEf00D+lFbpAhDjHQHtZjMY12JS8y9fLqDcKTf/bf32buE8LpNhSPgh4?= =?us-ascii?Q?1FcpYe12wtpT6MlLFrSfn27Ko8LY9BOzg9X9FuYq9NKZg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 6:l79pem9sg57UnfYCwLPpH/cPWg+gCKrR1vFyuGETMwiBKloklhu4wMseqk2kwiKvgmh0wPNwQzS3M9e0bJjZ+wskbiqwT/knUghwZ21KNpTmwqwZL8YT60lbYAX4GsMSHTWNAiDIpZhlafPGp04Ti4VC6OLEA2zmNIGrlnc+MlnhB4+uMZKiGOgS/OnDSJaHavZXuPnal+Gfpk2FusQ5RLU88toDtDQVpZIpHQoasLma6c9XxoV7pwT6IfvJPe0QP0Kv9N5TRuArp+oFBA1LGoxgz564JqscYnYkfq5Lc20Oub6jjatlQkwHdxXBrVSO8tgMBxgV4k/tW1OadBx7hoKL62UOj4t6LPOXbhAjknub7PTO+Zd9bBtsNHgJzSVvnIvlwtDjPCO5Ns+wfCOHiHjz2mEDvMq8Dny06KnCI3Y=; 5:/wgYDG+587B12VZkljuQT0CC4kLg0rA0NbMpN/C51+kVhM4ZB0QJx3nFCucUz77DSqSixSBSpkS9mMy1dR2QMFeXcAtHaLEdtOlWW0NDCxcW64ypQAE5Q+Turu2str+X+ZLODkpy08h+YQ/4tddkgA==; 24:3MwWshZvH71e+THmM2w8afx3wIX69uJqttmFA6ZB3wYgkQLEZDsxlG/UbTlngDJ402gkCr8uWYYK5w2WNmsp09BdwmE/UPTgWTAWYjqjPNA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1234; 7:qRy4Fa3d1Jvb8df8MHKUT8bYZcgkBn7gZEw+f4YIlJkRWYKZMWOXChXe7lirV/KZ2OgDWhM4gJNdSYN+q56IGKaOhuJlUNu7q2CMVbrXqqNOLlWLCU5XXEvW2I71LeWZe8dJarUQEMr7UVHhxNOdk1dYDjys/bMRgR/xTf4DghJmiwUoSdfMZ5EGnFZP+RVoP4RZ/XrmneQj5YmHZpa6F2UjoVm2O8hap5o4g1tIkNIzRh/Sks00BqvnfnXbx/19erKaltRwe4V4afkKE8q7G+mewzst+lsf9JlfnP9g9yQdppw6aDqDe3kMV6Z6Es2r2NKxS3HZV4n5RNJobv8fhw==; 20:9cbQuW8J37l5CNVeCCG5AJo5ywXAe0CFiCNTY7+c3KK6+cZ1nPsR+fOoMioYtxHnQ+lI7lO4hBbCC3DBEb8RM9M31on0Y1cJ3dfPbmI5lqnU7/4qbPIhjSHBVS+pNxBEloy2ux98ZvRBdh0YzPgQ49zrtbmk2tUd8fuvelViezw34kwx9Bx6QXW3CE0a75nqIiV4m5O3HToo+ZWCeeWAlwTfkIh7/J2GYziaMcZBAcgHPPj7InFgD+gqCox6FKNE X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2017 21:12:43.2510 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1234 Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Bug-Fix for supporting 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, 14 Mar 2017 21:12:45 -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 page tables entries are created or modified. This patch removes the SEV mask on addresses from page-table entries. CC: Jeff Fan Cc: Feng Tian Cc: Star Zeng Cc: Laszlo Ersek Cc: Brijesh Singh Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran --- UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index a535389..cb415d3 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1,6 +1,8 @@ /** @file Copyright (c) 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 @@ -302,7 +304,7 @@ SplitPage ( if (NewPageEntry == NULL) { return RETURN_OUT_OF_RESOURCES; } - BaseAddress = *PageEntry & PAGING_2M_ADDRESS_MASK_64; + BaseAddress = *PageEntry & ~mAddressEncMask & PAGING_2M_ADDRESS_MASK_64; for (Index = 0; Index < SIZE_4KB / sizeof(UINT64); Index++) { NewPageEntry[Index] = (BaseAddress + SIZE_4KB * Index) | mAddressEncMask | ((*PageEntry) & PAGE_PROGATE_BITS); } @@ -323,7 +325,7 @@ SplitPage ( if (NewPageEntry == NULL) { return RETURN_OUT_OF_RESOURCES; } - BaseAddress = *PageEntry & PAGING_1G_ADDRESS_MASK_64; + BaseAddress = *PageEntry & ~mAddressEncMask & PAGING_1G_ADDRESS_MASK_64; for (Index = 0; Index < SIZE_4KB / sizeof(UINT64); Index++) { NewPageEntry[Index] = (BaseAddress + SIZE_2MB * Index) | mAddressEncMask | IA32_PG_PS | ((*PageEntry) & PAGE_PROGATE_BITS); } -- 2.7.4