From patchwork Mon Jul 9 16:16:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9903 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2D77F23E23 for ; Mon, 9 Jul 2012 16:16:15 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id EA01DA1856E for ; Mon, 9 Jul 2012 16:16:14 +0000 (UTC) Received: by ggnf1 with SMTP id f1so10972888ggn.11 for ; Mon, 09 Jul 2012 09:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=sHdqPeMsI1KPHRqD/6G5fnPz556J3fP0kqp33p1j+A8=; b=VRQQdpOu0N+Z49rXMx02Kj0kwzibVJgMFSSqvwYxl3yedgLAQFloZQJBFdqVG3hYyN GdpMvFMWzuZaIue1KHRfdak8yyhiBLk7rwcnoFl7t/WKouueG3Q5En1KEFr1dhX6GXXO jmPkBXfB34ysKklPV3uThdwF8KgJ7iuhLGyYMMiwjw4greZWi1N/XWm6BR+/gghsc8fm n4XBjhLVzOx+DzJH3iAEpG8Uy0rA0ok42bEIkGN7+Xq8f+wylkEYvYifk7SQRT/VG+co 7cAX2Utpylo6adKHwXiiFZw+R/pV1AjRpQ2bK2y43DtsD+DWLEwkT2EY8FCpLxPZs4+2 HI4Q== Received: by 10.42.89.72 with SMTP id f8mr21064105icm.33.1341850574186; Mon, 09 Jul 2012 09:16:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp38124ibb; Mon, 9 Jul 2012 09:16:13 -0700 (PDT) Received: by 10.180.98.69 with SMTP id eg5mr30780600wib.3.1341850572680; Mon, 09 Jul 2012 09:16:12 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id en3si26876679wib.31.2012.07.09.09.16.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 09:16:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SoGd3-0007bG-UN; Mon, 09 Jul 2012 17:16:05 +0100 From: Peter Maydell To: linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, Will Deacon , Nicolas Pitre , Dave Martin , Rob Herring Subject: [PATCH] arm: Use phys_addr_t to hold sizes in arm_add_memory and struct membank Date: Mon, 9 Jul 2012 17:16:05 +0100 Message-Id: <1341850565-29191-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQleoFga5IptIpqhMXvpGBvwBpG+M9aL/5tIfFBYQOejZbuBKSS/53L0l536Ar3Oz+W109Nv The memory regions which are passed to arm_add_memory() from device tree blobs via early_init_dt_add_memory_arch() can have sizes which are larger than will fit in a 32 bit integer, so switch to using a phys_addr_t to hold them, to avoid silently dropping the top 32 bits of the size. Signed-off-by: Peter Maydell --- (The change from '& PAGE_MASK' is required because PAGE_MASK is an unsigned 32 bit constant and would clear the high 32 bits of size...) Apologies to those on CC who got this mail twice. arch/arm/include/asm/setup.h | 4 ++-- arch/arm/kernel/setup.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 23ebc0c..24d284a 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -196,7 +196,7 @@ static const struct tagtable __tagtable_##fn __tag = { tag, fn } struct membank { phys_addr_t start; - unsigned long size; + phys_addr_t size; unsigned int highmem; }; @@ -217,7 +217,7 @@ extern struct meminfo meminfo; #define bank_phys_end(bank) ((bank)->start + (bank)->size) #define bank_phys_size(bank) (bank)->size -extern int arm_add_memory(phys_addr_t start, unsigned long size); +extern int arm_add_memory(phys_addr_t start, phys_addr_t size); extern void early_print(const char *str, ...); extern void dump_machine_table(void); diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e15d83b..3f62dd1 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -508,7 +508,7 @@ void __init dump_machine_table(void) /* can't use cpu_relax() here as it may require MMU setup */; } -int __init arm_add_memory(phys_addr_t start, unsigned long size) +int __init arm_add_memory(phys_addr_t start, phys_addr_t size) { struct membank *bank = &meminfo.bank[meminfo.nr_banks]; @@ -538,7 +538,7 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size) } #endif - bank->size = size & PAGE_MASK; + bank->size = size & ~(phys_addr_t)(PAGE_SIZE-1); /* * Check whether this memory region has non-zero size or