[PATCH] ARM: set MAX_PHYSMEM_BITS to 32 for !LPAE

Karl Mehltretter kmehltretter at gmail.com
Thu Jul 23 23:30:48 PDT 2026


The default MAX_PHYSMEM_BITS of 36 was introduced for LPAE platforms,
but also applies to non-LPAE ARM, which has 32-bit physical addresses.
With GET_FREE_REGION and CONFIG_WERROR, this causes:

  error: conversion from 'long long unsigned int' to 'resource_size_t'
  changes value from '68719476735' to '4294967295'

Use a 36-bit default only for LPAE builds.

Fixes: db57f88e4ccb ("ARM: 8411/1: Add default SPARSEMEM settings")
Assisted-by: Claude:claude-fable-5
---
 arch/arm/include/asm/sparsemem.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/include/asm/sparsemem.h b/arch/arm/include/asm/sparsemem.h
index 421e3415338a..6b512be3a34a 100644
--- a/arch/arm/include/asm/sparsemem.h
+++ b/arch/arm/include/asm/sparsemem.h
@@ -19,7 +19,11 @@
  * These can be overridden in your mach/memory.h.
  */
 #if !defined(MAX_PHYSMEM_BITS) || !defined(SECTION_SIZE_BITS)
+#ifdef CONFIG_ARM_LPAE
 #define MAX_PHYSMEM_BITS	36
+#else
+#define MAX_PHYSMEM_BITS	32
+#endif
 #define SECTION_SIZE_BITS	28
 #endif
 
-- 
2.53.0



More information about the linux-arm-kernel mailing list