Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp661130pxb; Thu, 5 Nov 2020 09:36:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpK8YIsj1tCNCZtop9zN3kJ4+UHy2GUPnrIbIrcMjYLuEv8v/JRbsdTQGn0fRxM1G5mre1 X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr3338402ejh.168.1604597783594; Thu, 05 Nov 2020 09:36:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604597783; cv=none; d=google.com; s=arc-20160816; b=SaGG/4z/E/kncdqk1qpxv40IUjP5RIAQ2oOj6k0eWOZFUgaAGGJeWnantu/MRCW0xu 5MJYjuDsDn8bIgTUoJM14lmDImJDU00wEooJT+oIlERyJcMJYRI4lnwdrsN3q10qZmwm tO8eoPBz2lPIt/DNIDmWem0/ItBqqJ2myN1Q/xcTTS0lNvYKpCQT3hl714y0uho5NHcb IgtLoxtDsOtJ8yhKbUM9RwdM8gBhD1E2zHfUL6IPphx2cw7dGmY1i7gUFcIaZuayLWmb rmwKU3AKWpfB8sfzZE4UE+RhyrgpyX5vY9STbqriB7EpoPmdfDSRHWRGC0MUiUyl0BQw B9pQ== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=BNUKSCGWkc6CIawczqK2wZtYLRe3Vlhmmh+CKSA+3+c=; b=OSL+fiYv38FJr57u73gopwNhNhLKdVvzDbNRr0ggsYcShvtFDV5I4ehUmdbr7+DzjY EKRCJa9hSRTdCu29nsVKtEbKdcov03NBGC8Q1Med9T+2v20NyXt4VZ+ZfBv9DeoepZmA Ilhod6i1jHXtmdLAgzSNfdbRq2NG+ykB2JClkzTRcOt/tLd8/9lIO7HIy6P8ynQH9Apj I6ddCBCUmIPjFuxc9hGVcewGGpBXp+NmR01I+aIiHky75Gqac/KAfCj4fbHG6mQiYVXK o87v+aXm4VxREKESFdQBCxQiqFoIGRXmTUelaOjrlioWSdkRDkYU9aJNGc6+NZ6HTSMS HzzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=lzbVQmsn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr15si1675169ejb.250.2020.11.05.09.35.59; Thu, 05 Nov 2020 09:36:23 -0800 (PST) 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=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=lzbVQmsn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731724AbgKEReG (ORCPT + 99 others); Thu, 5 Nov 2020 12:34:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731677AbgKEReC (ORCPT ); Thu, 5 Nov 2020 12:34:02 -0500 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F37C0613CF for ; Thu, 5 Nov 2020 09:34:02 -0800 (PST) Received: by mail-pj1-x1041.google.com with SMTP id f12so426367pjp.4 for ; Thu, 05 Nov 2020 09:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=BNUKSCGWkc6CIawczqK2wZtYLRe3Vlhmmh+CKSA+3+c=; b=lzbVQmsnHGQrz4/Uh0fYZi54IjSFhyftDYTHwIkpshJXq9uFE86Pa9KWtVjBqWJ7yd onq3vAXQjTajSdGzQNX20E/F+aTUTqCib4eZOiqNtlC/7QkS53dFygSpG/W3sUaNJt5c qziTHhbP7erX23zyVe1C/vgsPyjRg7S59nO505Ef8FRnRDFDEHb7eJus9H8y7UOL0GcD kz5bw5d7wVOPW8Ro0wVtFiDoGvk6pa/TQguCGQJNwdYqoy8N7CCh6wwBSGCc2nivqMeC LVMIsZUmFNl9BJeJW24JmrCWWop64Jw79jkqnvLrQ4fzrQemdE2L/D6hiptAVeXhATd9 9EXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=BNUKSCGWkc6CIawczqK2wZtYLRe3Vlhmmh+CKSA+3+c=; b=SzOwM0DyF35aInZxoXrsfbvcqH3FHEK3mTqfxkA5rjF7Z6MO+V3VNiJ/xknwQ9p61V 0wbijsfxus6Fi11Ekt0SbceJCkezbHcoo4OdNnU/cByBM5YbeNtNvuhc5Yyqz5bz/5RW RAZAXsbc5C8FrGP/SrkQuGJoS1dMP4YkLoJhppnIz/0Dtnq//WprIuZdTZVEPjRGBewb hJ6RBGZzAvCSnZJGgjxbDejtA3bQVGAiGEwGLTozZ/og3uQt6pl2bFxjcRaDNGq8xNiI nINu9+udrI4hlathw0X7930PfezXk4Rxz/ecg/jSWOT95xuNVzXa5NPRWTa66EFKp533 r8Gw== X-Gm-Message-State: AOAM531pLfCUKNaLWCHOWdcZKcRByrbvV0oIH1ipGhAPLfjXbYwgDbRE /NtuFoU0SAwzxGjLKed7QuaRPnO18XWmmA== X-Received: by 2002:a17:902:23:b029:d6:2387:55e1 with SMTP id 32-20020a1709020023b02900d6238755e1mr3120958pla.8.1604597641453; Thu, 05 Nov 2020 09:34:01 -0800 (PST) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id c11sm2964888pgl.20.2020.11.05.09.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 09:34:00 -0800 (PST) Date: Thu, 05 Nov 2020 09:34:00 -0800 (PST) X-Google-Original-Date: Wed, 04 Nov 2020 14:01:41 PST (-0800) Subject: Re: [PATCH v4 3/5] riscv: Separate memory init from paging init In-Reply-To: <20201006001752.248564-4-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, Atish Patra , greentime.hu@sifive.com, aou@eecs.berkeley.edu, akpm@linux-foundation.org, anshuman.khandual@arm.com, anup@brainfault.org, Arnd Bergmann , catalin.marinas@arm.com, david@redhat.com, Greg KH , justin.he@arm.com, Jonathan.Cameron@huawei.com, wangkefeng.wang@huawei.com, linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, rppt@kernel.org, nsaenzjulienne@suse.de, Paul Walmsley , rafael@kernel.org, steven.price@arm.com, will@kernel.org, zong.li@sifive.com, linux-arm-kernel@lists.infradead.org From: Palmer Dabbelt To: Atish Patra Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 05 Oct 2020 17:17:50 PDT (-0700), Atish Patra wrote: > 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 > --- > 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(); > } Reviewed-by: Palmer Dabbelt