Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

h8300: switch to NO_BOOTMEM

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 <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

authored by

Rob Herring and committed by
Yoshinori Sato
c489dfef 811d1b0e

+9 -28
+1
arch/h8300/Kconfig
··· 16 16 select OF_IRQ 17 17 select OF_EARLY_FLATTREE 18 18 select HAVE_MEMBLOCK 19 + select NO_BOOTMEM 19 20 select TIMER_OF 20 21 select H8300_TMR8 21 22 select HAVE_KERNEL_GZIP
+8 -28
arch/h8300/kernel/setup.c
··· 71 71 72 72 static void __init bootmem_init(void) 73 73 { 74 - int bootmap_size; 75 - unsigned long ram_start_pfn; 76 - unsigned long free_ram_start_pfn; 77 - unsigned long ram_end_pfn; 78 74 struct memblock_region *region; 79 75 80 76 memory_end = memory_start = 0; ··· 84 88 if (!memory_end) 85 89 panic("No memory!"); 86 90 87 - ram_start_pfn = PFN_UP(memory_start); 88 - /* free_ram_start_pfn is first page after kernel */ 89 - free_ram_start_pfn = PFN_UP(__pa(_end)); 90 - ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM()); 91 + /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ 92 + min_low_pfn = PFN_UP(memory_start); 93 + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); 94 + max_pfn = max_low_pfn; 91 95 92 - max_pfn = ram_end_pfn; 96 + memblock_reserve(__pa(_stext), _end - _stext); 93 97 94 - /* 95 - * give all the memory to the bootmap allocator, tell it to put the 96 - * boot mem_map at the start of memory 97 - */ 98 - bootmap_size = init_bootmem_node(NODE_DATA(0), 99 - free_ram_start_pfn, 100 - 0, 101 - ram_end_pfn); 102 - /* 103 - * free the usable memory, we have to make sure we do not free 104 - * the bootmem bitmap so we then reserve it after freeing it :-) 105 - */ 106 - free_bootmem(PFN_PHYS(free_ram_start_pfn), 107 - (ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT); 108 - reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size, 109 - BOOTMEM_DEFAULT); 98 + early_init_fdt_reserve_self(); 99 + early_init_fdt_scan_reserved_mem(); 110 100 111 - for_each_memblock(reserved, region) { 112 - reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT); 113 - } 101 + memblock_dump_all(); 114 102 } 115 103 116 104 void __init setup_arch(char **cmdline_p)