From patchwork Tue Aug 18 09:34:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 52493 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id CA53022EFC for ; Tue, 18 Aug 2015 09:37:03 +0000 (UTC) Received: by labd1 with SMTP id d1sf55280789lab.0 for ; Tue, 18 Aug 2015 02:37:02 -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:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=oDi/TDZzAMOKcOPANO9JbpxyElmWgfLG7WOhekbEEQI=; b=SawuM575y6QZ3rLii9lWPM2+425swzTDsX18t7ACHx5kVXZv/gfbeTrDPmHQF0htF8 /w//+fDojpxUbVVeCbe4qXWgEQa0qjPHS5lgZ0vvbO1WF3TCmZLxtwvJNxJ24c3fSxsE LFhTF3z1UaTkd+VveCgM+C3iATz4OEVBApsVIGCG4LAasE6gLedc4tRLpX8Ivmnd2pzd wrRIIwMoF9hO6pzWGr+kKCTVibotUoy0jhWLxiYC8O18oiNLRDnHRMLQQ/vyzFz9XnRO U2WYmXK4r0qVNievbB5k9pXXPR8Tx6HVIpo455RCcS21j8Jgf0EMctV27BZNdXn6dOS8 GlwQ== X-Gm-Message-State: ALoCoQmoGq+ry4DizeWE4joGvxhV7EmdqYjteoOjcn7s18jX7vB7LopZa3+hRv73Cybl711DXZ5u X-Received: by 10.112.16.200 with SMTP id i8mr1577669lbd.20.1439890622705; Tue, 18 Aug 2015 02:37:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls768450laf.35.gmail; Tue, 18 Aug 2015 02:37:02 -0700 (PDT) X-Received: by 10.112.170.2 with SMTP id ai2mr5431411lbc.82.1439890622428; Tue, 18 Aug 2015 02:37:02 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id v4si13704822laz.114.2015.08.18.02.37.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Aug 2015 02:37:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbsx3 with SMTP id sx3so99046484lbb.0 for ; Tue, 18 Aug 2015 02:37:02 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr5433822lag.86.1439890622332; Tue, 18 Aug 2015 02:37:02 -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.162.200 with SMTP id yc8csp364286lbb; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) X-Received: by 10.70.91.14 with SMTP id ca14mr11647517pdb.79.1439890621210; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i6si29366367pbq.228.2015.08.18.02.37.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Aug 2015 02:37:01 -0700 (PDT) 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; 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 1ZRdIo-0000BR-9h; Tue, 18 Aug 2015 09:35:30 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZRdIa-0007LY-FI for linux-arm-kernel@lists.infradead.org; Tue, 18 Aug 2015 09:35:17 +0000 Received: by wibhh20 with SMTP id hh20so103088555wib.0 for ; Tue, 18 Aug 2015 02:34:55 -0700 (PDT) X-Received: by 10.180.11.194 with SMTP id s2mr41216579wib.33.1439890494891; Tue, 18 Aug 2015 02:34:54 -0700 (PDT) Received: from ards-macbook-pro.lan ([194.228.32.103]) by smtp.gmail.com with ESMTPSA id mc18sm20512552wic.23.2015.08.18.02.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Aug 2015 02:34:54 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, catalin.marinas@arm.com, robh@kernel.org Subject: [PATCH 2/2] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Date: Tue, 18 Aug 2015 11:34:42 +0200 Message-Id: <1439890482-20798-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439890482-20798-1-git-send-email-ard.biesheuvel@linaro.org> References: <1439890482-20798-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150818_023516_697137_1A97E6BF X-CRM114-Status: GOOD ( 10.79 ) 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 [209.85.212.177 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.177 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: grant.likely@linaro.org, will.deacon@arm.com, stuart.yoder@freescale.com, Ard Biesheuvel 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.176 as permitted sender) smtp.mailfrom=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 The linear region size of a 39-bit VA kernel is only 256 GB, which may be insufficient to cover all of system RAM, even on platforms that have much less than 256 GB of memory but which is laid out very sparsely. So make sure we clip the memory we will not be able to map before installing it into the memblock memory table, by setting MAX_MEMBLOCK_ADDR accordingly. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index f800d45ea226..44a59c20e773 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -114,6 +114,14 @@ extern phys_addr_t memstart_addr; #define PHYS_OFFSET ({ memstart_addr; }) /* + * The maximum physical address that the linear direct mapping + * of system RAM can cover. (PAGE_OFFSET can be interpreted as + * a 2's complement signed quantity and negated to derive the + * maximum size of the linear mapping.) + */ +#define MAX_MEMBLOCK_ADDR ({ memstart_addr - PAGE_OFFSET - 1; }) + +/* * PFNs are used to describe any physical page; this means * PFN 0 == physical address 0. *