From patchwork Tue Jan 26 17:10:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 60477 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2088587lbb; Tue, 26 Jan 2016 09:11:24 -0800 (PST) X-Received: by 10.98.14.81 with SMTP id w78mr35714012pfi.26.1453828284219; Tue, 26 Jan 2016 09:11:24 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sj10si3104405pab.65.2016.01.26.09.11.23; Tue, 26 Jan 2016 09:11:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966949AbcAZRLK (ORCPT + 30 others); Tue, 26 Jan 2016 12:11:10 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:33631 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965001AbcAZRLC (ORCPT ); Tue, 26 Jan 2016 12:11:02 -0500 Received: by mail-wm0-f42.google.com with SMTP id 123so115000695wmz.0 for ; Tue, 26 Jan 2016 09:11:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T1f7/pkiYiQ1yeqvCbUGZ496V60y9FdUQ7vSoZeqXvQ=; b=M02kCbR435Siq6IhuuV7CKf4o17pS0wKIHQjNIM5oNULsfJ/074BnLzL0Wnt2dAeSf /0YlyRRLDHeNtnAv0eqQgmCvohmRbIwTQR9fOMDFmarLSMz0e9tK2hMXzYJchPWaPLIK pYIasxRY5GfvrPqROP4amtKw0UwEnoqyIrhfo= 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=T1f7/pkiYiQ1yeqvCbUGZ496V60y9FdUQ7vSoZeqXvQ=; b=CawnDxxK0yN5CAQeLPnXMCu8blLuhKvjbniwSbKt5fioo3rrt0QPLcBmCKoz7cy4gZ Kd/Kwbn7Dx7Fy6f4cOTe8XtFYFKmuASz4GuLiDF8kr3EdN+ew+BMaSwjCAHojKzdPejf HjvK0AF9L9wZbCvD4uUuXv84NMn5z8qPlpi3eyZf30Tub8ifNrY/nFcUSlT+Vvx+AXkr K80yyWKNVqLg753vyjuhGslnxIHK/g2QdgVf4i1z1ycEj2I445rEquuk6gvuQwH087lN KvUEFkJRc/si0qbxWI0N+OpIiJzIUtcGweBVUualvffqcOz9Bn94UHlk6+laBkMuDkAi szow== X-Gm-Message-State: AG10YOQhvHVHtONSdxBHx6jDNUWtJvhlYJdvBq84UpcLLttWXZJZ7h88Z11RtLB/6jbBPa3K X-Received: by 10.28.57.69 with SMTP id g66mr26838855wma.63.1453828261022; Tue, 26 Jan 2016 09:11:01 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id ko2sm2328617wjc.9.2016.01.26.09.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jan 2016 09:11:00 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, leif.lindholm@linaro.org, keescook@chromium.org, linux-kernel@vger.kernel.org Cc: stuart.yoder@freescale.com, bhupesh.sharma@freescale.com, arnd@arndb.de, marc.zyngier@arm.com, christoffer.dall@linaro.org, labbott@fedoraproject.org, matt@codeblueprint.co.uk, Ard Biesheuvel Subject: [PATCH v4 01/22] of/fdt: make memblock minimum physical address arch configurable Date: Tue, 26 Jan 2016 18:10:28 +0100 Message-Id: <1453828249-14467-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453828249-14467-1-git-send-email-ard.biesheuvel@linaro.org> References: <1453828249-14467-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org By default, early_init_dt_add_memory_arch() ignores memory below the base of the kernel image since it won't be addressable via the linear mapping. However, this is not appropriate anymore once we decouple the kernel text mapping from the linear mapping, so archs may want to drop the low limit entirely. So allow the minimum to be overridden by setting MIN_MEMBLOCK_ADDR. Acked-by: Mark Rutland Acked-by: Rob Herring Signed-off-by: Ard Biesheuvel --- drivers/of/fdt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.5.0 diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 655f79db7899..1f98156f8996 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -976,13 +976,16 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, } #ifdef CONFIG_HAVE_MEMBLOCK +#ifndef MIN_MEMBLOCK_ADDR +#define MIN_MEMBLOCK_ADDR __pa(PAGE_OFFSET) +#endif #ifndef MAX_MEMBLOCK_ADDR #define MAX_MEMBLOCK_ADDR ((phys_addr_t)~0) #endif void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) { - const u64 phys_offset = __pa(PAGE_OFFSET); + const u64 phys_offset = MIN_MEMBLOCK_ADDR; if (!PAGE_ALIGNED(base)) { if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {