From patchwork Fri Jul 7 13:41:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9830335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A8CA60352 for ; Fri, 7 Jul 2017 13:42:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1109128564 for ; Fri, 7 Jul 2017 13:42:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0572728683; Fri, 7 Jul 2017 13:42:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C51828697 for ; Fri, 7 Jul 2017 13:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbdGGNlk (ORCPT ); Fri, 7 Jul 2017 09:41:40 -0400 Received: from mail-by2nam03on0049.outbound.protection.outlook.com ([104.47.42.49]:44576 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752921AbdGGNlb (ORCPT ); Fri, 7 Jul 2017 09:41:31 -0400 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=OqZ94pG0MVlz+MPUAth3J5xX58Y7/VA2nt9nth04rGA=; b=DzyLs8zVQyRE0Ht4vKH7uteMPSdxvLq9RAzIZ1z+yZKQg6a4cMENnvc7//S+o35DSLLazNmo6vVvFOrMOOr2hUI8ygYFVJOFcOxsapzhQsnBsdjK6AYYpj7XffhSO4CXfQk/xw/H+xLe177p6qGL9mH8VtYPdYuP6mI8iEFTpfQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from tlendack-t1.amdoffice.net (165.204.77.1) by CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.11; Fri, 7 Jul 2017 13:41:25 +0000 From: Tom Lendacky Subject: [PATCH v9 18/38] x86/efi: Update EFI pagetable creation to work with SME To: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, xen-devel@lists.xen.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Brijesh Singh , Toshimitsu Kani , Radim =?utf-8?b?S3LEjW3DocWZ?= , Matt Fleming , Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , Jonathan Corbet , Joerg Roedel , "Michael S. Tsirkin" , Ingo Molnar , Andrey Ryabinin , Dave Young , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Borislav Petkov , Andy Lutomirski , Boris Ostrovsky , Dmitry Vyukov , Juergen Gross , Thomas Gleixner , Paolo Bonzini Date: Fri, 07 Jul 2017 08:41:22 -0500 Message-ID: <20170707134122.29711.68794.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> References: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR12CA0056.namprd12.prod.outlook.com (10.175.83.146) To CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 075b864d-4c5d-4d36-11c7-08d4c53dddd4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1141; 3:IxMu6w/iJcxIunx4vwwlpORnrZ9nh2HbSx3SIcQ25FgZXpt02EfzWwufe6lUyrJ0WFWNI52+PzGrfmH3NWbE6L29mNXjaZuxKcgx1eBZ9+CaHvqzpM0xBIX8YT8Uj9m5uIo0Vy3GrB5KH1E9w1+oe2tUSx3p7b7jN153E1f4RvpPIS5ZObZwYkffW2z3Ku1cRQFh6lf8K50OO8JlaqO1OSC2K/ElNozV+P4Ny4PQChDQBDX2hNGNUaoCOlWczR5D0AW4yEiTpMNZNHEn3MVx2PSmd9M/bJ2NCcC85eWDSM4o3OH4u2kloHLY1YG5LOJnSOO2qz7oxJaohh/z1UqjDCo/iKaIX58j8Llv8r+ai6OQpP8JReXYL1MOwZsZDACIxZfqgkVAltAVvZd3RlwT5siS4vSzXbhDvV1Y9K8GF/qUG4hZqzbxzhUnckjXBFyuCjncGDoa9V/eIUa/vOqxVWafaZV1Fe9S7ehak+DxahIKemnCVgucec5WW+Hu6cEfpC1PlSqBZv3BtQozuPFhESWfnF6jS8LBMKbYWDF9VM8ZMSlPBsReEvS9eWWuOucAdt2xxc9sjH9kmOfaYcWWOLuL6zYMATPN1pvNlQqUfFoU/5mqqMC7bpOG2YMMuywAXeZlWIbjw8V2FwyvQEKmZewcw8CbCgfooPMdG7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tOud5IRNL3kCkd3oGUQeHaKvbFcMjjGs/IxLkJGZOX500f3pPGyGRlyEhoGb0lpub1EVVwQhnasXIXJgGbQfx1kfyNG3f0MpttXfjZwrdj3kytzm86PA7hmpRbVDVDXWaWzNHH7SpBzyImHNSYF0Kk3UQU2NnQ8GIiBiBPR5sCJbaaKHmPmsXmIhIosHJ58Q4Yr4/Y6TiUSXzpt90ktd/BF7wPoQUqR7aVyazhHLF3rbCgMNCh6gfqYTF3jJZYR6t/dX+rdR2uEqOe+5y8FgUitTVU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110)(148574349560750)(167848164394848); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(2017060910064)(5005006)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123558100)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR12MB1141; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR12MB1141; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzQ6N1kxKzQwRzV3eE94VGV0OXVjZUxmVnZYNVlN?= =?utf-8?B?N3Y3b2V3cC9Bd0czYkMrbldZSmR4V1B1VU4wTzNFckhHQXUweDMwYzQxZFVx?= =?utf-8?B?dDRiOENhVzk3VHVtQXNzcUVSN0xYYWtuQjZXMXFxVDViSGJzRnFVK2ZHRmZO?= =?utf-8?B?RWFWUDZvWWQyOWxOOHl0a0dFY3NpZm1kQzdYV0FiZ3NXdnhaajNkbjM3ZkFU?= =?utf-8?B?VGlyOUhv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f-8?B?UkR6bnBiQ3BiL0NScnpKSVBtUmdqeEVKQmZFMUd1OFNFZkQrbVgyYnFXQ1Rs?= =?utf-8?B?cTJKdlFrV3UyelloaGtjZ0QxMk9URHcyWHlrYkYyVndGR013TGd0Q3hOSmpT?= =?utf-8?B?YmE0SHFybXJUd1hRem9XcTFUSUdENGRFR29GWVIyTm8rd2c4WDBoa0krckU1?= =?utf-8?B?bURPRDVSbmFKYk43UFJsUXRIcHdwU1lQOHpxR2w2UElyeFNYQWRPbTBSdis0?= =?utf-8?B?UHR4RlBGWnBva2pKYm0zQU9YUGlBNXgxWmZyWXZtTjVlUHlidm1za0huVXBo?= =?utf-8?B?T0t5Mm1GN216UDRFaHBTLzRyNUV4TTVVL1hHVnJFU2hUL2sxamZLbThCVHQv?= =?utf-8?B?UVJkYzFJMUplN3NwQnRNWTJxOWhRQjFacE4wTmV6WnlZZ1c1RmR3V0dmSzZP?= =?utf-8?B?SDQ5bkFLbG1YVHpTREZCOGpWRkQ2TDgvdm56YnNGY3lzRXRxS1duaUVUMHdv?= =?utf-8?B?YjhKTU1Ja1c1WEhiUmFNemtKbHN2U1hHcmlabU9mRnlITHh3TGtHME1VdXBt?= =?utf-8?B?NXlhOXZQVkdmMnVQMGRMT1YwY2Y3dWpQRGliL2g3d3A2U1ZBVVhnK1AvYldB?= =?utf-8?B?N3MxZmwvVjlpV2VtaUthdE9POTZmSWJKSEdBd1MzSTl1OENXcTNvY2hXZ0pP?= =?utf-8?Q?2y2qQnGkmcPc?= X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39860400002)(39450400003)(39850400002)(39400400002)(39410400002)(5660300001)(50466002)(23676002)(230700001)(305945005)(7406005)(66066001)(81166006)(7736002)(478600001)(8676002)(15650500001)(2906002)(47776003)(7416002)(83506001)(97746001)(53416004)(6666003)(54356999)(2950100002)(42186005)(103116003)(4326008)(6116002)(6506006)(25786009)(55016002)(1076002)(50986999)(189998001)(3846002)(54906002)(86362001)(72206003)(9686003)(33646002)(53936002)(76176999)(38730400002)(110136004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1141; H:tlendack-t1.amdoffice.net; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzIzOnROczFmMk91dyt1OVFSR1VucFgvdzZsSms0?= =?utf-8?B?VDBrR3BQdmNYR1ErTFFkQmRZcDB0azhleTNwbzhrSDlhWkt5Z0RrOUJUWFNr?= =?utf-8?B?NG1rOTMrRTFhSFNmVmNpRlk0d2taOTFQbENSczhuQVpzOFNUV2hRc2Z0US9T?= =?utf-8?B?SUovRWdRM3hNRHZDT3Q0RURjS0RqQkFicm9PUlVHUk5pNGJWbGhjY2pWRnF2?= =?utf-8?B?cndId1NvUG5wb2tnazhuaThTMk1qMVV4Rk5JbFI0YWdDTG82Q0M1WGRPWEVL?= =?utf-8?B?N3NMZlFVTEoyZWVrN0Z3K0RvWUIrODhRWHp4Y1FaTjlNMW5ZVThhbG1pM1Vx?= =?utf-8?B?ZlM1TXlsQnJzSEczMEgxMzE5ZHEvR25MYWozcEtrdGlXWGZrY0E0VGpyQk5I?= =?utf-8?B?MndCN3M5aHBlRURMcjVyd0lyYzFGMDBKWGJ2Yjg0RHJ4Z2VmcnRKeEN6UnQy?= =?utf-8?B?MVcrNysyb2plU2hIWktSWlRkakg0WEZUa25GWWR4YmVQWjJ3emRlN0ZjUVhG?= =?utf-8?B?a0JKd3N5N0ozNVYvdmg5dVRuUkF0RGVMNDhzdmtOcDhPMlNaZDc3L0Q3MU1Z?= =?utf-8?B?OEMxZnJOU3dobEs1djVjNXJnM2t6UWVLcFBKSUlOT25nWWFRVFpXRTU2RERZ?= =?utf-8?B?MzNMOUZaSUJzVHA5MEdLUTlpMFVSRlBGZ0lQYnFqVTZWY09hWmVOQTU2MlQy?= =?utf-8?B?cms3aTh5Rn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oVcrThxS2QAUmje/1TC015mYE2n4MOZC0eOnA52aa8ZAvcYBjfNxLx07mq/0U2zTcY8LxD75NeeW40iAqQ6yZVYbULBi7sRfx6wbMFgjHnfxmkdsRrNCKfiJEatDu8TV3lgQtp8ILVG/tDbqjDt24G7nLR/o7J30pCSS05KVc= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1141; 20:X4Vickv7tpep381P/Nvulj9Z6O/Mmo1Z2ustfEDJeh6G6+srbtc8yJrEFw4CRZdQ9Y2N7i2I8IIXwr6GKj00NIZhe0wATQsml7NuW6kEpHqmpuR9vlOhkJ25/1b3K/XHdq9YZ6Q/vCPLHO8X2WA1XXwEr2EYTZzL6zDxdon2KL8YqKNXAlOjBpnwsO8EuZ9drU/uVKj02fLhzC+6Pn1WPa6zrbQOJBHTbDg8wi7Rb50wn15xLIwMpfeQrlW2gLZV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:41:25.8297 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1141 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When SME is active, pagetable entries created for EFI need to have the encryption mask set as necessary. When the new pagetable pages are allocated they are mapped encrypted. So, update the efi_pgt value that will be used in cr3 to include the encryption mask so that the PGD table can be read successfully. The pagetable mapping as well as the kernel are also added to the pagetable mapping as encrypted. All other EFI mappings are mapped decrypted (tables, etc.). Reviewed-by: Matt Fleming Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/platform/efi/efi_64.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 9bf72f5..12e8388 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -327,7 +327,7 @@ void efi_sync_low_kernel_mappings(void) int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) { - unsigned long pfn, text; + unsigned long pfn, text, pf; struct page *page; unsigned npages; pgd_t *pgd; @@ -335,7 +335,12 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) if (efi_enabled(EFI_OLD_MEMMAP)) return 0; - efi_scratch.efi_pgt = (pgd_t *)__pa(efi_pgd); + /* + * Since the PGD is encrypted, set the encryption mask so that when + * this value is loaded into cr3 the PGD will be decrypted during + * the pagetable walk. + */ + efi_scratch.efi_pgt = (pgd_t *)__sme_pa(efi_pgd); pgd = efi_pgd; /* @@ -345,7 +350,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) * phys_efi_set_virtual_address_map(). */ pfn = pa_memmap >> PAGE_SHIFT; - if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, _PAGE_NX | _PAGE_RW)) { + pf = _PAGE_NX | _PAGE_RW | _PAGE_ENC; + if (kernel_map_pages_in_pgd(pgd, pfn, pa_memmap, num_pages, pf)) { pr_err("Error ident-mapping new memmap (0x%lx)!\n", pa_memmap); return 1; } @@ -388,7 +394,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) text = __pa(_text); pfn = text >> PAGE_SHIFT; - if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, _PAGE_RW)) { + pf = _PAGE_RW | _PAGE_ENC; + if (kernel_map_pages_in_pgd(pgd, pfn, text, npages, pf)) { pr_err("Failed to map kernel text 1:1\n"); return 1; }