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

mips: fix HIGHMEM initialization

Commit 6faea3422e3b ("arch, mm: streamline HIGHMEM freeing") overzealously
removed mem_init_free_highmem() function that beside freeing high memory
pages checked for CPU support for high memory as a prerequisite.

Partially restore mem_init_free_highmem() with a new highmem_init() name
and make it discard high memory in case there is no CPU support for it.

Link: https://lkml.kernel.org/r/20251231105701.519711-1-rppt@kernel.org
Fixes: 6faea3422e3b ("arch, mm: streamline HIGHMEM freeing")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reported-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Mike Rapoport (Microsoft) and committed by
Andrew Morton
f171b55f b0201916

+23
+23
arch/mips/mm/init.c
··· 425 425 static struct kcore_list kcore_kseg0; 426 426 #endif 427 427 428 + static inline void __init highmem_init(void) 429 + { 430 + #ifdef CONFIG_HIGHMEM 431 + unsigned long tmp; 432 + 433 + /* 434 + * If CPU cannot support HIGHMEM discard the memory above highstart_pfn 435 + */ 436 + if (cpu_has_dc_aliases) { 437 + memblock_remove(PFN_PHYS(highstart_pfn), -1); 438 + return; 439 + } 440 + 441 + for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { 442 + struct page *page = pfn_to_page(tmp); 443 + 444 + if (!memblock_is_memory(PFN_PHYS(tmp))) 445 + SetPageReserved(page); 446 + } 447 + #endif 448 + } 449 + 428 450 void __init arch_mm_preinit(void) 429 451 { 430 452 /* ··· 457 435 458 436 maar_init(); 459 437 setup_zero_pages(); /* Setup zeroed pages. */ 438 + highmem_init(); 460 439 461 440 #ifdef CONFIG_64BIT 462 441 if ((unsigned long) &_text > (unsigned long) CKSEG0)