Skip to content

Commit dd2d082

Browse files
Kefeng Wangpalmer-dabbelt
authored andcommitted
riscv: Cleanup setup_bootmem()
After the following patches, commit de043da ("RISC-V: Fix usage of memblock_enforce_memory_limit") commit 1bd14a6 ("RISC-V: Remove any memblock representing unusable memory area") commit b10d6bc ("arch, drivers: replace for_each_membock() with for_each_mem_range()") some logic is useless, kill the mem_start/start/end and unneeded code. Reviewed-by: Atish Patra <[email protected]> Signed-off-by: Kefeng Wang <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent b122c7a commit dd2d082

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

arch/riscv/mm/init.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,17 @@ void __init mem_init(void)
108108

109109
void __init setup_bootmem(void)
110110
{
111-
phys_addr_t mem_start = 0;
112-
phys_addr_t start, dram_end, end = 0;
113111
phys_addr_t vmlinux_end = __pa_symbol(&_end);
114112
phys_addr_t vmlinux_start = __pa_symbol(&_start);
113+
phys_addr_t dram_end = memblock_end_of_DRAM();
115114
phys_addr_t max_mapped_addr = __pa(~(ulong)0);
116-
u64 i;
117-
118-
/* Find the memory region containing the kernel */
119-
for_each_mem_range(i, &start, &end) {
120-
phys_addr_t size = end - start;
121-
if (!mem_start)
122-
mem_start = start;
123-
if (start <= vmlinux_start && vmlinux_end <= end)
124-
BUG_ON(size == 0);
125-
}
126115

127-
/*
128-
* The maximal physical memory size is -PAGE_OFFSET.
129-
* Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
130-
* as it is unusable by kernel.
131-
*/
116+
/* The maximal physical memory size is -PAGE_OFFSET. */
132117
memblock_enforce_memory_limit(-PAGE_OFFSET);
133118

134119
/* Reserve from the start of the kernel to the end of the kernel */
135120
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
136121

137-
dram_end = memblock_end_of_DRAM();
138-
139122
/*
140123
* memblock allocator is not aware of the fact that last 4K bytes of
141124
* the addressable memory can not be mapped because of IS_ERR_VALUE

0 commit comments

Comments
 (0)