From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3583C47080 for ; Mon, 31 May 2021 12:33:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F49661287 for ; Mon, 31 May 2021 12:33:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F49661287 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+4WDPpWl8wH8m2PFfjFCaqB748cwqmuKDXQm2DGc8x0=; b=mXlOh1lEhFU7Oy aON2hvVFa4Y1qlJYSUFnPEfPrBt1LLCRPQ54SK5cIQKxX4bp71dyPQfOI6LYRcHyF/Lgej2HEJgmX K+9qbTxLk98HhylBXObVPxemXpEFFKRpumCW/xKBNEXDrCpZ8VdKcXicwA03/5EcA0R7AyDWUWeqW sQMrclVK2yH712ATuyU/wBctBJsiiAVAp/ulr9EacyGf/x95+f6FqToKgNb8KOKggFjXLCh3JGiDd Ct893ORbpH1o+46c0NOSGR2djYbL809p9EIENsq3flacoV5RUIe3jW4blpbPYOGEgxpFeRuJTLA4O 1ukyLHuQuU+GTMm2A8OA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnh5X-00C9uP-OM; Mon, 31 May 2021 12:32:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnh4q-00C9gw-9D for linux-arm-kernel@lists.infradead.org; Mon, 31 May 2021 12:31:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id F3E666135F; Mon, 31 May 2021 12:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622464288; bh=309tkdm9I1/k2Co/st23BvuJob0lzdLSyQqCb3FEq5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=shfDXUt5Lezf1d+wGhhu727XGfae1hwajag2YZ137cnZTl0B/na6Vf8bUHnNhLWcT WDL60Wfo8EfCCBAwsr7gWELh2vywN4mSg5ZuH+KeAq3Pwl9n/EDdaxpSqRqzGw6lzF jz6t+S3yWvR8fD8/I/efykYVq8goZPliRZ+lqDA5PjiEl6id5iWfqxcXzTHq2SSf5P R3XUx/1lBgKklG8b5Ne/MMyJIdOZS4ey4MqYOW5bOIodhNki11uKX8zEIFwq4Y0P09 r9mcdDDc6cqMoPniLqJq3r7YlX/GBrJfp7Qn5kf3ivzA2MwWHqNFhEZcADG5BrH2I9 gIFsiBwqkFhgA== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Catalin Marinas , Christian Borntraeger , David Hildenbrand , Heiko Carstens , Mike Rapoport , Mike Rapoport , Russell King , Thomas Bogendoerfer , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org Subject: [RFC/RFT PATCH 4/5] MIPS: switch to generic memblock_setup_resources Date: Mon, 31 May 2021 15:29:58 +0300 Message-Id: <20210531122959.23499-5-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210531122959.23499-1-rppt@kernel.org> References: <20210531122959.23499-1-rppt@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210531_053128_393795_FAE7BB08 X-CRM114-Status: GOOD ( 17.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mike Rapoport MIPS version of resource setup is very similar to the generic one. The only difference is the reservation of the crash kernel area that is spread among several functions. Switch MIPS to use the generic version. Signed-off-by: Mike Rapoport --- arch/mips/kernel/setup.c | 78 +++------------------------------------- 1 file changed, 5 insertions(+), 73 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 23a140327a0b..be49217f0f22 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -79,10 +79,6 @@ static const char builtin_cmdline[] __initconst = ""; unsigned long mips_io_port_base = -1; EXPORT_SYMBOL(mips_io_port_base); -static struct resource code_resource = { .name = "Kernel code", }; -static struct resource data_resource = { .name = "Kernel data", }; -static struct resource bss_resource = { .name = "Kernel bss", }; - unsigned long __kaslr_offset __ro_after_init; EXPORT_SYMBOL(__kaslr_offset); @@ -469,31 +465,18 @@ static void __init mips_parse_crashkernel(void) } } + memblock_reserve(crashk_res.start, resource_size(&crashk_res)); + crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; -} - -static void __init request_crashkernel(struct resource *res) -{ - int ret; - - if (crashk_res.start == crashk_res.end) - return; - ret = request_resource(res, &crashk_res); - if (!ret) - pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n", - (unsigned long)(resource_size(&crashk_res) >> 20), - (unsigned long)(crashk_res.start >> 20)); + pr_info("Reserving %lldMB of memory at %lldMB for crashkernel\n", + crash_base >> 20, crash_size); } #else /* !defined(CONFIG_KEXEC) */ static void __init mips_parse_crashkernel(void) { } - -static void __init request_crashkernel(struct resource *res) -{ -} #endif /* !defined(CONFIG_KEXEC) */ static void __init check_kernel_sections_mem(void) @@ -656,10 +639,6 @@ static void __init arch_mem_init(char **cmdline_p) mips_reserve_vmcore(); mips_parse_crashkernel(); -#ifdef CONFIG_KEXEC - if (crashk_res.start != crashk_res.end) - memblock_reserve(crashk_res.start, resource_size(&crashk_res)); -#endif device_tree_init(); /* @@ -683,53 +662,6 @@ static void __init arch_mem_init(char **cmdline_p) early_memtest(PFN_PHYS(ARCH_PFN_OFFSET), PFN_PHYS(max_low_pfn)); } -static void __init resource_init(void) -{ - phys_addr_t start, end; - u64 i; - - if (UNCAC_BASE != IO_BASE) - return; - - code_resource.start = __pa_symbol(&_text); - code_resource.end = __pa_symbol(&_etext) - 1; - data_resource.start = __pa_symbol(&_etext); - data_resource.end = __pa_symbol(&_edata) - 1; - bss_resource.start = __pa_symbol(&__bss_start); - bss_resource.end = __pa_symbol(&__bss_stop) - 1; - - for_each_mem_range(i, &start, &end) { - struct resource *res; - - res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES); - if (!res) - panic("%s: Failed to allocate %zu bytes\n", __func__, - sizeof(struct resource)); - - res->start = start; - /* - * In memblock, end points to the first byte after the - * range while in resourses, end points to the last byte in - * the range. - */ - res->end = end - 1; - res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; - res->name = "System RAM"; - - request_resource(&iomem_resource, res); - - /* - * We don't know which RAM region contains kernel data, - * so we try it repeatedly and let the resource manager - * test it. - */ - request_resource(res, &code_resource); - request_resource(res, &data_resource); - request_resource(res, &bss_resource); - request_crashkernel(res); - } -} - #ifdef CONFIG_SMP static void __init prefill_possible_map(void) { @@ -771,7 +703,7 @@ void __init setup_arch(char **cmdline_p) arch_mem_init(cmdline_p); dmi_setup(); - resource_init(); + memblock_setup_resources(); plat_smp_setup(); prefill_possible_map(); -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel