From patchwork Mon Nov 23 09:06:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 57122 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1316864lbb; Mon, 23 Nov 2015 01:11:53 -0800 (PST) X-Received: by 10.98.19.12 with SMTP id b12mr14556205pfj.78.1448269913250; Mon, 23 Nov 2015 01:11:53 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id iz1si2238766pbc.181.2015.11.23.01.11.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2015 01:11:53 -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 1a0n8h-0006MR-AF; Mon, 23 Nov 2015 09:10:23 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0n6A-0003N1-7R for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 09:07:48 +0000 Received: by wmww144 with SMTP id w144so86941398wmw.1 for ; Mon, 23 Nov 2015 01:07:24 -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=4pqfZO8bAScedjudxwih3++BZI+9p0g3Q4Ea3A6ehAE=; b=GrOCeNe2kFw9D7ctS48XFj6aUpXryX08DAco4TPiXy09CiUl/pfVGfyclj+Hz1DGRK BtU2WOJiUCSEF3w/hCpRjlpO/YVLu6qM1VWMkERF/WW+x/WgJrRJoxa590aiYxAi2b7Z MqxxpSUHSJbKP5Rc63q36uP1NOVgY7FU7lYtZ3g49EMbb7+NtYC90Pgbn3M0wEq8gxTL 3Z95AMG3jn0FqW4Kl8IFED90qj2NyUd1j1DwxOpvGg+mWDKdCXJHNNaHLHdnZPL6tRYp 4IdkzAYyrzrYRE/q6OQu1xG2/YKHObxmIu6FaotXzpD8SNPj8E+Rfk4xVr3lniPhb5MR +5Zg== 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=4pqfZO8bAScedjudxwih3++BZI+9p0g3Q4Ea3A6ehAE=; b=M8RnFM1AI35iK8EKu7ie7yR9OXsEnxLTu8W/dYEhIw3YIDfZ9BBSQRH+FAfpOcKX+7 v3UvFG2FMBDyrXuxrQp36qtoDxFODU+CZL7940kpix3sIuFsm8beA9HsBJAlKhwnm3bS H1OXYBxRIngUW6dc9v/KX0bGrFfTJbDv+D1O4acA+E75BIp9V5YlLCWCCzPRpwgLgXwx oNl+MwaXnFeGRY+7ztGMJbSjVfqvqFpwKKIXzQnhPb69jAH1nVvEwI681Q6tqNpSGSGx 2p/sKlQeWQJpiZlO1wKg2gVlwV986vrOiNH8CtCukQaElJylspfGipAZaqd+2B1DkyiN bkUA== X-Gm-Message-State: ALoCoQntKzia+Pz3z4OZ49YAPFALaZ3SaFhmoRmXGapfyX3Y+rT8v5N/1PPMYZ7QmoSLjVgmjaOe X-Received: by 10.194.79.72 with SMTP id h8mr32281524wjx.136.1448269644622; Mon, 23 Nov 2015 01:07:24 -0800 (PST) Received: from localhost.localdomain ([2.44.140.166]) by smtp.gmail.com with ESMTPSA id h189sm12241754wme.1.2015.11.23.01.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 01:07:24 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, linux-efi@vger.kernel.org, leif.lindholm@linaro.org, matt@codeblueprint.co.uk Subject: [PATCH v3 10/13] ARM: implement create_mapping_late() for EFI use Date: Mon, 23 Nov 2015 10:06:30 +0100 Message-Id: <1448269593-20758-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448269593-20758-1-git-send-email-ard.biesheuvel@linaro.org> References: <1448269593-20758-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_010746_694542_01267666 X-CRM114-Status: GOOD ( 12.27 ) 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:22d 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: kuleshovmail@gmail.com, Ard Biesheuvel , roy.franz@linaro.org, linux-mm@kvack.org, ryan.harkin@linaro.org, msalter@redhat.com, grant.likely@linaro.org, akpm@linux-foundation.org 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 | 2 ++ arch/arm/mm/mmu.c | 20 ++++++++++++++++++++ 2 files changed, 22 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..9b7c328fb207 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h @@ -42,6 +42,8 @@ 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, + bool ng); #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 2d9f628a7fe8..8c69830e791a 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)) @@ -960,6 +968,18 @@ static void __init create_mapping(struct map_desc *md) __create_mapping(&init_mm, md, early_alloc, false); } +void __init create_mapping_late(struct mm_struct *mm, struct map_desc *md, + bool ng) +{ +#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, ng); +} + /* * Create the architecture specific mappings */