Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp26275ybg; Mon, 27 Jul 2020 22:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTERy/4WKo5v9xCWm2If5c4ov+AfwuN11e7H6f7RHpHzbh3AO1ms3NLD+vn34BtmwxYwnC X-Received: by 2002:a17:906:6959:: with SMTP id c25mr23525277ejs.375.1595913254268; Mon, 27 Jul 2020 22:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595913254; cv=none; d=google.com; s=arc-20160816; b=VfGBZf/V2GxvZilpsKaSH+UJ42WRXl4tA+pEAY+OwzwIgaMYHo3lkSYPI4tgzaiVj/ +DOcdj3GbeWsmipwarMIv852VluHHGjNPqBzwMyAVD9YpEQbzZ0gCYGkjhoFXUG0WrHo oCmOPzPLHE7ocXmUOmTjCzFksDujFOzWUjJy/aJMW/lP9oM43RZMimqYBiMBlBkXRbVe XznKkSA3kQN/Hl3M2WnniG/oLyPNVDG0ipQIBc7KkPpCKZRmLTdPO/vcWgO47iEUjTNE j3C4pgq9uIRUm1Jon0QbAvxyGBqSQ1q9piMrGoPRXvp+NDv/H8gHEHi1cZ/WTtz8R+7I 6HYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ARIeX6EktzdOVeN4CzUF9ycWUesnb4uBXsy/u2DtiHc=; b=CZpUwGrDqQsXQlyilHn5+63kN8KnFgq2Cjl+uBX6rwuN10v37E3ifvFoiK7IoE4hog f8ZzGdY2zyPVC8yqxy8+ThqXK5Mspo71rO4Ol3ZxLyScnouw656butj63J7LEJ1YWJ+1 kTdsSavRwfkz91ybDZ+mbt0ue6iFATg35bNjfj7raxuPlLek48jIMz+DpQQMIqBpRStA hSIzqPNXnRf4mVWzcac7jDC1VyshHq9jo5hmDVEHGgLpXOwznsFpwM7nFiEuvHH35m6r dBnX/JllEVCbodopjy/muLdKya30ILhGNHAL/oxt4DBi6jm1I/sTwKR5U58GBLNMMdom VijA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YAjIiROU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf2si6884510edb.288.2020.07.27.22.13.52; Mon, 27 Jul 2020 22:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YAjIiROU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbgG1FNO (ORCPT + 99 others); Tue, 28 Jul 2020 01:13:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgG1FNN (ORCPT ); Tue, 28 Jul 2020 01:13:13 -0400 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B649522B45; Tue, 28 Jul 2020 05:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595913193; bh=w0NUYCkRPztxWdauIZ7iYp1zOp1jLcG8AD5t4PqIxsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAjIiROU+83p25BDNEgIN9KISlKJXThut30Rs4cNno1O6shiBCHaHk29LQKLS7Ax5 Ejyf6BAz+viwYwWWCNj69uR3Ffj9ovcm+78DaXms94OZuxA4yw2XiA7huGDx/Xn9eG FxVpJAd03+F3yNWhAm0fZShWCJUQp1/pDjBxfrnc= From: Mike Rapoport To: Andrew Morton Cc: Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Dave Hansen , Ingo Molnar , Marek Szyprowski , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org Subject: [PATCH 06/15] powerpc: fadamp: simplify fadump_reserve_crash_area() Date: Tue, 28 Jul 2020 08:11:44 +0300 Message-Id: <20200728051153.1590-7-rppt@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728051153.1590-1-rppt@kernel.org> References: <20200728051153.1590-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport fadump_reserve_crash_area() reserves memory from a specified base address till the end of the RAM. Replace iteration through the memblock.memory with a single call to memblock_reserve() with appropriate that will take care of proper memory reservation. Signed-off-by: Mike Rapoport --- arch/powerpc/kernel/fadump.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 78ab9a6ee6ac..2446a61e3c25 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1658,25 +1658,7 @@ int __init fadump_reserve_mem(void) /* Preserve everything above the base address */ static void __init fadump_reserve_crash_area(u64 base) { - struct memblock_region *reg; - u64 mstart, msize; - - for_each_memblock(memory, reg) { - mstart = reg->base; - msize = reg->size; - - if ((mstart + msize) < base) - continue; - - if (mstart < base) { - msize -= (base - mstart); - mstart = base; - } - - pr_info("Reserving %lluMB of memory at %#016llx for preserving crash data", - (msize >> 20), mstart); - memblock_reserve(mstart, msize); - } + memblock_reserve(base, memblock_end_of_DRAM() - base); } unsigned long __init arch_reserved_kernel_pages(void) -- 2.26.2