Skip to content

Commit c489dfe

Browse files
robherringYoshinori Sato
authored andcommitted
h8300: switch to NO_BOOTMEM
Commit 0fa1c57 ("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: 0fa1c57 ("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>
1 parent 811d1b0 commit c489dfe

2 files changed

Lines changed: 9 additions & 28 deletions

File tree

‎arch/h8300/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ config H8300
1616
select OF_IRQ
1717
select OF_EARLY_FLATTREE
1818
select HAVE_MEMBLOCK
19+
select NO_BOOTMEM
1920
select TIMER_OF
2021
select H8300_TMR8
2122
select HAVE_KERNEL_GZIP

‎arch/h8300/kernel/setup.c‎

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ void __init h8300_fdt_init(void *fdt, char *bootargs)
7171

7272
static void __init bootmem_init(void)
7373
{
74-
int bootmap_size;
75-
unsigned long ram_start_pfn;
76-
unsigned long free_ram_start_pfn;
77-
unsigned long ram_end_pfn;
7874
struct memblock_region *region;
7975

8076
memory_end = memory_start = 0;
@@ -88,33 +84,17 @@ static void __init bootmem_init(void)
8884
if (!memory_end)
8985
panic("No memory!");
9086

91-
ram_start_pfn = PFN_UP(memory_start);
92-
/* free_ram_start_pfn is first page after kernel */
93-
free_ram_start_pfn = PFN_UP(__pa(_end));
94-
ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
87+
/* setup bootmem globals (we use no_bootmem, but mm still depends on this) */
88+
min_low_pfn = PFN_UP(memory_start);
89+
max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
90+
max_pfn = max_low_pfn;
9591

96-
max_pfn = ram_end_pfn;
92+
memblock_reserve(__pa(_stext), _end - _stext);
9793

98-
/*
99-
* give all the memory to the bootmap allocator, tell it to put the
100-
* boot mem_map at the start of memory
101-
*/
102-
bootmap_size = init_bootmem_node(NODE_DATA(0),
103-
free_ram_start_pfn,
104-
0,
105-
ram_end_pfn);
106-
/*
107-
* free the usable memory, we have to make sure we do not free
108-
* the bootmem bitmap so we then reserve it after freeing it :-)
109-
*/
110-
free_bootmem(PFN_PHYS(free_ram_start_pfn),
111-
(ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT);
112-
reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size,
113-
BOOTMEM_DEFAULT);
94+
early_init_fdt_reserve_self();
95+
early_init_fdt_scan_reserved_mem();
11496

115-
for_each_memblock(reserved, region) {
116-
reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT);
117-
}
97+
memblock_dump_all();
11898
}
11999

120100
void __init setup_arch(char **cmdline_p)

0 commit comments

Comments
 (0)