[PATCH v2] ARM: set !LPAE MAX_PHYSMEM_BITS to 32 and remove IO_36

Arnd Bergmann arnd at arndb.de
Fri Jul 24 11:31:35 PDT 2026


On Fri, Jul 24, 2026, at 19:47, Karl Mehltretter wrote:
> An arm randconfig with CONFIG_GET_FREE_REGION=y (selected by
> RESOURCE_KUNIT_TEST, DEVICE_PRIVATE, CXL_REGION or DRM_XE) and the
> default CONFIG_WERROR=y fails to build:
>
>   kernel/resource.c: In function 'gfr_start':
>   include/linux/minmax.h:86:37: error: conversion from 'long long
>   unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes
>   value from '68719476735' to '4294967295' [-Werror=overflow]
>
> since commit 14b80582c43e ("resource: Introduce
> alloc_free_mem_region()") clamps against (1ULL << MAX_PHYSMEM_BITS) - 1
> in resource_size_t arithmetic, which is 32-bit without LPAE while
> arm's default MAX_PHYSMEM_BITS is 36.
>
> The 36-bit default exists for CONFIG_IO_36, added in commit
> 23bdf86aa06e ("[ARM] 3377/2: add support for intel xsc3 core") to let
> IXP23xx ioremap() I/O above 4GiB using supersections.  IXP23xx was
> removed in 2012, IOP13xx, the last user of addresses above 4GiB, in
> 2019 with v5.4, and PXA3xx as the only remaining XSC3 platform has
> nothing above 4GiB.
>
> Supersection descriptors have no domain field, as thos bits hold
> extended physical address bits.  36-bit I/O therefore required
> renumbering the protection domains to make DOMAIN_IO zero, and
> ioremap()'s supersection path is only compiled in that case.
>
> Remove IO_36, the alternate domain numbering, and the ioremap()
> supersection path.  Reject non-LPAE physical ranges beyond the
> 32-bit phys_addr_t limit before truncation, preventing faults from
> ranges crossing 4GiB.  Since high non-LPAE ranges are rejected
> before truncation, remove the corresponding static-mapping
> exclusion as well.  Reduce ioremap alignment from 16MiB to the
> 2MiB covered by a PMD's pair of sections.
>
> With that, LPAE is the only way to address more than 32 bits of
> physical memory, so use the 36-bit MAX_PHYSMEM_BITS default only
> there, matching phys_addr_t.
>
> Link: 
> https://lore.kernel.org/all/3c79d2dc-8fbd-40fc-8b2d-9d1b4f8ed34e@app.fastmail.com/
> Link: 
> https://lore.kernel.org/all/CAK8P3a2MCdUbN0QSb+M3g5_6HjPsaQwtKxFjADMZWomdry4-Ww@mail.gmail.com/
> Fixes: 14b80582c43e ("resource: Introduce alloc_free_mem_region()")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <kmehltretter at gmail.com>

This all looks very good to me, thanks for the updated version!

> Deliberately left in place: create_36bit_mapping() and the
> PMD_SECT_SUPER/SUPERSECTION_* definitions, now unreachable for
> device mappings.  A follow-up patch can remove them.

I'm not sure why you remove remap_area_supersections() but keep
create_36bit_mapping(). I would just remove that as well.

Reviewed-by: Arnd Bergmann <arnd at arndb.de>



More information about the linux-arm-kernel mailing list