From patchwork Tue Oct 6 00:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11817981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C096112E for ; Tue, 6 Oct 2020 00:18:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 078FA20789 for ; Tue, 6 Oct 2020 00:18:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Tw4nGktj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="KqsKbHgp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 078FA20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4CfdMLcjj5WKzyuaFy0kOAu4Z1nquyuC3bqJcyKK42g=; b=Tw4nGktjuE81zTjHEy/SykP2z c3ecTGOstr7DT/X7JkWlaWbqG1TFgxnvwki8inZUFj2gV9VdXi9M+CnaSQ+jtCVvTWyvjLBWqXZ3j k217gKjN4Ey8oAc/FRhUq+KbnhUzQlS1IoX7Ko7kbq0s6kFQRY65PPZOe47nNV54G2P4b+YIAdqNE xc2OFuOj3TEy36WnnnDthOaj2UrP+XZ868o40xyajcJqZ24NGJiFpcMsNy9DGhhJSGLiA3jsTJSJc HiB2UxMHHdojyhwKFFnSnZfrRag31+c0Yd9JnVgu7I/tR1V8i3zrO0lDaKDcrF0AlNRzfehnozPkz Ppt+wP2NQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPagJ-0006tZ-Q3; Tue, 06 Oct 2020 00:18:15 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPag9-0006op-77; Tue, 06 Oct 2020 00:18:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1601943485; x=1633479485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/JpC2RlQXkAFbMviFPpL7wwSbtn1c0inpseLQKJmER4=; b=KqsKbHgpf9sBHOBIhnQRs4ggjEFLYtk/Wj3L/I1J16eGndluVHbktVVd 2BVVVwzD8JwdH96iQfAAMDc2ytY0yUUK5CbAUe3373OAi6Xjlkwpd4CYY /8/m8cKSWLu/7IV/Y+LhuLNAELRmbhL6Kfnp+ylqGPFNpFsSMqdeV2U5h YRimv5ctFSqq6TiMoBY/Nqv6urGDlaj4Ky8KTofVtGiGFLliNIt/QFB+b U7KT1sTRfXgspotlxDEhZHX7UE1zKflGBpkx4rypihXzmrDFrDogkcXze JzIGAd+SitJyMXQz5aqHQCPGe4k2RQg1l65+/OlpUZ/pPrYIlGTHT2rG6 g==; IronPort-SDR: hyTB4/ahixPm9tcpPTM2t4Riw3/VRl9oIZhRK9oMugGThPEmRTdTAp68ueLiwTpsDJAGjwL6ut NnmHjvXKmK3eVDDhTb4PJq2WuWLOEMbA8HYnEaWmhfU9isDqIYYTFLE2/YFvraU3jv2ar1xDh7 HL/1A0+KFLZllda7ZVhAkX6ehm3pKeoqqW+Yw94AQp6J9UHlPNd9hlOvF99iGlAtz5ithXKWYD OCNzFxfE4Ixpt5QCGihQiXNsHjGzHH7F4O4lq0Sa8coJqQqpOB16iizyEklTFxeo9GNNDLy4MY SA0= X-IronPort-AV: E=Sophos;i="5.77,341,1596470400"; d="scan'208";a="153530923" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 06 Oct 2020 08:17:59 +0800 IronPort-SDR: j7UiabMnsYzfw6UTHeJH9APWGYKbG+VxXlcdgZPoW9Z2jru7z/ZDGy7stPTgShXM9onWzMEFeO cxQlOn+v7sPw== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 17:04:45 -0700 IronPort-SDR: TH8W7OjpWGFpVi6zlILnC5X5SZw8T4PzOGhHosd3duRWRJTVxv0OzfvYLhUL6c4Vnpya2hRFaw Hni8KP/LyO+g== WDCIronportException: Internal Received: from b9f8262.ad.shared (HELO jedi-01.hgst.com) ([10.86.59.253]) by uls-op-cesaip01.wdc.com with ESMTP; 05 Oct 2020 17:17:58 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [PATCH v4 3/5] riscv: Separate memory init from paging init Date: Mon, 5 Oct 2020 17:17:50 -0700 Message-Id: <20201006001752.248564-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006001752.248564-1-atish.patra@wdc.com> References: <20201006001752.248564-1-atish.patra@wdc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201005_201805_444168_CFB893DE X-CRM114-Status: GOOD ( 14.70 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kefeng Wang , David Hildenbrand , Catalin Marinas , Jonathan Cameron , Atish Patra , Zong Li , linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, Jia He , Anup Patel , "Rafael J. Wysocki" , Steven Price , Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Palmer Dabbelt , Mike Rapoport , Andrew Morton , Nicolas Saenz Julienne Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org Currently, we perform some memory init functions in paging init. But, that will be an issue for NUMA support where DT needs to be flattened before numa initialization and memblock_present can only be called after numa initialization. Move memory initialization related functions to a separate function. Signed-off-by: Atish Patra Reviewed-by: Greentime Hu Reviewed-by: Anup Patel Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/pgtable.h | 1 + arch/riscv/kernel/setup.c | 1 + arch/riscv/mm/init.c | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index eaea1f717010..515b42f98d34 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -466,6 +466,7 @@ static inline void __kernel_map_pages(struct page *page, int numpages, int enabl extern void *dtb_early_va; void setup_bootmem(void); void paging_init(void); +void misc_mem_init(void); #define FIRST_USER_ADDRESS 0 diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 2c6dd329312b..07fa6d13367e 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -78,6 +78,7 @@ void __init setup_arch(char **cmdline_p) #else unflatten_device_tree(); #endif + misc_mem_init(); #ifdef CONFIG_SWIOTLB swiotlb_init(1); diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index ed6e83871112..114c3966aadb 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -565,8 +565,12 @@ static void __init resource_init(void) void __init paging_init(void) { setup_vm_final(); - sparse_init(); setup_zero_page(); +} + +void __init misc_mem_init(void) +{ + sparse_init(); zone_sizes_init(); resource_init(); }