From patchwork Thu Mar 2 15:13:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9600423 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 2E88260414 for ; Thu, 2 Mar 2017 15:30:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB57285A1 for ; Thu, 2 Mar 2017 15:30:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 126E4285BA; Thu, 2 Mar 2017 15:30:23 +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 22366285BE for ; Thu, 2 Mar 2017 15:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753380AbdCBPaT (ORCPT ); Thu, 2 Mar 2017 10:30:19 -0500 Received: from mail-dm3nam03on0072.outbound.protection.outlook.com ([104.47.41.72]:52663 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753134AbdCBPaL (ORCPT ); Thu, 2 Mar 2017 10:30:11 -0500 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=29mXIuU9b4NxKkQgL/ZmDV8EasGRcSjC23ov3vTCTMw=; b=N1sibMqzuiLCaL1LhvreTGluxo4v/QAVdWt3BK7snQq08zgVmSFew7c8h/rFkAOH2X3a6NApAo8m8XpUo9tKlkgc7eRmmgvxBZxvZlUGq3P7lnzob9jT672YFVBXynCMcbJHBvnyn+jE2wfoWmPsuz4QPtDhSafY2PsUcNzqtXc= 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 [127.0.1.1] (165.204.77.1) by CY4PR12MB1607.namprd12.prod.outlook.com (10.172.72.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Thu, 2 Mar 2017 15:14:15 +0000 Subject: [RFC PATCH v2 09/32] x86: Change early_ioremap to early_memremap for BOOT data From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2017 10:13:53 -0500 Message-ID: <148846763334.2349.9327692408737971533.stgit@brijesh-build-machine> In-Reply-To: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> References: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR22CA0050.namprd22.prod.outlook.com (10.171.142.12) To CY4PR12MB1607.namprd12.prod.outlook.com (10.172.72.16) X-MS-Office365-Filtering-Correlation-Id: 757a84d4-fadd-449a-6bfb-08d4617eccfd X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:CY4PR12MB1607; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1607; 3:dltl4W4ajiE6YdSa2kxJpIQr/DexSIYw7sfLeBso/0OsP+a1qabVRRrTjeXkkLwVziirJGmaXfBWM6KLmlDKGl9jFd8fVy1SSz4bdm6pLbyLhCjJOZ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hXBJw9G3xg9ezqhtBEc8Cc74f5uqaoXUYzQLq8pNIvqAPNbJyGf5sdPoid0xGcUT5RbtKnkbWE3qHqkyC9pI3k477bi1Btmo6STEQfFrtgcJLdGBxpSsut5BfckCgcN0G3J0MIxcKeUf8iJgD0thBNDAxf9mAb/1mT0L1tQVHi+3MNjjRBsJS5L8eOMtWMDiI7+mq+pZQUumgfIUjHNEh+nriemwCm5qDLJrTP3yuBRbTov6dzMAlFKivJ8R4ixWhhL4AzcQQIbjQj81YMT2iVHZOnYw9boWcMcg8mbQdxwZF3sSSWeusbUSCdyQunsT7wFZFs5mVh6lIW6dvg68tERk6YEK11doO0Exn2pTB29WCbxqI9IW2Hv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123558025)(20161123564025)(20161123560025)(20161123555025)(6072148); SRVR:CY4PR12MB1607; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1607; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1607; 4:OkvOyh7El2F5efPeInfePDlRhBfYpwWzdGhWDt/cqRws4xC9n9f3Wio7yKzl4KzMicjybJCRPNapzEsB2Y1wdHSX/rKohv+H0Wd/xN7gh9LIDPPAxOOlMkSkY2M8TvVupAOqugqd8PHKaphyOpmWyMB9630BxQ+P2xxpTtNZui56oYfboLmowSJ5nKlhUQ7RTRb/f/+pCD4+8Db5GGYfGNRe0zvzZRe//edHzheLNHJ0mGCp/YLj0k8s3B4W6Ovv8l9AEi48QjDEV+ga6Q4JihlEL0yacpz4prlSGxBnKeVS6kwM43JH34Lw9OXPht3vlVIDMi3RVQc8rO3W85PdtkjADQ93s74CkKD33HIElXB0xyD4aWXM2mizM5RJqRmt/ok1X2zIuFSLYsMpvfXd034Z+WXrGREXRrg7pUe5sJksd8QHkZvDQ+BrSdNsjrScOSmN0Zptk8/c/ICi6Uni/Qm5jOEUGmQnomj0Qb+zemy1jdVmvTWF221H+RXWmazcuYG6fKFZYfpDbX8BkUFRvRyg4tH80+s712FtsSz0tzqhDjuePzcpTrsDpz4+yopoXQYNkO2L2FTW8Bdp3Cy8MC5YHV5HJnHUpvBVQ9pLp9jKr4M60MCJ04hnckenII7fSQcmMa23sJZmQQZ2tZPvXI1i0WXCaa9v+kZj8IxsBcY= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(39410400002)(39840400002)(39850400002)(39860400002)(39450400003)(33716001)(53936002)(7736002)(38730400002)(6486002)(77096006)(25786008)(90366009)(189998001)(1191002)(305945005)(50986999)(76176999)(54356999)(33646002)(2950100002)(5660300001)(6666003)(83506001)(9686003)(6116002)(3846002)(92566002)(2201001)(230700001)(7406005)(86362001)(7366002)(7416002)(50466002)(2906002)(23676002)(42186005)(103116003)(47776003)(81166006)(66066001)(8676002)(921003)(1121003)(2101003)(83996005)(84006005)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1607; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxNjA3OzIzOkJQcTNlY1VPb214TDBBSzBuVlBIdXVMWVNw?= =?utf-8?B?WGE2dlBVMXJpWVVPUk50VHNsUXlhaHJsajdHcGpQSHM5THpFRGJKL05XZHVs?= =?utf-8?B?aWRUNmZoR3F0alZhcUpXc2xLOUpoOXRuMHBlNmJJWExUWnVYU3JybXN5M2lS?= =?utf-8?B?NEIwSFlCZzhZemNNRDVNTjZqeTI4bVpHZmQ1NS94cnErbDlOdklxT1pXZkVO?= =?utf-8?B?dHdCQUlXaTVpYk9BQUU0cDdzbzZibDJjT0VNTWlXYld2M0Zqd0dqYjJOUFFP?= =?utf-8?B?R1VTclVtdm1rNWtpODBH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WdcsXxhOOc=; 5:te7zNvQHJONmi6bTkTJk2fKrKpl1TbqUgSVM2F4KVpBrwKCvxBVZLuw04kSJ3I7LeHSlCq6O8Upm6QEUIp3K0eT6FeUt87ZIdYVlQE3fP7iMqWO5TnREe3990NkwO6IPdXG1VQfL+JGYMzYY5PWfPg==; 24:XTYOv1dENvCyfnCvuerD8Q7jxdlnY/eoQP89sGPfik3qckzPfptkZmuVvbNz6NE+6rjA100ZLoGveFUfmNyVGdT0tqRcWstMHzp2BsTAoDc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1607; 7:+HTGtr2VB4lI1PKMF4BLNR8gCttbETdoJIC4azB5sVyiOqFmohzYP4iKarRFujRqFCv0BJgrmujJ9HUASysql73d3InTb2P2R5rE5FnnU0eWBX9LV8/SxKYn4NNOygn21lcYE5i+VuIJZVxhmYEXuqjGET50vkH0ovl3t3cLZKHt+WRuwPulG1tpi88hy5TRG3zceUkldYKgg7tXj3a93j7nCmZ9gU+Jx5Jw4KMu925UwTRNTNdEKbkt3gPvOPVixClyxRQZdeHhPzJMGa4Vp46z8pBMn0MFlXpE4mQeJoHV3SiB7NKSLMgY5qMpBI+SbAStPpsxa241u/WFSh7dJw==; 20:QCVy/5eLPBTvys+Sy2+8kRsEeprEr1E6Uw0+lgfSHouL+z3vzE3Ngkuu3WXcDMEKE1xhSc1cf1Pt1ujzNbbtsZ1en+zGQvEi4YoC6Xqb7Jqv8gMdqgJt37PBkshhbWErJ/RFRpYnfDipIbb1+MQ6tlpXkM06bSwvCXOm5vUV7KNTIqKOLLMHJ0uz2so5kC7Ums76F0MhWHIoMhan7Jnmgk4YPi0MMMGl6PNRpyhITJKeMY28WhPNPasRKUaLnj7w X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 15:14:15.7609 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1607 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Lendacky In order to map BOOT data with the proper encryption bit, the early_ioremap() function calls are changed to early_memremap() calls. This allows the proper access for both SME and SEV. Signed-off-by: Tom Lendacky --- arch/x86/kernel/acpi/boot.c | 4 ++-- arch/x86/kernel/mpparse.c | 10 +++++----- drivers/sfi/sfi_core.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 35174c6..468c25a 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -124,7 +124,7 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size) if (!phys || !size) return NULL; - return early_ioremap(phys, size); + return early_memremap(phys, size); } void __init __acpi_unmap_table(char *map, unsigned long size) @@ -132,7 +132,7 @@ void __init __acpi_unmap_table(char *map, unsigned long size) if (!map || !size) return; - early_iounmap(map, size); + early_memunmap(map, size); } #ifdef CONFIG_X86_LOCAL_APIC diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 0d904d7..fd37f39 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -436,9 +436,9 @@ static unsigned long __init get_mpc_size(unsigned long physptr) struct mpc_table *mpc; unsigned long size; - mpc = early_ioremap(physptr, PAGE_SIZE); + mpc = early_memremap(physptr, PAGE_SIZE); size = mpc->length; - early_iounmap(mpc, PAGE_SIZE); + early_memunmap(mpc, PAGE_SIZE); apic_printk(APIC_VERBOSE, " mpc: %lx-%lx\n", physptr, physptr + size); return size; @@ -450,7 +450,7 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) unsigned long size; size = get_mpc_size(mpf->physptr); - mpc = early_ioremap(mpf->physptr, size); + mpc = early_memremap(mpf->physptr, size); /* * Read the physical hardware table. Anything here will * override the defaults. @@ -461,10 +461,10 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) #endif pr_err("BIOS bug, MP table errors detected!...\n"); pr_cont("... disabling SMP support. (tell your hw vendor)\n"); - early_iounmap(mpc, size); + early_memunmap(mpc, size); return -1; } - early_iounmap(mpc, size); + early_memunmap(mpc, size); if (early) return -1; diff --git a/drivers/sfi/sfi_core.c b/drivers/sfi/sfi_core.c index 296db7a..d00ae3f 100644 --- a/drivers/sfi/sfi_core.c +++ b/drivers/sfi/sfi_core.c @@ -92,7 +92,7 @@ static struct sfi_table_simple *syst_va __read_mostly; static u32 sfi_use_ioremap __read_mostly; /* - * sfi_un/map_memory calls early_ioremap/iounmap which is a __init function + * sfi_un/map_memory calls early_memremap/memunmap which is a __init function * and introduces section mismatch. So use __ref to make it calm. */ static void __iomem * __ref sfi_map_memory(u64 phys, u32 size) @@ -103,7 +103,7 @@ static void __iomem * __ref sfi_map_memory(u64 phys, u32 size) if (sfi_use_ioremap) return ioremap_cache(phys, size); else - return early_ioremap(phys, size); + return early_memremap(phys, size); } static void __ref sfi_unmap_memory(void __iomem *virt, u32 size) @@ -114,7 +114,7 @@ static void __ref sfi_unmap_memory(void __iomem *virt, u32 size) if (sfi_use_ioremap) iounmap(virt); else - early_iounmap(virt, size); + early_memunmap(virt, size); } static void sfi_print_table_header(unsigned long long pa,