riscv: Cleanup setup_bootmem()
After the following patches, commitde043da0b9
("RISC-V: Fix usage of memblock_enforce_memory_limit") commit1bd14a66ee
("RISC-V: Remove any memblock representing unusable memory area") commitb10d6bca87
("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 <atish.patra@wdc.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
b122c7a325
commit
dd2d082b57
1 changed files with 2 additions and 19 deletions
|
@ -108,34 +108,17 @@ void __init mem_init(void)
|
||||||
|
|
||||||
void __init setup_bootmem(void)
|
void __init setup_bootmem(void)
|
||||||
{
|
{
|
||||||
phys_addr_t mem_start = 0;
|
|
||||||
phys_addr_t start, dram_end, end = 0;
|
|
||||||
phys_addr_t vmlinux_end = __pa_symbol(&_end);
|
phys_addr_t vmlinux_end = __pa_symbol(&_end);
|
||||||
phys_addr_t vmlinux_start = __pa_symbol(&_start);
|
phys_addr_t vmlinux_start = __pa_symbol(&_start);
|
||||||
|
phys_addr_t dram_end = memblock_end_of_DRAM();
|
||||||
phys_addr_t max_mapped_addr = __pa(~(ulong)0);
|
phys_addr_t max_mapped_addr = __pa(~(ulong)0);
|
||||||
u64 i;
|
|
||||||
|
|
||||||
/* Find the memory region containing the kernel */
|
/* The maximal physical memory size is -PAGE_OFFSET. */
|
||||||
for_each_mem_range(i, &start, &end) {
|
|
||||||
phys_addr_t size = end - start;
|
|
||||||
if (!mem_start)
|
|
||||||
mem_start = start;
|
|
||||||
if (start <= vmlinux_start && vmlinux_end <= end)
|
|
||||||
BUG_ON(size == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The maximal physical memory size is -PAGE_OFFSET.
|
|
||||||
* Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
|
|
||||||
* as it is unusable by kernel.
|
|
||||||
*/
|
|
||||||
memblock_enforce_memory_limit(-PAGE_OFFSET);
|
memblock_enforce_memory_limit(-PAGE_OFFSET);
|
||||||
|
|
||||||
/* Reserve from the start of the kernel to the end of the kernel */
|
/* Reserve from the start of the kernel to the end of the kernel */
|
||||||
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
|
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
|
||||||
|
|
||||||
dram_end = memblock_end_of_DRAM();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* memblock allocator is not aware of the fact that last 4K bytes of
|
* memblock allocator is not aware of the fact that last 4K bytes of
|
||||||
* the addressable memory can not be mapped because of IS_ERR_VALUE
|
* the addressable memory can not be mapped because of IS_ERR_VALUE
|
||||||
|
|
Loading…
Add table
Reference in a new issue