From patchwork Thu Aug 19 04:56:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 62108 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 196C5B79AC for ; Thu, 19 Aug 2010 15:12:48 +1000 (EST) Received: by ozlabs.org (Postfix) id 9C575B70FB; Thu, 19 Aug 2010 15:12:21 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from TX2EHSOBE010.bigfish.com (tx2ehsobe005.messaging.microsoft.com [65.55.88.15]) by ozlabs.org (Postfix) with ESMTP id 34B33B6F01 for ; Thu, 19 Aug 2010 15:12:21 +1000 (EST) Received: from mail48-tx2-R.bigfish.com (10.9.14.245) by TX2EHSOBE010.bigfish.com (10.9.40.30) with Microsoft SMTP Server id 8.1.340.0; Thu, 19 Aug 2010 04:57:11 +0000 Received: from mail48-tx2 (localhost.localdomain [127.0.0.1]) by mail48-tx2-R.bigfish.com (Postfix) with ESMTP id A68F311180B9; Thu, 19 Aug 2010 04:57:11 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h) Received: from mail48-tx2 (localhost.localdomain [127.0.0.1]) by mail48-tx2 (MessageSwitch) id 1282193831298767_10608; Thu, 19 Aug 2010 04:57:11 +0000 (UTC) Received: from TX2EHSMHS024.bigfish.com (unknown [10.9.14.239]) by mail48-tx2.bigfish.com (Postfix) with ESMTP id 44E0456804C; Thu, 19 Aug 2010 04:57:11 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by TX2EHSMHS024.bigfish.com (10.9.99.124) with Microsoft SMTP Server (TLS) id 14.0.482.44; Thu, 19 Aug 2010 04:57:11 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o7J4utvZ002418; Wed, 18 Aug 2010 21:57:05 -0700 (MST) Received: from localhost.localdomain (blarg.am.freescale.net [10.82.123.10]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o7J58ceQ021414; Thu, 19 Aug 2010 00:08:40 -0500 (CDT) From: Matthew McClintock To: kexec@lists.infradead.org Subject: [PATCH v2 2/3] Prevent multiple reservations for cpu-release-addr Date: Wed, 18 Aug 2010 23:56:50 -0500 Message-ID: <1282193811-23098-3-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <20100819042023.GC13965@verge.net.au> References: <20100819042023.GC13965@verge.net.au> MIME-Version: 1.0 X-Reverse-DNS: az33egw02.freescale.net Cc: muvarov@gmail.com, linuxppc-dev@ozlabs.org, Kumar Gala , Sebastian Andrzej Siewior , Matthew McClintock X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Currently, we can add a lot of reservations over a small range, this does a simple check to verify the previous entry is not the same as the current one and skips it if so Signed-off-by: Matthew McClintock --- kexec/arch/ppc/fixup_dtb.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c index 09f9ac1..910a3f0 100644 --- a/kexec/arch/ppc/fixup_dtb.c +++ b/kexec/arch/ppc/fixup_dtb.c @@ -139,6 +139,7 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t { int ret, i; int nodeoffset; + u64 val = 0; /* If this is a KEXEC kernel we add all regions since they will * all need to be saved */ @@ -175,20 +176,25 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t while (nodeoffset != -FDT_ERR_NOTFOUND) { const void *buf; int sz, ret; - u64 val = 0; + u64 tmp; buf = fdt_getprop(blob_buf, nodeoffset, "cpu-release-addr", &sz); - if (sz == 4) { - val = *(u32 *)buf; - } else if (sz == 8) { - val = *(u64 *)buf; - } - if (val) { - ret = fdt_add_mem_rsv(blob_buf, PAGE_ALIGN(val-PAGE_SIZE), PAGE_SIZE); - if (ret) - printf("%s: Unable to add reserve for cpu-release-addr!\n", - fdt_strerror(ret)); + if (buf) { + if (sz == 4) { + tmp = *(u32 *)buf; + } else if (sz == 8) { + tmp = *(u64 *)buf; + } + + /* crude check to see if last value is repeated */ + if (_ALIGN_DOWN(tmp, PAGE_SIZE) != _ALIGN_DOWN(val, PAGE_SIZE)) { + val = tmp; + ret = fdt_add_mem_rsv(blob_buf, _ALIGN_DOWN(val, PAGE_SIZE), PAGE_SIZE); + if (ret) + printf("%s: Unable to add reserve for cpu-release-addr!\n", + fdt_strerror(ret)); + } } nodeoffset = fdt_node_offset_by_prop_value(blob_buf, nodeoffset,