Skip to content

Commit e92d39c

Browse files
rppttorvalds
authored andcommitted
unicore32: switch to NO_BOOTMEM
The unicore32 architecture already supports memblock and uses it for some early memory reservations, e.g initrd and the page tables. At some point unicore32 allocates the bootmem bitmap from the memblock and then hands over the memory reservations from memblock to bootmem. This patch removes the bootmem initialization and leaves memblock as the only boot time memory manager for unicore32. Link: http://lkml.kernel.org/r/1533326330-31677-8-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Acked-by: Guan Xuetao <gxt@pku.edu.cn> Cc: Ley Foon Tan <ley.foon.tan@intel.com> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Richard Weinberger <richard@nod.at> Cc: Rob Herring <robh@kernel.org> Cc: Michal Hocko <mhocko@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ddf6398 commit e92d39c

2 files changed

Lines changed: 2 additions & 53 deletions

File tree

‎arch/unicore32/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config UNICORE32
66
select ARCH_MIGHT_HAVE_PC_SERIO
77
select DMA_DIRECT_OPS
88
select HAVE_MEMBLOCK
9+
select NO_BOOTMEM
910
select HAVE_GENERIC_DMA_COHERENT
1011
select HAVE_KERNEL_GZIP
1112
select HAVE_KERNEL_BZIP2

‎arch/unicore32/mm/init.c‎

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -84,58 +84,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
8484
}
8585
}
8686

87-
static void __init uc32_bootmem_init(unsigned long start_pfn,
88-
unsigned long end_pfn)
89-
{
90-
struct memblock_region *reg;
91-
unsigned int boot_pages;
92-
phys_addr_t bitmap;
93-
pg_data_t *pgdat;
94-
95-
/*
96-
* Allocate the bootmem bitmap page. This must be in a region
97-
* of memory which has already been mapped.
98-
*/
99-
boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
100-
bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
101-
__pfn_to_phys(end_pfn));
102-
103-
/*
104-
* Initialise the bootmem allocator, handing the
105-
* memory banks over to bootmem.
106-
*/
107-
node_set_online(0);
108-
pgdat = NODE_DATA(0);
109-
init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
110-
111-
/* Free the lowmem regions from memblock into bootmem. */
112-
for_each_memblock(memory, reg) {
113-
unsigned long start = memblock_region_memory_base_pfn(reg);
114-
unsigned long end = memblock_region_memory_end_pfn(reg);
115-
116-
if (end >= end_pfn)
117-
end = end_pfn;
118-
if (start >= end)
119-
break;
120-
121-
free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
122-
}
123-
124-
/* Reserve the lowmem memblock reserved regions in bootmem. */
125-
for_each_memblock(reserved, reg) {
126-
unsigned long start = memblock_region_reserved_base_pfn(reg);
127-
unsigned long end = memblock_region_reserved_end_pfn(reg);
128-
129-
if (end >= end_pfn)
130-
end = end_pfn;
131-
if (start >= end)
132-
break;
133-
134-
reserve_bootmem(__pfn_to_phys(start),
135-
(end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
136-
}
137-
}
138-
13987
static void __init uc32_bootmem_free(unsigned long min, unsigned long max_low,
14088
unsigned long max_high)
14189
{
@@ -232,7 +180,7 @@ void __init bootmem_init(void)
232180

233181
find_limits(&min, &max_low, &max_high);
234182

235-
uc32_bootmem_init(min, max_low);
183+
node_set_online(0);
236184

237185
/*
238186
* Sparsemem tries to allocate bootmem in memory_present(),

0 commit comments

Comments
 (0)