From patchwork Tue Aug 18 09:34:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 52492 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 5DF5A22DB1 for ; Tue, 18 Aug 2015 09:37:03 +0000 (UTC) Received: by labth1 with SMTP id th1sf55454987lab.2 for ; Tue, 18 Aug 2015 02:37:01 -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=MSmhBClWN9VbQ6GgLzimaSQ+jUf3mTcqrJlA3dWDrn0=; b=VuaXxMj/v4U7h7YlnGuDvferSPFFNJmHa2T6BqYUWt5xJwT9c7de96JlztDtc+VRSQ ctlnX3AatkAItmw43CqgSqNfsEpCGPPIkIVd1O7pRtXVVmXEBUdFCeZ6W2UPdWrs9EPL PovY2jXL8H1QV5fqMDBejipJcTIrdlC1lC759xlujcKV25tsOXQ6uTw45gLyFz4JxWOe Q/ryDclx9CTAo1dchIxJSjnXF7dE1wlKhau3bdrcq5iN0RfXXo8qzuvy5a4IOVLKnn9N 3XBgw2aHGCLumCHsV/1RIkiDNBVk9RZpYbebi7q49q+qdD+nNL6xTzBCdOrjscm7PLkY oExA== X-Gm-Message-State: ALoCoQkxMGiseY8CC/RUgKA1ucDzjHiqRDufBrYNE2yaTK9ioU2VdxhnWuJuwXwtMNWF/VepgmQk X-Received: by 10.152.3.72 with SMTP id a8mr1206541laa.9.1439890621766; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.99 with SMTP id p3ls615830laj.57.gmail; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) X-Received: by 10.152.5.201 with SMTP id u9mr5484900lau.26.1439890621488; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id a7si255284lbv.164.2015.08.18.02.37.01 for (version=TLSv1.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 patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbcbn3 with SMTP id bn3so98676429lbc.2 for ; Tue, 18 Aug 2015 02:37:01 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr5384206lav.36.1439890621213; Tue, 18 Aug 2015 02:37:01 -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 yc8csp364276lbb; Tue, 18 Aug 2015 02:37:00 -0700 (PDT) X-Received: by 10.70.47.129 with SMTP id d1mr11756524pdn.6.1439890619367; Tue, 18 Aug 2015 02:36:59 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id mc9si29453342pdb.199.2015.08.18.02.36.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Aug 2015 02:36:59 -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 1ZRdIg-00004w-31; Tue, 18 Aug 2015 09:35:22 +0000 Received: from mail-wi0-f176.google.com ([209.85.212.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZRdIY-0007LN-Ie for linux-arm-kernel@lists.infradead.org; Tue, 18 Aug 2015 09:35:15 +0000 Received: by wicne3 with SMTP id ne3so90232254wic.0 for ; Tue, 18 Aug 2015 02:34:52 -0700 (PDT) X-Received: by 10.180.74.229 with SMTP id x5mr40830061wiv.90.1439890492799; Tue, 18 Aug 2015 02:34:52 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Aug 2015 02:34:51 -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 1/2] of/fdt: make memblock maximum physical address arch configurable Date: Tue, 18 Aug 2015 11:34:41 +0200 Message-Id: <1439890482-20798-2-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_023514_766921_073292A0 X-CRM114-Status: GOOD ( 14.24 ) 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.176 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.176 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.170 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 When parsing the memory nodes to populate the memblock memory table, we check against high and low limits and clip any memory that exceeds either one of them. However, for arm64, the high limit of (phys_addr_t)~0 is not very meaningful, since phys_addr_t is 64 bits (i.e., no limit) but there may be other constraints that limit the memory ranges that we can support. So rename MAX_PHYS_ADDR to MAX_MEMBLOCK_ADDR (for clarity) and only define it if the arch does not supply a definition of its own. Signed-off-by: Ard Biesheuvel --- drivers/of/fdt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 07496560e5b9..6e82bc42373b 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -967,7 +967,9 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, } #ifdef CONFIG_HAVE_MEMBLOCK -#define MAX_PHYS_ADDR ((phys_addr_t)~0) +#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) { @@ -984,16 +986,16 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) } size &= PAGE_MASK; - if (base > MAX_PHYS_ADDR) { + if (base > MAX_MEMBLOCK_ADDR) { pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", base, base + size); return; } - if (base + size - 1 > MAX_PHYS_ADDR) { + if (base + size - 1 > MAX_MEMBLOCK_ADDR) { pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", - ((u64)MAX_PHYS_ADDR) + 1, base + size); - size = MAX_PHYS_ADDR - base + 1; + ((u64)MAX_MEMBLOCK_ADDR) + 1, base + size); + size = MAX_MEMBLOCK_ADDR - base + 1; } if (base + size < phys_offset) {