From patchwork Thu Jul 5 16:46:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9855 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 5ED9B23E16 for ; Thu, 5 Jul 2012 16:46:10 +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 29A09A181D9 for ; Thu, 5 Jul 2012 16:46:10 +0000 (UTC) Received: by ggnf1 with SMTP id f1so8238594ggn.11 for ; Thu, 05 Jul 2012 09:46:09 -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=oxZ+7sfiKS2a/L8M49bQ/G9MgkOHAF/U8gE3PDzA+/0=; b=l93HVKHVZCcbaaFRKUyHmMu5LoFfOMbM7tpkJywnr4XWPCt+JuMoRBJH8LsjzcYE+g PvF7c4LG7UtWRlLO2GwiPpel2pBh8aOwKj9Z2JF+wiy/EKyC1u+j8w9O2hCjTOjJt8SE aliWhMVCtLiWwNbl3QdHqzlt/HRygsf77VWBepnrAVqdABUaor68x2F1kMwMQbTX2WyI dN4wyt1ThYiVGw29pvYyJNF1/gsx/6zJ4qKlVawWzhsGms+xkpH7ALYKpWMynsqoMfo3 omZ7gOZ7orvGO/X7nX1yxmhQh4eUAKsdciNlfZNcR/cVtBzOw5yoReAa5IxuYcyYXrhm Rpnw== Received: by 10.50.163.99 with SMTP id yh3mr273186igb.53.1341506769489; Thu, 05 Jul 2012 09:46:09 -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 v20csp68186ibb; Thu, 5 Jul 2012 09:46:08 -0700 (PDT) Received: by 10.180.102.136 with SMTP id fo8mr776636wib.19.1341506767872; Thu, 05 Jul 2012 09:46:07 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id o47si24292582wee.140.2012.07.05.09.46.03 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 09:46:07 -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 1SmpBp-0005jX-Fz; Thu, 05 Jul 2012 17:46:01 +0100 From: Peter Maydell To: linaro-dev@linaro.org Cc: patches@linaro.org, Grant Likely , Marc Zyngier , Dave Martin Subject: [PATCH] arm: Handle device tree memory regions larger than 4GB Date: Thu, 5 Jul 2012 17:46:01 +0100 Message-Id: <1341506761-22016-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQkZeoPqXuqKbZHjcYvtoCxt+rbIrDKnPnx9xVvyXGiH3ghafXDbpTmo+ggktf/aQ4ybj0Uo Device tree memory regions may have sizes larger than 4GB. Instead of silently truncating a 64 bit size when we pass it to arm_add_memory(), split large regions into 2GB chunks. Signed-off-by: Peter Maydell --- With this patch, I can take a device tree which has been tweaked so its #address-cells and #size-cells are both 2, and boot it on a QEMU vexpress-a15 model with >4GB of RAM, and have the kernel actually detect the right amount of RAM. [the qemu bit needs some patches I haven't posted yet.] Since I'm not really a kernel dev I thought I'd post this to linaro-dev first in the hope of a bit of friendly local review before venturing onto lkml :-) arch/arm/kernel/devtree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index bee7f9d..79a6e66 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -26,6 +26,11 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) { + while (size > 0x80000000) { + arm_add_memory(base, 0x80000000); + base += 0x80000000; + size -= 0x80000000; + } arm_add_memory(base, size); }