From patchwork Fri Jul 7 13:41:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 9830337 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 C531860352 for ; Fri, 7 Jul 2017 13:42:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB812833E for ; Fri, 7 Jul 2017 13:42:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEB812853B; Fri, 7 Jul 2017 13:42:09 +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=ham 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 C5A932868F for ; Fri, 7 Jul 2017 13:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752991AbdGGNmH (ORCPT ); Fri, 7 Jul 2017 09:42:07 -0400 Received: from mail-by2nam03on0042.outbound.protection.outlook.com ([104.47.42.42]:30784 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752707AbdGGNmA (ORCPT ); Fri, 7 Jul 2017 09:42:00 -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=gfn6shRerTVWvu7a7l6KrsYp8iQxurHZX1V52BIPgy0=; b=SHlmAfHy+uuXh1GhRfbfohqQQuHL5Fd6ngLGkoKH0VRI9/sBHAKS/IdBFw+e3OkA5SZifDJDIMFLObmj2EQVOe8tH+wmQRXjefjksobbKrieNM1KvATUGrm+R1BWryDERSiDoy8hi5s35lYczNfwfYMtakG7JIpe8XX49YuxL74= 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:49 +0000 From: Tom Lendacky Subject: [PATCH v9 20/38] x86, mpparse: Use memremap to map the mpf and mpc data 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:46 -0500 Message-ID: <20170707134146.29711.77830.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: DM5PR12CA0068.namprd12.prod.outlook.com (10.175.83.158) To CY4PR12MB1141.namprd12.prod.outlook.com (10.168.163.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86f91238-1433-4a7e-ae80-08d4c53debbb 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:J2+kpgVij6yQe47a0AooV+MVrU6aTS2f+BcsxFfUYAJE8WCav/798Uu75xwth2Vu/la/U7MxklllwP6Ld0Pf0j+U8Jo/qYEXkXHawf51TacZnnln7mLvzKklAKYVITRXp3SL5RIxEm3tfY1PQgt3K+VsTRGJA72INqxgg8iz2xHW/zLMuzXPFOu/dCjbkauYdE/DznOSqggfrRRn3QEmaoi4lbX/pcV0DC4M8z6AxN0ZgUYWfGQyPuseRtT4yCyW+I+rYXOb/JiwzwzK/VuKdkqkHtfJK1ym/AEDFdaUC22AJNjL3ErJ67RFPRxEo2xsAsi4owaQ9PQnNkKmtOAu24lFm6FFvaGe2QpS3W6xJN8R70Lgk5cNW9o9mZn36/202pJuXFthVW1IIrETcaacW8HoJYgso5L5PhpoZ7iQYPUgya1yGe9gYLanx/ZZtdOS/poN6R2m/JUDuNQbyHwU2bdzAB+YjIskFjmmPGN3dj+bd2yGwY8JGq4PU+32xK8o4oZFG8433kYHdXSl4FgqTCARU4ptT8HPnk2tqAZAm2Qp8YbGzduqRKWgp9BBNr0PhsdPxtYIvVxDeTduiBZTZ53tucORVwAriSBy5Fyu8CSbLJM+Sp9idboqe39217izT8gFyh2SYnovlgAEfDNuxR52DhMJ/B8W0O6/rh+xS0eT74h6ivyNKZn62Aaf9xdOOPaXHjE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im7ku5O+/NHpnHS1STw3NjGjSpD/qQx3iT1mWOVzwtaF3Y3knI5T+yG3eVGfntwW/uhzyeJPuFhcOHimaMuCKCfccXSXnOlQJOIqAc0H5n4GlwfZSpFa02SqiY09iGd7cHTXi1hlqfmBrVYvz8l9pOkPeTJR4mM6HT9fwZAfk7QfRtrcx9s33MAMdGb9F2VLs8sSXnveXhjuyAE5S8awO78E4w1x1/TS7A9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110)(788757137089)(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?MTtDWTRQUjEyTUIxMTQxOzQ6OHdRVFR2ZUJwRlJsUWF5NWN6ZVFGai94RnZX?= =?utf-8?B?RzBIYUthRm5XdFlKc091T2p5VUpzNmErUDhETUpkV1ROc2hGSHFDcWgxZi9M?= =?utf-8?B?SVl4NU5va1ZlYnZFODBUeCtKUVFMNm5Yd0laUC9TYzZ0R1lRRDNsVW1hMmlx?= =?utf-8?B?TWIzbFczQVYyT255MEJoMVM2cXFESTgwV2ZRK3lydVl5c0dWZjRCNzVEWWRC?= =?utf-8?B?d1p1THdBRFpEdlpRMGFjSDh5VDhRWDJhb3VtTVJsUHRxY0NuaTI3SW1Yblp5?= =?utf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RitNOEMx?= =?utf-8?B?RW5STTBkaEIyNFVaVnlXQjZRRG9xVkdEeVV3SndMRlEvVHNjZmtMbmYxOGFn?= =?utf-8?B?aGVaV1JQQUZYWUZ2SE0xZ00zMFJRNEk5Nm9EVFE5Q0hpVytMSUtwUEhmYnhS?= =?utf-8?B?Y21pQ0laNjVaQVpOR3AwVUl0QjEyYk1iOUc3VkVTRi9OcXJ6VitYTHJGaVIv?= =?utf-8?B?bFEwWVZpVzRhMTBYS3E0T095M1B5NTkzNFJsQXJ0WXVNYU9qVm1LZGZQWFEr?= =?utf-8?B?NVVxemFQaDRqWThuMmFyZzZSenhRL2VCZ0VlUXJoNnI4Yllrclpnc1JBZXZs?= =?utf-8?B?QlhpdWJ3MTBnTTE5SGlGMTh2UFlQNmkzSGVUTG51dzNqKzRGTWpNbXE5ZzVu?= =?utf-8?B?aDFZZG5BV0NUbG55ZWpFZzJXU0M1YkwvUVM2eW0rZlpTdnBDK0QrYmpCdnRU?= =?utf-8?B?cGVkaHJkYmhBQkxlc0VDNTE1R0FIdENlcTF5K0hTTFNIUXlUNnVCakV3NCsw?= =?utf-8?B?My9wRzJYUzUrUHY4ZGQ3Nk53dkdmT1BZVXJCb2ZCVzV6SnNEdEZUdDM2djBN?= =?utf-8?B?VTltWnp6M01JaXYrZG1oOWpNUHRFalFFMEJWZmNQS3BDTDVwRU1GeGJlbExG?= =?utf-8?B?U292dEhBb3ljb1laaDkyUHZRZGdwL1RrQUtBVkxNWnNsSGFWcnNOdUl4VitO?= =?utf-8?Q?tIyZESXcCw=3D?= 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)(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?MTtDWTRQUjEyTUIxMTQxOzIzOkJTc3QrY1plaEZMcnRUZFRPQmxFRUlocy84?= =?utf-8?B?U1ZTaUpsemtDWVV0VGx3c1Jkam9NL0FHZ3lOQmoydHl6V0VleUVUU0hJekZF?= =?utf-8?B?UVJ2VUFEb1JhOVIvWnVSNVltV0cyVit2TTJJVUpiSi9kQjJQYWR2WkVhZjNw?= =?utf-8?B?UFp2U2JmWTk1Uzl5TW1IQldsZnhyTEhkcmNPditZd083SWdIaUlLcU9SOFNF?= =?utf-8?B?NjVnSE9WWHFVMUp3UVZQMEtJRGRkMkRQQ1FlU0kwYlFsVG15WitvalRIU2hK?= =?utf-8?B?L3R2M09mbEh4eHFNUVVWNXJqTiswVGRXU3FYcTJBaUdPSmYvT2MxMWxwNStS?= =?utf-8?B?VEIzbUtiMGRFTFJ3aFZ3aDRFVzk0OFRpdTN6Y3hzVXc5aVFBVWVIMmk1QzhH?= =?utf-8?B?amx5MjgrWi9CcmFpK0V5SHFFMTZHYVgrUXN5R2l1S2x5MXF1ait1NDUveWpj?= =?utf-8?B?bUtkWVpPODRuNEZ1UWNXbWRDZ2xNdy96SlJlQ2Y0VmpzU0Z3ZXdZNndUbi9j?= =?utf-8?B?VlpOK2pSMytidCswRTJFbmdHZjZlaVhURmNNL1JoN05HWktIRVl2Ky9BRWhB?= =?utf-8?B?akM4TGJET1VqazBWYjMrUUNaVmVJNWN0bXJlTCsxKy9za0ZlZzNaTktsQmlY?= =?utf-8?B?M2QveHlxRklzOVgrYnhFUGJkdnVRRzhyUnNvNndMbVI3c3loSExWT2s5Zjlp?= =?utf-8?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6gm+YxThaI6LjbCl6p2BpAwi9DxFaZagacrhAjGnTpVxrRN8CdrK0ZVOKhPBY7r5WjUEE8d2OoTHJzKk/QnDsfv4vphVbJ1vKaPO5FKG6bLc0/dvw= X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1141; 20:k6TkmncP5mkaE9hrQixX5crifdjRPvT79+2Is87kYcmjESgiVK4TkYPkqOU5+3vVMU++P0UMmtbLh7PaPycS4bpGDuVTO1CTBxiYYklsZeMGH6AvKZ1Ao+TlFdIL/465aLZrhnbTov8c2AWN01Xe3EdiMzBpy7+7GEVuHyTaMP8MwLkVhG0C4czbwNC9qT57J8r/aOHQpurawRkMrm3/qRjbELmfgNyi7kLJ9Z2hUGnLfjGUW9rWvLthG3wVUxOi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:41:49.1580 (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 The SMP MP-table is built by UEFI and placed in memory in a decrypted state. These tables are accessed using a mix of early_memremap(), early_memunmap(), phys_to_virt() and virt_to_phys(). Change all accesses to use early_memremap()/early_memunmap(). This allows for proper setting of the encryption mask so that the data can be successfully accessed when SME is active. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/kernel/mpparse.c | 98 ++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 28 deletions(-) diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index fd37f39..5cbb317 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -429,7 +429,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) } } -static struct mpf_intel *mpf_found; +static unsigned long mpf_base; static unsigned long __init get_mpc_size(unsigned long physptr) { @@ -451,6 +451,7 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) size = get_mpc_size(mpf->physptr); mpc = early_memremap(mpf->physptr, size); + /* * Read the physical hardware table. Anything here will * override the defaults. @@ -497,12 +498,12 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) */ void __init default_get_smp_config(unsigned int early) { - struct mpf_intel *mpf = mpf_found; + struct mpf_intel *mpf; if (!smp_found_config) return; - if (!mpf) + if (!mpf_base) return; if (acpi_lapic && early) @@ -515,6 +516,12 @@ void __init default_get_smp_config(unsigned int early) if (acpi_lapic && acpi_ioapic) return; + mpf = early_memremap(mpf_base, sizeof(*mpf)); + if (!mpf) { + pr_err("MPTABLE: error mapping MP table\n"); + return; + } + pr_info("Intel MultiProcessor Specification v1.%d\n", mpf->specification); #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) @@ -529,7 +536,7 @@ void __init default_get_smp_config(unsigned int early) /* * Now see if we need to read further. */ - if (mpf->feature1 != 0) { + if (mpf->feature1) { if (early) { /* * local APIC has default address @@ -542,8 +549,10 @@ void __init default_get_smp_config(unsigned int early) construct_default_ISA_mptable(mpf->feature1); } else if (mpf->physptr) { - if (check_physptr(mpf, early)) + if (check_physptr(mpf, early)) { + early_memunmap(mpf, sizeof(*mpf)); return; + } } else BUG(); @@ -552,6 +561,8 @@ void __init default_get_smp_config(unsigned int early) /* * Only use the first configuration found. */ + + early_memunmap(mpf, sizeof(*mpf)); } static void __init smp_reserve_memory(struct mpf_intel *mpf) @@ -561,15 +572,16 @@ static void __init smp_reserve_memory(struct mpf_intel *mpf) static int __init smp_scan_config(unsigned long base, unsigned long length) { - unsigned int *bp = phys_to_virt(base); + unsigned int *bp; struct mpf_intel *mpf; - unsigned long mem; + int ret = 0; apic_printk(APIC_VERBOSE, "Scan for SMP in [mem %#010lx-%#010lx]\n", base, base + length - 1); BUILD_BUG_ON(sizeof(*mpf) != 16); while (length > 0) { + bp = early_memremap(base, length); mpf = (struct mpf_intel *)bp; if ((*bp == SMP_MAGIC_IDENT) && (mpf->length == 1) && @@ -579,24 +591,26 @@ static int __init smp_scan_config(unsigned long base, unsigned long length) #ifdef CONFIG_X86_LOCAL_APIC smp_found_config = 1; #endif - mpf_found = mpf; + mpf_base = base; - pr_info("found SMP MP-table at [mem %#010llx-%#010llx] mapped at [%p]\n", - (unsigned long long) virt_to_phys(mpf), - (unsigned long long) virt_to_phys(mpf) + - sizeof(*mpf) - 1, mpf); + pr_info("found SMP MP-table at [mem %#010lx-%#010lx] mapped at [%p]\n", + base, base + sizeof(*mpf) - 1, mpf); - mem = virt_to_phys(mpf); - memblock_reserve(mem, sizeof(*mpf)); + memblock_reserve(base, sizeof(*mpf)); if (mpf->physptr) smp_reserve_memory(mpf); - return 1; + ret = 1; } - bp += 4; + early_memunmap(bp, length); + + if (ret) + break; + + base += 16; length -= 16; } - return 0; + return ret; } void __init default_find_smp_config(void) @@ -838,29 +852,40 @@ static int __init update_mp_table(void) char oem[10]; struct mpf_intel *mpf; struct mpc_table *mpc, *mpc_new; + unsigned long size; if (!enable_update_mptable) return 0; - mpf = mpf_found; - if (!mpf) + if (!mpf_base) + return 0; + + mpf = early_memremap(mpf_base, sizeof(*mpf)); + if (!mpf) { + pr_err("MPTABLE: mpf early_memremap() failed\n"); return 0; + } /* * Now see if we need to go further. */ - if (mpf->feature1 != 0) - return 0; + if (mpf->feature1) + goto do_unmap_mpf; if (!mpf->physptr) - return 0; + goto do_unmap_mpf; - mpc = phys_to_virt(mpf->physptr); + size = get_mpc_size(mpf->physptr); + mpc = early_memremap(mpf->physptr, size); + if (!mpc) { + pr_err("MPTABLE: mpc early_memremap() failed\n"); + goto do_unmap_mpf; + } if (!smp_check_mpc(mpc, oem, str)) - return 0; + goto do_unmap_mpc; - pr_info("mpf: %llx\n", (u64)virt_to_phys(mpf)); + pr_info("mpf: %llx\n", (u64)mpf_base); pr_info("physptr: %x\n", mpf->physptr); if (mpc_new_phys && mpc->length > mpc_new_length) { @@ -878,21 +903,32 @@ static int __init update_mp_table(void) new = mpf_checksum((unsigned char *)mpc, mpc->length); if (old == new) { pr_info("mpc is readonly, please try alloc_mptable instead\n"); - return 0; + goto do_unmap_mpc; } pr_info("use in-position replacing\n"); } else { + mpc_new = early_memremap(mpc_new_phys, mpc_new_length); + if (!mpc_new) { + pr_err("MPTABLE: new mpc early_memremap() failed\n"); + goto do_unmap_mpc; + } mpf->physptr = mpc_new_phys; - mpc_new = phys_to_virt(mpc_new_phys); memcpy(mpc_new, mpc, mpc->length); + early_memunmap(mpc, size); mpc = mpc_new; + size = mpc_new_length; /* check if we can modify that */ if (mpc_new_phys - mpf->physptr) { struct mpf_intel *mpf_new; /* steal 16 bytes from [0, 1k) */ + mpf_new = early_memremap(0x400 - 16, sizeof(*mpf_new)); + if (!mpf_new) { + pr_err("MPTABLE: new mpf early_memremap() failed\n"); + goto do_unmap_mpc; + } pr_info("mpf new: %x\n", 0x400 - 16); - mpf_new = phys_to_virt(0x400 - 16); memcpy(mpf_new, mpf, 16); + early_memunmap(mpf, sizeof(*mpf)); mpf = mpf_new; mpf->physptr = mpc_new_phys; } @@ -909,6 +945,12 @@ static int __init update_mp_table(void) */ replace_intsrc_all(mpc, mpc_new_phys, mpc_new_length); +do_unmap_mpc: + early_memunmap(mpc, size); + +do_unmap_mpf: + early_memunmap(mpf, sizeof(*mpf)); + return 0; }