summaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorAndreas Larsson <andreas@gaisler.com>2021-02-05 14:20:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 16:43:46 +0100
commitcb206ed9a020cca3b0e036dc5e5bde7d156391fb (patch)
tree5d6fba82d89c8dc9380d95bf594b23e3dbcee0f3 /arch/sparc
parentb6d302a8613f8335c4a57db944f09c5565a0d235 (diff)
downloadlinux-stable-cb206ed9a020cca3b0e036dc5e5bde7d156391fb.tar.gz
linux-stable-cb206ed9a020cca3b0e036dc5e5bde7d156391fb.tar.bz2
linux-stable-cb206ed9a020cca3b0e036dc5e5bde7d156391fb.zip
sparc32: Limit memblock allocation to low memory
[ Upstream commit bda166930c37604ffa93f2425426af6921ec575a ] Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/mm/init_32.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 92634d4e440c..89a9244f2cf0 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -199,6 +199,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;
}