From patchwork Fri Oct 24 12:39:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 39475 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EBBC824026 for ; Fri, 24 Oct 2014 12:42:36 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf620525wgh.0 for ; Fri, 24 Oct 2014 05:42:36 -0700 (PDT) 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=D1znJaZUX1bl/ORpoPZDFWc3iP3FnjBh0USMGK61FJk=; b=QBAcP3KqGRdVoHYPHNQ3fhv2P1eYxx/MqTuotsUc1w6PSgRSiyM6+Y0CWMLjSpd3cn H0hDqnTV5NAWVkc3+QEzTqmkbXgBg7OHvP0BogN2f2Tz/lKFd/OfP0g8hXmPddNBDc11 LYrCcqEFPNgs2EMRbfa1cOZ8L2y/bie7COPIEa9lmU6fJ9/BhgFQLgkgzL/Cj92zlZim U2z1ELWt3GJobwzFCBVdchmjB1pRfAigUMAxDd8ddAHJvf2GrCUJKpfC8+tQ54qrFKsQ ALgfE6UXLDOatOikzFb8W15LFYTRdkMqG+mdTRqLXFHDe8KpqLfLOp5yYP/lrzLQMT0K fBKQ== X-Gm-Message-State: ALoCoQlWIJRENx8u5IDjCwc1GPu4Tw2X2STDJlXghK66sn9BU3pQ6FCsOIIBlg4T1SaPa2fqmSWJ X-Received: by 10.112.97.35 with SMTP id dx3mr414883lbb.20.1414154556093; Fri, 24 Oct 2014 05:42:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.133 with SMTP id o5ls441533lal.35.gmail; Fri, 24 Oct 2014 05:42:35 -0700 (PDT) X-Received: by 10.152.43.197 with SMTP id y5mr3115679lal.82.1414154555939; Fri, 24 Oct 2014 05:42:35 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id k16si6859924laa.47.2014.10.24.05.42.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Oct 2014 05:42:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id n15so2455902lbi.39 for ; Fri, 24 Oct 2014 05:42:35 -0700 (PDT) X-Received: by 10.112.12.35 with SMTP id v3mr4271419lbb.80.1414154555831; Fri, 24 Oct 2014 05:42:35 -0700 (PDT) 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.84.229 with SMTP id c5csp420585lbz; Fri, 24 Oct 2014 05:42:34 -0700 (PDT) X-Received: by 10.66.90.134 with SMTP id bw6mr4332092pab.35.1414154554152; Fri, 24 Oct 2014 05:42:34 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cr2si3864919pbc.11.2014.10.24.05.42.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 05:42:34 -0700 (PDT) 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 1XheBG-0007mR-4y; Fri, 24 Oct 2014 12:41:22 +0000 Received: from mail-wg0-f48.google.com ([74.125.82.48]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XheAF-00065S-OQ for linux-arm-kernel@lists.infradead.org; Fri, 24 Oct 2014 12:40:21 +0000 Received: by mail-wg0-f48.google.com with SMTP id k14so983686wgh.7 for ; Fri, 24 Oct 2014 05:39:57 -0700 (PDT) X-Received: by 10.194.78.113 with SMTP id a17mr2377200wjx.120.1414154397231; Fri, 24 Oct 2014 05:39:57 -0700 (PDT) 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 ny6sm1877350wic.22.2014.10.24.05.39.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Oct 2014 05:39:56 -0700 (PDT) From: Ard Biesheuvel To: leif.lindholm@linaro.org, roy.franz@linaro.org, msalter@redhat.com, mark.rutland@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, matt.fleming@intel.com, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dyoung@redhat.com Subject: [PATCH 6/6] arm64/efi: remove idmap manipulations from UEFI code Date: Fri, 24 Oct 2014 14:39:44 +0200 Message-Id: <1414154384-15385-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414154384-15385-1-git-send-email-ard.biesheuvel@linaro.org> References: <1414154384-15385-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141024_054019_970934_4C5DCAAE X-CRM114-Status: GOOD ( 14.61 ) 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 [74.125.82.48 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.48 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: grant.likely@linaro.org, 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.217.180 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 | 4 ++-- arch/arm64/include/asm/mmu.h | 2 -- arch/arm64/kernel/efi.c | 26 +------------------------- arch/arm64/kernel/setup.c | 2 +- arch/arm64/mm/mmu.c | 10 ---------- 5 files changed, 4 insertions(+), 40 deletions(-) diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index d752e5480096..09854df5a2a1 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -6,10 +6,10 @@ #ifdef CONFIG_EFI extern void efi_init(void); -extern void efi_idmap_init(void); +extern void efi_virtmap_init(void); #else #define efi_init() -#define efi_idmap_init() +#define efi_virtmap_init() #endif void efi_load_rt_mapping(void); diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index bcf166043a8b..df33cf02300a 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, int map_io, int map_xn); diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index cbff3e8eff11..02bd7e877f0b 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -53,27 +53,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); - } -} - /* * Translate a EFI virtual address into a physical address: this is necessary, * as some data members of the EFI system table are virtually remapped after @@ -251,16 +230,13 @@ static struct mm_struct efi_mm = { INIT_MM_CONTEXT(efi_mm) }; -void __init efi_idmap_init(void) +void __init efi_virtmap_init(void) { efi_memory_desc_t *md; if (!efi_enabled(EFI_BOOT)) return; - /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ - efi_setup_idmap(); - for_each_efi_memory_desc(&memmap, md) { u64 paddr, npages, size; diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 2437196cc5d4..a6028490a28f 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -392,7 +392,7 @@ 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 f7d17a5a1f56..19eae06aab81 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -282,16 +282,6 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt, size, 0, 0); } -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, 0); -} - void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, unsigned long virt, phys_addr_t size, int map_io, int map_xn)