From patchwork Mon Sep 7 07:16:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 53213 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id E81C122B05 for ; Mon, 7 Sep 2015 07:16:28 +0000 (UTC) Received: by lamp12 with SMTP id p12sf23441829lam.2 for ; Mon, 07 Sep 2015 00:16:27 -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=3WvRskxGXo6u8e6AT7H9ILGLmEJZZQWdv+ERSKMv2fA=; b=JHLQL1e+l37xHbywTdcl5AnQ8LAHvDq1+EAMQEJBRhIn+5dI1BvO7qOszf/i2BLbYZ H3HhJW3qmZl1NBdnazVffF2afgduLvCZndzqg4Ts+eDzCTsKSvWr/4KGFA2faW+0WNbq Hz3CI7+6eaA/VZA3Gqc2x6U4uLmwCYMdwSAiyoHKQxzZ7n5Ca2C7f4fCMwLjA6fMZm/4 NKwLT0FVWCWrw0+6LqQ4722aSttK+wZ4lDdvIXnJzDr7pm7J403BQMzcVXb6Ky1FHbEG qjQmRasS7ZmYp4OqQOPmqTb8vKN09wml5yWivGjVHuo4wDi5kXSW1vkIQNkO+lQ+/mtR zN4w== X-Gm-Message-State: ALoCoQm6eXtG+p9QVYDWjNbWEwoj7OLyWrsPahl7CpXTk3F5ufDpJE7ARoJ8q1EsIQzDSw3ktj1K X-Received: by 10.152.27.10 with SMTP id p10mr4566219lag.1.1441610187859; Mon, 07 Sep 2015 00:16:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.7 with SMTP id v7ls574563laa.107.gmail; Mon, 07 Sep 2015 00:16:27 -0700 (PDT) X-Received: by 10.112.13.136 with SMTP id h8mr3769166lbc.23.1441610187706; Mon, 07 Sep 2015 00:16:27 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id mu6si9665650lbc.88.2015.09.07.00.16.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 00:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbmp1 with SMTP id mp1so34692349lbb.1 for ; Mon, 07 Sep 2015 00:16:27 -0700 (PDT) X-Received: by 10.152.198.140 with SMTP id jc12mr15631162lac.19.1441610187607; Mon, 07 Sep 2015 00:16:27 -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 w3csp200209lbq; Mon, 7 Sep 2015 00:16:26 -0700 (PDT) X-Received: by 10.66.146.132 with SMTP id tc4mr42618086pab.124.1441610184907; Mon, 07 Sep 2015 00:16:24 -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.24; Mon, 07 Sep 2015 00:16:24 -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 S1752340AbbIGHQX (ORCPT + 1 other); Mon, 7 Sep 2015 03:16:23 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35391 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbbIGHQX (ORCPT ); Mon, 7 Sep 2015 03:16:23 -0400 Received: by wicge5 with SMTP id ge5so72537313wic.0 for ; Mon, 07 Sep 2015 00:16:22 -0700 (PDT) X-Received: by 10.194.23.36 with SMTP id j4mr32679827wjf.105.1441610182156; Mon, 07 Sep 2015 00:16:22 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 00:16:21 -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 2/2] arm64: set MAX_MEMBLOCK_ADDR according to linear region size Date: Mon, 7 Sep 2015 09:16:13 +0200 Message-Id: <1441610173-5265-3-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.177 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 34ba2c4247e5c4b1542b1106e156af324660c4f0 upstream. 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. Reviewed-by: Catalin Marinas Tested-by: Stuart Yoder Signed-off-by: Ard Biesheuvel Signed-off-by: Will Deacon --- 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. *