From patchwork Mon Nov 16 18:32:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 56679 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1483573lbb; Mon, 16 Nov 2015 10:38:45 -0800 (PST) X-Received: by 10.68.163.97 with SMTP id yh1mr56328220pbb.36.1447699125046; Mon, 16 Nov 2015 10:38:45 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id dm1si18938046pbc.117.2015.11.16.10.38.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 10:38:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com 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 1ZyOeI-0003d1-LT; Mon, 16 Nov 2015 18:37:06 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyOam-0007Wh-6U for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2015 18:33:30 +0000 Received: by wmec201 with SMTP id c201so133346208wme.1 for ; Mon, 16 Nov 2015 10:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B1lABvtq6vcdis/1qEss+5COb0Btw6D5wq2uCOXDHio=; b=Hi7El7qkk2bnk1egU3yflun0mPma+PpHPni6jqmJLe5vtdDRhuOq6SjG3/ipbU6nvd wrlxziBvGV6kDXtJDAKbATiKXehjGBzde2yS4gAsHWpY5i11H6bDtb3bB+AJmWHTsHY5 wYaDQ3jTIdtEwdQPGtaq4vCJgfd70PJxeBmNfTnpkp92mi338cKPKrwBV51psFPVHn5u IKmF56xJ7iRbt81YcjkW2uJQgkheW03mgKOOQsQTDBIDYZL4MQKSLwo+x5J9XH/ZQfw/ d8/X/9iNjW8hIESsxsn5IMmYdK0v5riSPjE6hHUKwoBRx1fayDisoNXLHgn0vZqR67O8 f0Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B1lABvtq6vcdis/1qEss+5COb0Btw6D5wq2uCOXDHio=; b=cHB+a2yyor014wIOOEMlt/Qwu2DN2Pbb5/ZhsV3quHSVuySCQe20YtyFr2NqXLN1Nv xeH8aB517KWUEwzPO04euNz9lRgDkTaeJDshkRefTeL+A3l7J4s4pBuMbxW64oy61aiu UntqcWW1M9f7mqW/8PKc08g/aP++HbCC/g082wkLY3K2MLR4v7su4VBBLPsWQ7vK8Bzx KL3Cv9ydg5HHlonmx5c+cIC2zlEjMRvo9Qt8dbvww7zIz4pnU52gINn5UORNY982oChc cGH86fQVpysDJLVNzinERR+M2Euy5xUSREEEL1yccVVLmcpHTQNHLZejwPGoFhqdzMhd k/WQ== X-Gm-Message-State: ALoCoQkeg8g7KG2UJNyNK+ZYYH+vy+2Tjoy0UcslAJY6OflImcnj62e4BEi4chPIBrV7BEDa5A/u X-Received: by 10.28.22.67 with SMTP id 64mr19696174wmw.61.1447698786827; Mon, 16 Nov 2015 10:33:06 -0800 (PST) Received: from ards-macbook-pro.lan (2-237-3-18.ip236.fastwebnet.it. [2.237.3.18]) by smtp.gmail.com with ESMTPSA id he3sm35796779wjc.48.2015.11.16.10.33.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Nov 2015 10:33:06 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, matt.fleming@intel.com, linux@arm.linux.org.uk, will.deacon@arm.com, grant.likely@linaro.org, catalin.marinas@arm.com, mark.rutland@arm.com, leif.lindholm@linaro.org, roy.franz@linaro.org Subject: [PATCH v2 09/12] ARM: implement create_mapping_late() for EFI use Date: Mon, 16 Nov 2015 19:32:34 +0100 Message-Id: <1447698757-8762-10-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447698757-8762-1-git-send-email-ard.biesheuvel@linaro.org> References: <1447698757-8762-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151116_103328_764697_EC02F4B5 X-CRM114-Status: GOOD ( 12.48 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:230 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mm@kvack.org, ryan.harkin@linaro.org, Ard Biesheuvel , akpm@linux-foundation.org, msalter@redhat.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This implements create_mapping_late(), which we will use to populate the UEFI Runtime Services page tables. Signed-off-by: Ard Biesheuvel --- arch/arm/include/asm/mach/map.h | 1 + arch/arm/mm/mmu.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h index f98c7f32c9c8..14fe67bd0272 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h @@ -42,6 +42,7 @@ enum { extern void iotable_init(struct map_desc *, int); extern void vm_reserve_area_early(unsigned long addr, unsigned long size, void *caller); +extern void create_mapping_late(struct mm_struct *mm, struct map_desc *md); #ifdef CONFIG_DEBUG_LL extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr); diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 87dc49dbe231..0b7b61e31bc3 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -724,6 +724,14 @@ static void __init *early_alloc(unsigned long sz) return early_alloc_aligned(sz, sz); } +static void *__init late_alloc(unsigned long sz) +{ + void *ptr = (void *)__get_free_pages(PGALLOC_GFP, get_order(sz)); + + BUG_ON(!ptr); + return ptr; +} + static pte_t * __init pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot, void *(*alloc)(unsigned long sz)) @@ -955,6 +963,17 @@ static void __init create_mapping(struct map_desc *md) __create_mapping(&init_mm, md, early_alloc); } +void __init create_mapping_late(struct mm_struct *mm, struct map_desc *md) +{ +#ifdef CONFIG_ARM_LPAE + pud_t *pud = pud_alloc(mm, pgd_offset(mm, md->virtual), md->virtual); + if (WARN_ON(!pud)) + return; + pmd_alloc(mm, pud, 0); +#endif + __create_mapping(mm, md, late_alloc); +} + /* * Create the architecture specific mappings */