Skip to content

Commit

Permalink
sparc32: Limit memblock allocation to low memory
Browse files Browse the repository at this point in the history
Commit cca079e changed sparc32 to use
memblocks instead of bootmem, but also made high memory available via
memblock allocation which does not work together with e.g. phys_to_virt
and can lead to kernel panic.

This changes back to only low memory being allocatable in the early
stages, now using memblock allocation.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andreas Larsson authored and David S. Miller committed Feb 19, 2021
1 parent 8befe02 commit bda1669
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/sparc/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
size = memblock_phys_mem_size() - memblock_reserved_size();
*pages_avail = (size >> PAGE_SHIFT) - high_pages;

/* Only allow low memory to be allocated via memblock allocation */
memblock_set_current_limit(max_low_pfn << PAGE_SHIFT);

return max_pfn;
}

Expand Down

0 comments on commit bda1669

Please sign in to comment.