Received: by 10.192.165.148 with SMTP id m20csp5101117imm; Tue, 8 May 2018 22:21:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo4gWE9HuALq4842hjZ3Z8FUTqrwe8uNIRxM3leAmuJMMMlxEJeqMjhpy4Zy5W/UvLOnuYi X-Received: by 2002:a63:4383:: with SMTP id q125-v6mr35532744pga.412.1525843284275; Tue, 08 May 2018 22:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525843284; cv=none; d=google.com; s=arc-20160816; b=vLxtpTtivBvtPz+YRVrRlwNo8U8IaW+Pzle6U+8vC7nc9D0WfKPmWKxgjJInyxjj+9 NR1mXkQ5pMpO1/JsnltvZpHQmKkReHDgiQ97P1AKNQaLMykeS4jlOtWsf46otHK0G5j1 dBs2btTP6uwjMkgUta0afT/fG/htfd0dloccBxg6ni7PYbNnKaQJHUaFJw4g7gygOruf Q/mpnoKkLwwBhXTMZsj1YIIODdrLg8+8tJxiYGRrD26PEvSvrvkAK8dNDonZb1OoDdjq gruNrZAzd9YxvlBUONUKsqOd5LRewv4dup35XMS6e+Mp9KkdtKyCE0gUxivS6KYzCx5m sO0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=w5tGygZNOVjGglEmvo3uwAMuFDdtTwgPTEorkdeOV2w=; b=mglCH6wlqZp9YV833qCoFzUwv0douWwt+c6TMV8QtdDLQEpVq8qwG73Cx3dnSt/QlG SGhGhxyPGejgjoiwc0jua4Wd/T6RbKl/kC6jq3xwia/7dbeWOKobXr30N/coEGsOxtl2 SJMmB/c7wnM9tENCKz6+YUNOvyMRapKgwpVMCQZIwVgaGdoqmU05jvxRa7uel8Kh79Mc 5uCMk4ZGuL37eHyr0HChmNFfs+BjF0QFRixsHdzBY4wk50DEI77rVCO6ComRTRkj+XCV mPpwQ7z+G8rmYwofP6hJz4hB4FP65uuK4HxYiX+NZN852hFwlqv96e9dwEZ/gNy7HFoR 7D2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si25687572plz.364.2018.05.08.22.21.09; Tue, 08 May 2018 22:21:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933558AbeEIFUm (ORCPT + 99 others); Wed, 9 May 2018 01:20:42 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:32843 "EHLO mail02.asahi-net.or.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbeEIFUl (ORCPT ); Wed, 9 May 2018 01:20:41 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.vps.ablenet.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 4C414D151A; Wed, 9 May 2018 14:20:39 +0900 (JST) Received: from sa76r4.ysato.ml (ae199118.dynamic.ppp.asahi-net.or.jp [14.3.199.118]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 5A2C6240070; Wed, 9 May 2018 14:20:36 +0900 (JST) Date: Wed, 09 May 2018 14:20:32 +0900 Message-ID: <87efil76cf.wl-ysato@users.sourceforge.jp> From: Yoshinori Sato To: Rob Herring Cc: linux-kernel@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp Subject: Re: [PATCH] h8300: switch to NO_BOOTMEM In-Reply-To: <20180316213306.20424-1-robh@kernel.org> References: <20180316213306.20424-1-robh@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Mar 2018 06:33:06 +0900, Rob Herring wrote: > > Commit 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc") > inadvertently switched the DT unflattening allocations from memblock to > bootmem which doesn't work because the unflattening happens before > bootmem is initialized. Swapping the order of bootmem init and > unflattening could also fix this, but removing bootmem is desired. So > enable NO_BOOTMEM on h8300 like other architectures have done. > > Fixes: 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc") > Cc: Yoshinori Sato > Cc: uclinux-h8-devel@lists.sourceforge.jp > Signed-off-by: Rob Herring > --- > I haven't seen any reports, but 4.16 is likely broken. This is compile > tested only. > > Moving unflattening after bootmem_init should also work if a smaller > change for 4.16 is desired. It's works fine. Applied to h8300-next. Thanks. > Rob > > arch/h8300/Kconfig | 1 + > arch/h8300/kernel/setup.c | 36 ++++++++---------------------------- > 2 files changed, 9 insertions(+), 28 deletions(-) > > diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig > index 091d6d04b5e5..efc602634064 100644 > --- a/arch/h8300/Kconfig > +++ b/arch/h8300/Kconfig > @@ -16,6 +16,7 @@ config H8300 > select OF_IRQ > select OF_EARLY_FLATTREE > select HAVE_MEMBLOCK > + select NO_BOOTMEM > select TIMER_OF > select H8300_TMR8 > select HAVE_KERNEL_GZIP > diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c > index a4d0470c10a9..33ed980e7aea 100644 > --- a/arch/h8300/kernel/setup.c > +++ b/arch/h8300/kernel/setup.c > @@ -71,10 +71,6 @@ void __init h8300_fdt_init(void *fdt, char *bootargs) > > static void __init bootmem_init(void) > { > - int bootmap_size; > - unsigned long ram_start_pfn; > - unsigned long free_ram_start_pfn; > - unsigned long ram_end_pfn; > struct memblock_region *region; > > memory_end = memory_start = 0; > @@ -88,33 +84,17 @@ static void __init bootmem_init(void) > if (!memory_end) > panic("No memory!"); > > - ram_start_pfn = PFN_UP(memory_start); > - /* free_ram_start_pfn is first page after kernel */ > - free_ram_start_pfn = PFN_UP(__pa(_end)); > - ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM()); > + /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ > + min_low_pfn = PFN_UP(memory_start); > + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); > + max_pfn = max_low_pfn; > > - max_pfn = ram_end_pfn; > + memblock_reserve(__pa(_stext), _end - _stext); > > - /* > - * give all the memory to the bootmap allocator, tell it to put the > - * boot mem_map at the start of memory > - */ > - bootmap_size = init_bootmem_node(NODE_DATA(0), > - free_ram_start_pfn, > - 0, > - ram_end_pfn); > - /* > - * free the usable memory, we have to make sure we do not free > - * the bootmem bitmap so we then reserve it after freeing it :-) > - */ > - free_bootmem(PFN_PHYS(free_ram_start_pfn), > - (ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT); > - reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size, > - BOOTMEM_DEFAULT); > + early_init_fdt_reserve_self(); > + early_init_fdt_scan_reserved_mem(); > > - for_each_memblock(reserved, region) { > - reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT); > - } > + memblock_dump_all(); > } > > void __init setup_arch(char **cmdline_p) > -- > 2.14.1 > -- Yoshinori Sato