From patchwork Mon Sep 7 07:16:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 53212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 149AE22B05 for ; Mon, 7 Sep 2015 07:16:26 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf23316939wic.2 for ; Mon, 07 Sep 2015 00:16:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=RvKW+lThduBc0kMXyDjK2F0TQS3B1L5jhPfZMqRQr2Y=; b=IURuV906rVdtYX3PyIBWnL1+SdFNPf5Skm2Hr5gGmKhqU3ZJLDXn26qURau9Ca5HrT AOKq/ZMgpdtbzqPzCg7xo/ZoSeXuv8tvq54vBeIEJjmmvt5AeCQysxf4lhVvIZYGCyrb xJ0/awv13qklMSx8dnzFEs6Z/EyDOkCRyOguySL/WE8kfEZQdIyw+t1e07kUSFm2Sfc2 Btrzdr6vgKJx9MM46L9le87Ap10asaRvE7PV0rOpUg5jt7kmUZu4szfi5tXtbDTES3uA tbUMf4F0tQiEsoF90oerbgPXmimWKo7dPZuwBjnPk9p0GayIIw1R0+gvjNEvC0tOtbSL buFA== X-Gm-Message-State: ALoCoQlvvw6ynYWdgnX5bkEUgtTRpaYp3tLewAvIIxldCq5lT/jmwBBsrQJqhJmt49MywEAJ2+7+ X-Received: by 10.194.115.135 with SMTP id jo7mr4548212wjb.7.1441610185202; Mon, 07 Sep 2015 00:16:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.168 with SMTP id o8ls459662lae.47.gmail; Mon, 07 Sep 2015 00:16:25 -0700 (PDT) X-Received: by 10.112.158.38 with SMTP id wr6mr6913583lbb.25.1441610185015; Mon, 07 Sep 2015 00:16:25 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id yk6si9666203lbb.90.2015.09.07.00.16.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 00:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbcao8 with SMTP id ao8so34501623lbc.3 for ; Mon, 07 Sep 2015 00:16:24 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr15733473lag.86.1441610184901; Mon, 07 Sep 2015 00:16:24 -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.59.35 with SMTP id w3csp200195lbq; Mon, 7 Sep 2015 00:16:23 -0700 (PDT) X-Received: by 10.50.29.77 with SMTP id i13mr16031079igh.77.1441610183644; Mon, 07 Sep 2015 00:16:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si18592034pdc.81.2015.09.07.00.16.22; Mon, 07 Sep 2015 00:16:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbbIGHQW (ORCPT + 1 other); Mon, 7 Sep 2015 03:16:22 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:34801 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbbIGHQV (ORCPT ); Mon, 7 Sep 2015 03:16:21 -0400 Received: by wicfx3 with SMTP id fx3so77694325wic.1 for ; Mon, 07 Sep 2015 00:16:20 -0700 (PDT) X-Received: by 10.180.96.230 with SMTP id dv6mr32225157wib.23.1441610180691; Mon, 07 Sep 2015 00:16:20 -0700 (PDT) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by smtp.gmail.com with ESMTPSA id i7sm18568506wib.15.2015.09.07.00.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 00:16:20 -0700 (PDT) From: Ard Biesheuvel To: stable@vger.kernel.org, will.deacon@arm.com, catalin.marinas@arm.com, stuart.yoder@freescale.com, robh@kernel.org Cc: Ard Biesheuvel Subject: [PATCH 1/2] of/fdt: make memblock maximum physical address arch configurable Date: Mon, 7 Sep 2015 09:16:12 +0200 Message-Id: <1441610173-5265-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441610173-5265-1-git-send-email-ard.biesheuvel@linaro.org> References: <1441610173-5265-1-git-send-email-ard.biesheuvel@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.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.172 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , commit 8eafeb48022816513abc4f440bdad4c350fe81a3 upstream. 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. Acked-by: Rob Herring Reviewed-by: Catalin Marinas Tested-by: Stuart Yoder Signed-off-by: Ard Biesheuvel Signed-off-by: Will Deacon --- 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) {