Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: don't pass high memory to bootmem allocator

This fixes panic when booting on machine with more than 128M memory
passed from the bootloader.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+9 -4
+9 -4
arch/xtensa/mm/init.c
··· 90 90 91 91 92 92 /* 93 - * Initialize the bootmem system and give it all the memory we have available. 93 + * Initialize the bootmem system and give it all low memory we have available. 94 94 */ 95 95 96 96 void __init bootmem_init(void) ··· 142 142 143 143 /* Add all remaining memory pieces into the bootmem map */ 144 144 145 - for (i=0; i<sysmem.nr_banks; i++) 146 - free_bootmem(sysmem.bank[i].start, 147 - sysmem.bank[i].end - sysmem.bank[i].start); 145 + for (i = 0; i < sysmem.nr_banks; i++) { 146 + if (sysmem.bank[i].start >> PAGE_SHIFT < max_low_pfn) { 147 + unsigned long end = min(max_low_pfn << PAGE_SHIFT, 148 + sysmem.bank[i].end); 149 + free_bootmem(sysmem.bank[i].start, 150 + end - sysmem.bank[i].start); 151 + } 152 + } 148 153 149 154 } 150 155