From patchwork Tue Nov 18 12:57:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 41021 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C811241C9 for ; Tue, 18 Nov 2014 13:01:32 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id x13sf12656737wgg.5 for ; Tue, 18 Nov 2014 05:01:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=LmjQuPf+ZrXS4SojAvi6cU9UeIuculzNxHUYFg2jeKk=; b=PtP0CKqwjFCyQyiIHIH/6bkszkw8rcgNl0wCfhbnJYq1nO9XGYIwY8xJqr/3r6WrWe 7HuCh/8KPv0ty76+ZCjwQ+QjQ2AqfQIW2JJMc7YV0LDj+1YOOSxjXK3abXvVjmr1toJ6 gBv+Rl123LaE7p7D2e8JONDwPCZHwM2b+yszFMjMKTUoYtdEgzmWIV2NMiVA5Mf20X9m /l5a1LIQHeIiV8bQY2MabTIy2x5EFI0mEsqWRzAJaQvnWEMsyNW8JoJ3zgQUE8QRUOl9 6K0vvrrH0uiJTM4Mcy4sGurzn6h2LVVr1hew1BhaFQtycre00rdHMent1lW/XS92oUIa SNEw== X-Gm-Message-State: ALoCoQlmIznu+ayPkHXArlWxFaNHLnGssoZohbLivlZ1NuxF52X5jSu8h4vRtJjHoBQIGHFy0Kit X-Received: by 10.112.119.194 with SMTP id kw2mr324997lbb.16.1416315691661; Tue, 18 Nov 2014 05:01:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.36 with SMTP id cr4ls1317064lad.41.gmail; Tue, 18 Nov 2014 05:01:31 -0800 (PST) X-Received: by 10.112.225.225 with SMTP id rn1mr1993547lbc.98.1416315691424; Tue, 18 Nov 2014 05:01:31 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id ol9si29811016lbb.2.2014.11.18.05.01.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:01:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id gm9so3420552lab.18 for ; Tue, 18 Nov 2014 05:01:31 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr35557364lbc.66.1416315691289; Tue, 18 Nov 2014 05:01:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp1323147lbc; Tue, 18 Nov 2014 05:01:30 -0800 (PST) X-Received: by 10.66.246.196 with SMTP id xy4mr37679607pac.29.1416315689349; Tue, 18 Nov 2014 05:01:29 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ns10si37912507pbc.139.2014.11.18.05.01.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 05:01:29 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqiNl-0003o6-LO; Tue, 18 Nov 2014 12:59:45 +0000 Received: from mail-wi0-f169.google.com ([209.85.212.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqiLx-0002UT-AU for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 12:57:54 +0000 Received: by mail-wi0-f169.google.com with SMTP id r20so5523457wiv.0 for ; Tue, 18 Nov 2014 04:57:31 -0800 (PST) X-Received: by 10.180.109.45 with SMTP id hp13mr22290372wib.4.1416315451041; Tue, 18 Nov 2014 04:57:31 -0800 (PST) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id cz3sm55726799wjb.23.2014.11.18.04.57.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 04:57:30 -0800 (PST) From: Ard Biesheuvel To: leif.lindholm@linaro.org, roy.franz@linaro.org, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, msalter@redhat.com, dyoung@redhat.com, linux-efi@vger.kernel.org, matt.fleming@intel.com, will.deacon@arm.com, catalin.marinas@arm.com, grant.likely@linaro.org, geoff.levand@linaro.org Subject: [PATCH v3 09/13] arm64/efi: remove idmap manipulations from UEFI code Date: Tue, 18 Nov 2014 13:57:08 +0100 Message-Id: <1416315432-8534-10-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416315432-8534-1-git-send-email-ard.biesheuvel@linaro.org> References: <1416315432-8534-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_045753_538398_D8671AE2 X-CRM114-Status: GOOD ( 12.44 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.169 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Now that we have moved the call to SetVirtualAddressMap() to the stub, UEFI has no use for the ID map, so we can drop the code that installs ID mappings for UEFI memory regions. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/efi.h | 2 -- arch/arm64/include/asm/mmu.h | 2 -- arch/arm64/kernel/efi.c | 30 ------------------------------ arch/arm64/kernel/setup.c | 1 - arch/arm64/mm/mmu.c | 12 ------------ 5 files changed, 47 deletions(-) diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index e2cea16f3bd7..5420ad5a4c63 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -6,10 +6,8 @@ #ifdef CONFIG_EFI extern void efi_init(void); -extern void efi_idmap_init(void); #else #define efi_init() -#define efi_idmap_init() #endif #define efi_call_virt(f, ...) \ diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 5fd40c43be80..3d311761e3c2 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -31,8 +31,6 @@ extern void paging_init(void); extern void setup_mm_for_reboot(void); extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt); extern void init_mem_pgprot(void); -/* create an identity mapping for memory (or io if map_io is true) */ -extern void create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io); extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, unsigned long virt, phys_addr_t size, pgprot_t prot); diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 9f05b4fe9fd5..a48a2f9ab669 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -47,27 +47,6 @@ static int __init is_normal_ram(efi_memory_desc_t *md) return 0; } -static void __init efi_setup_idmap(void) -{ - struct memblock_region *r; - efi_memory_desc_t *md; - u64 paddr, npages, size; - - for_each_memblock(memory, r) - create_id_mapping(r->base, r->size, 0); - - /* map runtime io spaces */ - for_each_efi_memory_desc(&memmap, md) { - if (!(md->attribute & EFI_MEMORY_RUNTIME) || is_normal_ram(md)) - continue; - paddr = md->phys_addr; - npages = md->num_pages; - memrange_efi_to_native(&paddr, &npages); - size = npages << PAGE_SHIFT; - create_id_mapping(paddr, size, 1); - } -} - static int __init uefi_init(void) { efi_char16_t *c16; @@ -207,15 +186,6 @@ void __init efi_init(void) reserve_regions(); } -void __init efi_idmap_init(void) -{ - if (!efi_enabled(EFI_BOOT)) - return; - - /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ - efi_setup_idmap(); -} - static int __init arm64_enter_virtual_mode(void) { u64 mapsize; diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index ac19b2d6a3fc..a6028490a28f 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -392,7 +392,6 @@ void __init setup_arch(char **cmdline_p) paging_init(); request_standard_resources(); - efi_idmap_init(); efi_virtmap_init(); unflatten_device_tree(); diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 93ba10838359..d2a1625f1055 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -283,18 +283,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt, size, PAGE_KERNEL_EXEC); } -void __init create_id_mapping(phys_addr_t addr, phys_addr_t size, int map_io) -{ - if ((addr >> PGDIR_SHIFT) >= ARRAY_SIZE(idmap_pg_dir)) { - pr_warn("BUG: not creating id mapping for %pa\n", &addr); - return; - } - __create_mapping(&init_mm, &idmap_pg_dir[pgd_index(addr)], - addr, addr, size, - map_io ? __pgprot(PROT_DEVICE_nGnRE) - : PAGE_KERNEL_EXEC); -} - void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, unsigned long virt, phys_addr_t size, pgprot_t prot)