Skip to content

Commit

Permalink
h8300, nds32, openrisc: simplify detection of memory extents
Browse files Browse the repository at this point in the history
Instead of traversing memblock.memory regions to find memory_start and
memory_end, simply query memblock_{start,end}_of_DRAM().

Signed-off-by: Mike Rapoport <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Acked-by: Stafford Horne <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Daniel Axtens <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Emil Renner Berthing <[email protected]>
Cc: Hari Bathini <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: Marek Szyprowski <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Russell King <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rppt authored and torvalds committed Oct 14, 2020
1 parent ab8f21a commit 80c4574
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
8 changes: 3 additions & 5 deletions arch/h8300/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ static void __init bootmem_init(void)
memory_end = memory_start = 0;

/* Find main memory where is the kernel */
for_each_memblock(memory, region) {
memory_start = region->base;
memory_end = region->base + region->size;
}
memory_start = memblock_start_of_DRAM();
memory_end = memblock_end_of_DRAM();

if (!memory_end)
panic("No memory!");

/* setup bootmem globals (we use no_bootmem, but mm still depends on this) */
min_low_pfn = PFN_UP(memory_start);
max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
max_low_pfn = PFN_DOWN(memory_end);
max_pfn = max_low_pfn;

memblock_reserve(__pa(_stext), _end - _stext);
Expand Down
8 changes: 2 additions & 6 deletions arch/nds32/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,8 @@ static void __init setup_memory(void)
memory_end = memory_start = 0;

/* Find main memory where is the kernel */
for_each_memblock(memory, region) {
memory_start = region->base;
memory_end = region->base + region->size;
pr_info("%s: Memory: 0x%x-0x%x\n", __func__,
memory_start, memory_end);
}
memory_start = memblock_start_of_DRAM();
memory_end = memblock_end_of_DRAM();

if (!memory_end) {
panic("No memory!");
Expand Down
9 changes: 2 additions & 7 deletions arch/openrisc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,12 @@ static void __init setup_memory(void)
unsigned long ram_start_pfn;
unsigned long ram_end_pfn;
phys_addr_t memory_start, memory_end;
struct memblock_region *region;

memory_end = memory_start = 0;

/* Find main memory where is the kernel, we assume its the only one */
for_each_memblock(memory, region) {
memory_start = region->base;
memory_end = region->base + region->size;
printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__,
memory_start, memory_end);
}
memory_start = memblock_start_of_DRAM();
memory_end = memblock_end_of_DRAM();

if (!memory_end) {
panic("No memory!");
Expand Down

0 comments on commit 80c4574

Please sign in to comment.