From patchwork Mon Jul 9 15:57:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9902 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 9B48A23E57 for ; Mon, 9 Jul 2012 15:57:08 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 5FD83A1850A for ; Mon, 9 Jul 2012 15:57:08 +0000 (UTC) Received: by yenq6 with SMTP id q6so10938138yen.11 for ; Mon, 09 Jul 2012 08:57:07 -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=OmEljNVss0EUm9EgPsF+j+slEwNsOiqW0iXdLy8iPuo=; b=WQsHKxbHiAtCbZ5N0E+ACHGnITI+e5tyyErQ2KjkPH6DN084IbZriQ+PTv98B+pB78 M64AKMrfUznqDPhbljYHRpj5DiGWGP3IXOrnHMqdQAo600roLsbCyAiiKC6i9WtEiB9W rlMZPOfTD9rfAro72wmAwjnN/3uOuiV5uaDYz+wUtNU786TnrOuBjuuEJpFcqSU7rozb I27mcS5aNG4I4psqDYq2nmjjUKSOJQdGOC2hY9EjFAmGLepcCjdm5Sry3DiHPY9uByTC dKpmjhR4NqT05KQ41mED6UhfKNltS779xhqd/eFCQNe53H7CqUsJR3/05eMBPfZxADli yLaw== Received: by 10.50.87.227 with SMTP id bb3mr8693555igb.57.1341849427699; Mon, 09 Jul 2012 08:57:07 -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 v20csp37882ibb; Mon, 9 Jul 2012 08:57:05 -0700 (PDT) Received: by 10.216.203.201 with SMTP id f51mr16090991weo.52.1341849425429; Mon, 09 Jul 2012 08:57:05 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id g56si37322339wee.50.2012.07.09.08.57.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jul 2012 08:57:05 -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 1SoGKa-0007ZM-5P; Mon, 09 Jul 2012 16:57:00 +0100 From: Peter Maydell To: linux-arm-kernel@lists.arm.linux.org.uk 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 16:57:00 +0100 Message-Id: <1341849420-29073-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQmtqjt9ScPwqCeH7E/TUDM8B9Qg9tm2FvR6vcOEVq1V6w3ZjvWGb5YTc0RlQ4ebmQBAZeCi 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...) 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