Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: mm: Add check for highmem before removing memory block
@ 2026-06-21 18:47 Kyle Hendry
  2026-06-29 17:13 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Hendry @ 2026-06-21 18:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Kyle Hendry, linux-mips, linux-kernel

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 <kylehendrydev@gmail.com>
---
 arch/mips/mm/init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 1c07ca84ee21..352718e43f69 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -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;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: mm: Add check for highmem before removing memory block
  2026-06-21 18:47 [PATCH] MIPS: mm: Add check for highmem before removing memory block Kyle Hendry
@ 2026-06-29 17:13 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2026-06-29 17:13 UTC (permalink / raw)
  To: Kyle Hendry; +Cc: linux-mips, linux-kernel

On Sun, Jun 21, 2026 at 11:47:02AM -0700, Kyle Hendry wrote:
> 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 <kylehendrydev@gmail.com>
> ---
>  arch/mips/mm/init.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
> index 1c07ca84ee21..352718e43f69 100644
> --- a/arch/mips/mm/init.c
> +++ b/arch/mips/mm/init.c
> @@ -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;
>  	}
>  
> -- 
> 2.43.0

Applied to mips-fixes with

Fixes: f171b55f1441 ("mips: fix HIGHMEM initialization")

added.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-21 18:47 [PATCH] MIPS: mm: Add check for highmem before removing memory block Kyle Hendry
2026-06-29 17:13 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox