Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5418245pxu; Thu, 22 Oct 2020 01:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0/uKo3SEpsa8Yq0XdEkwSmot+GRST2URtPtw8cQ1i5lT5tRAaqAkJEvHyhp5ltXTrAho5 X-Received: by 2002:a05:6402:890:: with SMTP id e16mr1194890edy.272.1603355519606; Thu, 22 Oct 2020 01:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603355519; cv=none; d=google.com; s=arc-20160816; b=vzwm3lrfPyrVTLZ+ul9qyXWDgr7/Qtd/ZqvFNmdBLr4SIO25HYMpouKtOruUt7pk/n xdyRfbzNR4Ek78CuY070gSRsGRSmTRCxtSvvAgZtEWVeIf+OGQcHcoAHnnvUXBoz/MSF i60ILddr8HtrfG3HKdKn/0/0XdVas1YnSkY7OdPgKdXawaSZVUJcMxiFBU0PMT/Ocd32 nOVi+GoCsy9j82vHTPVmK0AHAJmwLyCQR755bthuEpMF0iDf29Uf6KoyQQKfxeCQH7VS soFow6RT/y+CIqLDI/+UeZ5S2U9arPKlbvA4uaTm+xD2JRuExi5czZeOikXbcmUj5dyU IwPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2FJ6bgUzNaVY5TwTxhI5fSUYbPLg9JNdup4mEtOxeyg=; b=rUNHZ9pW76N8zaLqW9pz+m7qPmTU3ga6e8+eZn+pHfLH3QrR6P08/qoqLBECvT2f3Q wCB4QYmZkeZ7CZpmy1bmZiVs+ojAsPQhQfN8D6ihzHuxxD3StZbb1TfWKzAXv3vwdUMT buXmESw5SRNAnp3GuQnkj9vvkFpE7kjtglQI20Vd2bmELSH8IrrtXj95l7VoW1q7GFzt /m5UpEDIu+kDrbhZ37+J4wy2lUAYpA99q/D814rU5Mk+t+dTAY8R69nhBilbcd5uW8gv Ixd+6Objuea8q7Hdl5C7U+NlAJUdnMd9l/qZ7OqHnhL+SfzTI98pGosLP3Q3Eu21klVP M68A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=Y9Bl1j6Y; 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 c11si679331edy.27.2020.10.22.01.31.37; Thu, 22 Oct 2020 01:31:59 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=Y9Bl1j6Y; 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 S2444532AbgJVFiK (ORCPT + 99 others); Thu, 22 Oct 2020 01:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2444512AbgJVFiK (ORCPT ); Thu, 22 Oct 2020 01:38:10 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5E9C0613CF for ; Wed, 21 Oct 2020 22:38:10 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id h5so540215wrv.7 for ; Wed, 21 Oct 2020 22:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2FJ6bgUzNaVY5TwTxhI5fSUYbPLg9JNdup4mEtOxeyg=; b=Y9Bl1j6Yr57hSOSVPd/mu8/0LKB/sUaN+4OYq3aFF90Ul5QrtkCiVNH9L8jrUjSMo1 BOKxsr/7fKRiQpN4kVGgEBqVtWszTvShe7lZdbiv6L+NLtOizZUgujXoZvT2TROyZNLx zJdukWtwTTaJzdJoCyxafO4cLJd0w6GUarS9y0hhBoEjh7EAz3ipVzS+BZeksfTcJ5aq wnHp4uFAiQq8uwfU3SZkrdpi1ZRZavZERN4yLWk7B//b8QjJsPq+nwqJOB5qXVbbWAae FQk9F0x2v9qjKeAsX4OYBfYNubscNVPxafc3jwllMwr2lKF5yAW2F+0L+RR0jcFJ2dTr c3Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2FJ6bgUzNaVY5TwTxhI5fSUYbPLg9JNdup4mEtOxeyg=; b=MN2z14Xj8PRtYRSwi7TnNQ0s/294Vn+VC1w9Hp8rf5OTnzwQAdVbLPp6sGJy7tUx5T K51E1JQgI+OQDXHt7vMnR9w43PCrBkMcAngr2Ur4fiG3A6QCyaEAcLEl8xD9/ja2lBbz nl76ILa6Pn8fcA+xyYTZND89QOXOhjm1vp+fsrn7pJn9eE3/vhN0toKVEXvWVO68mzeE SgjYe0+Hwr3cqhaNAUMZrLntSRB/mOj4d92CyLzh+i5u+NwXou4Qr01+nVzvk8yu+Bxm 3oxXjdTV8j5HCP/uheyrFiqf5mnrkm6pIR3Q2/fMo0G68FevJ+v1VK0204RR2V9WQmLQ QkPw== X-Gm-Message-State: AOAM530S45Y/NekEcPRoE5/whz9Z9xI6sOP7RVYS3jJxB3GSGn/Kdz8a tDSjoMtFtIS8nfuf+cbWFnPgHPBPodXLWO5oOPjQrw== X-Received: by 2002:a5d:6681:: with SMTP id l1mr731145wru.356.1603345088654; Wed, 21 Oct 2020 22:38:08 -0700 (PDT) MIME-Version: 1.0 References: <20201006001752.248564-1-atish.patra@wdc.com> <20201006001752.248564-4-atish.patra@wdc.com> In-Reply-To: <20201006001752.248564-4-atish.patra@wdc.com> From: Anup Patel Date: Thu, 22 Oct 2020 11:07:57 +0530 Message-ID: Subject: Re: [PATCH v4 3/5] riscv: Separate memory init from paging init To: Atish Patra Cc: "linux-kernel@vger.kernel.org List" , Greentime Hu , Albert Ou , Andrew Morton , Anshuman Khandual , Arnd Bergmann , Catalin Marinas , David Hildenbrand , Greg Kroah-Hartman , Jia He , Jonathan Cameron , Kefeng Wang , linux-arch@vger.kernel.org, linux-riscv , Mike Rapoport , Nicolas Saenz Julienne , Palmer Dabbelt , Paul Walmsley , "Rafael J. Wysocki" , Steven Price , Will Deacon , Zong Li , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 6, 2020 at 5:48 AM 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(); > } > -- > 2.25.1 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup