From patchwork Mon May 31 12:29:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12289315 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 4A757C47082 for ; Mon, 31 May 2021 12:33:39 +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 14AEE61263 for ; Mon, 31 May 2021 12:33:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14AEE61263 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=0a0nir00E5FPd5GpqDW1FUvdCwZDwO0KtHR8/jpmkm8=; b=TC8eEXIa+kNZFw h+ItvT0bcC12Jhzc+X5bzWGE3355Xg+fjagJvAN1gmZ+kx1NE0SuXYSQaHru0B5GcTOjCNDMIlKuX cBEhbOKiM0y1QSO4I7BIJ5U+6UUqD6h139ngR4qP3KroU3T27zJEk+ZpRsUzWwx2TMTgBHw7BlwW9 YrqgS6UXjKaNBwZv88JEcUqVOJIyZLT9+CUhk0K7O4eGXX7d9a+hJOi25S3dXhq5Rin4ERvzwLM8g yzj/nm6OQoytH1ybv6vEaxI+jKDjgYB2VjxR14Pkz+movrGOB9LIhfl49ft2tzLkRZHDMDhv1svaa whCAcW/XUy+Al/arEw8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lnh5K-00C9pg-HA; Mon, 31 May 2021 12:31:58 +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 1lnh4l-00C9fs-Os for linux-arm-kernel@lists.infradead.org; Mon, 31 May 2021 12:31:25 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DBDB610C9; Mon, 31 May 2021 12:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622464283; bh=2dnOTVI7zvTo/6jCrrAI5rKQuEMENUnjNWL7YAVd/TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAWkF05LhVrQJrPC2lEw2gMhfbIE1nUX/xsnFocDLULwsRSZMBTbzsCVHPl8oeKkb z2cMWXTTCLBjOEY1mQFiDLmuflFLMQRsM+jpmNmY2MW7WLyzkuQDAHSHGkdOebqCOd 1nh/SXYPVn1zoLjUR5E0W9fj+kHf85Oe/XnmA3rL8+DGy/owxS1wb/rDeThw5jZxXv qwF8nptukaL2cJqVyew84MeoNKalyCfFkoMPbKicTvt4lSZXrdSADUU6FUqt1tN54e 3kVF1vwHROoV9D+FXrxc0E7M0yg+L9Rm2SG0ELc+mdEp0Lq68OpMozWO3sm/VFX5P9 YvR7V2ZRQB5fQ== 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 3/5] arm: switch to generic memblock_setup_resources() Date: Mon, 31 May 2021 15:29:57 +0300 Message-Id: <20210531122959.23499-4-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_053123_873494_688AEFE1 X-CRM114-Status: GOOD ( 15.48 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mike Rapoport The registration of "System RAM" resources on arm is very similar to the generic version. The major differences are the registration of "System RAM (boot alias)" areas and minor differences in the way kernel image resources are reserved. Replace the open coded registration of the "System RAM" resource and the requests for kernel image and data areas in the resource tree with the generic implementation. Signed-off-by: Mike Rapoport --- arch/arm/kernel/setup.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1a5edf562e85..d14edf42815b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -174,23 +174,9 @@ static struct resource mem_res[] = { .end = 0, .flags = IORESOURCE_MEM }, - { - .name = "Kernel code", - .start = 0, - .end = 0, - .flags = IORESOURCE_SYSTEM_RAM - }, - { - .name = "Kernel data", - .start = 0, - .end = 0, - .flags = IORESOURCE_SYSTEM_RAM - } }; #define video_ram mem_res[0] -#define kernel_code mem_res[1] -#define kernel_data mem_res[2] static struct resource io_res[] = { { @@ -849,10 +835,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) struct resource *res; u64 i; - kernel_code.start = virt_to_phys(_text); - kernel_code.end = virt_to_phys(__init_begin - 1); - kernel_data.start = virt_to_phys(_sdata); - kernel_data.end = virt_to_phys(_end - 1); + memblock_setup_resources(); for_each_mem_range(i, &start, &end) { unsigned long boot_alias_start; @@ -881,24 +864,6 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; request_resource(&iomem_resource, res); } - - res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES); - if (!res) - panic("%s: Failed to allocate %zu bytes\n", __func__, - sizeof(*res)); - res->name = "System RAM"; - res->start = start; - res->end = res_end; - res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; - - request_resource(&iomem_resource, res); - - if (kernel_code.start >= res->start && - kernel_code.end <= res->end) - request_resource(res, &kernel_code); - if (kernel_data.start >= res->start && - kernel_data.end <= res->end) - request_resource(res, &kernel_data); } if (mdesc->video_start) {