MIPS: mm: Add check for highmem before removing memory block
PATCH 1/1 MIPS: mm: Add check for highmem before removing memory block
If a device has less physical memory than the highmem threshold bootmem_init() doesn't set highstart_pfn. This results in highmem_init() wrongly disabling the entire memory range if the cpu doesn't support highmem. Add a check that highstart_pfn is non zero before removing the highmem block.
Signed-off-by Kyle Hendry <[email protected]>
--- arch/mips/mm/init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/mm/init.c +3 -2
@@ -426,10 +426,11 @@ static inline void __init highmem_init(void)unsigned long tmp;/* -* If CPU cannot support HIGHMEM discard the memory above highstart_pfn +* If CPU cannot support HIGHMEM discard any memory above highstart_pfn */ if (cpu_has_dc_aliases) { -memblock_remove (PFN_PHYS (highstart_pfn),-1 ); +if (highstart_pfn) +memblock_remove (PFN_PHYS (highstart_pfn),-1 );return ; }
Signature · 1 line
2.43.0
Quoted 31 lines · Kyle Hendry
If a device has less physical memory than the highmem threshold
bootmem_init()doesn't sethighstart_pfn. This results inhighmem_init()wrongly disabling the entire memory range if the cpu doesn't support highmem. Add a check thathighstart_pfnis non zero before removing the highmem block.Signed-off-by Kyle Hendry <[email protected]>--- arch/mips/mm/init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/mips/mm/init.c +3
-2@@ -426,10 +426,11 @@ static inline void __init highmem_init(void)unsigned long tmp;/* -* If CPU cannot support HIGHMEM discard the memory above highstart_pfn +* If CPU cannot support HIGHMEM discard any memory above highstart_pfn */ if (cpu_has_dc_aliases) { -memblock_remove (PFN_PHYS (highstart_pfn),-1 ); +if (highstart_pfn) +memblock_remove (PFN_PHYS (highstart_pfn),-1 );return ; }Signature · 1 line
2.43.0
Applied to mips-fixes with
Fixes f171b55f1441 ("mips: fix HIGHMEM initialization")
added.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]