Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2565076pxj; Mon, 31 May 2021 05:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbNvQE8ThNTujcsaKSegXFa235jI/0XZdxoRJUTkXcBk3B2J2m+XWGT6+DxIgV0K2+Iksb X-Received: by 2002:a17:906:58d1:: with SMTP id e17mr22755765ejs.179.1622464490406; Mon, 31 May 2021 05:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622464490; cv=none; d=google.com; s=arc-20160816; b=zgz9VQU+mdOSGg4GgAWxaa+OXH6CDV5gxQT92WN0hd6R2c/sjV6U9XTvfaksC9yloE iHbXU/3wZaGFiFsrUCU/0igbWBqeRUPauwt2B2nQYBYE+qumHod3IQD9h4YgBtYNwkWI 2Gg9aqFl6H+v9DVIzQElgOcX0cj+3lA3yutmjsFKrL9OI0QD+0c96g2fnu9YpbSHaeWt O5ws2/A/xxwUodES+NBr5fcshfXMXEh/l0AcswkQvN/eYoXt932Rg9Y5UsuFyMkSPko6 EWWtVTiWQGm1eNge8LEV2uQG5b2ISga29anNR3T5wWCJaDuFDR7gy5A7NH2eybB9zbEE 0dLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AblcT+Z5m7qjnWgDyE42M3iETu0lBJA0m3r0fYhkNR4=; b=0szXvw5+HJW3MnEvc011wvramKObfxa+LAS24TK/7/whqiYczjGLS6mQkiD9Eys2E2 RGh0VSaNv4uNfpqrY4yRxSCbwIUUVB8uGOWwvQuXKUg6QPQk7iKY6VQ3mBp/+37uEk0Q w9mAE1LsuIJoWGR3/Z1D15u6mOftIC0BVRusQUJfsc7jGwYIlNY3lHP/shduOXYJKNoC bXMQ8KehxPoJJoDGGELKiZ1vToUPwE3GehcEnAF/FgQRNxxZVpx0Enp4tyqNj/DZA6vJ 2j/JZazlI8SQPGyonwh5/RQAfwLoRgCVPWGRFGfkdbTE7KZ+P8KAl1F7wi0P4GeWaPID fGFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UAWkF05L; 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 rh9si14345585ejb.139.2021.05.31.05.34.26; Mon, 31 May 2021 05:34:50 -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=k20201202 header.b=UAWkF05L; 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 S231563AbhEaMdR (ORCPT + 99 others); Mon, 31 May 2021 08:33:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:38614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbhEaMdD (ORCPT ); Mon, 31 May 2021 08:33:03 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) { -- 2.28.0