[PATCH v3 0/6] sparc32: replace sp_banks with memblock

Magnus Lindholm posted 6 patches 3 weeks, 3 days ago
arch/sparc/include/asm/highmem.h    |   3 -
arch/sparc/include/asm/leon.h       |   2 +-
arch/sparc/include/asm/page_32.h    |  16 ---
arch/sparc/include/asm/pgtable_32.h |   3 +-
arch/sparc/include/asm/pgtsrmmu.h   |   1 -
arch/sparc/kernel/setup_32.c        | 112 ++++++++++---------
arch/sparc/mm/init_32.c             | 167 +---------------------------
arch/sparc/mm/leon_mm.c             |   1 +
arch/sparc/mm/srmmu.c               |  69 ++++--------
arch/sparc/prom/memory.c            |  51 ++-------
10 files changed, 98 insertions(+), 327 deletions(-)
[PATCH v3 0/6] sparc32: replace sp_banks with memblock
Posted by Magnus Lindholm 3 weeks, 3 days ago
Replace the sparc32-private sp_banks memory description with memblock.

The first two patches convert the SRMMU consumers that already run after
bootmem_init() has populated memblock. The third patch moves memblock
population to prom_meminit() and applies the mem= limit there. Patch 4
removes an unused address bitmap before patch 5 moves the early memory
setup into setup_32.c. Patch 6 removes the now-unused sp_banks array.

This work is based on an earlier eight-patch series by Sam Ravnborg.
Patch 2 directly carries over Sam's memblock sizing conversion. The series
has otherwise been substantially reorganized and reworked for the current
kernel. It retains the sparc32 mem= command-line option by using
memblock_enforce_memory_limit() and uses memblock's exclusive range-end
semantics throughout.

The series applies on top of the sparc32 phys_base and Viking fixes.
setup_memory() preserves relocated-kernel handling by removing RAM below
the physical address to which PAGE_OFFSET maps.

Link: https://lore.kernel.org/sparclinux/20260816075141.3489194-1-linmag7@gmail.com/T/#t

The v1 series was boot tested on a Sun SPARCstation 20 with dual
SuperSPARC-II CPUs (SM71).
The v2 series was boot tested on a Sun SPARCstation 20 with dual
ROSS HyperSPARC (RT626) CPUs.
The v3 series was cross-compiled with the SPARCstation 20 and LEON
configurations as well as boot tested on a Sun SPARCstation 20
with dual ROSS HyperSPARC (RT626) CPUs.

Changes in v3:
- Add Sam's Reviewed-by tag to patch 4.
- Initialize max_pfn in patch 5 and use it as the highmem zone limit.
- Use PHYS_PFN() instead of open-coded PAGE_SHIFT conversions in patch 5.
- Remove the obsolete highstart_pfn and highend_pfn declarations.
- Use the generic max_low_pfn declaration from linux/memblock.h.
- Document removal of the duplicate private HIGHMEM summary.

Changes in v2:
- Add Sam's Reviewed-by tags to patches 1-3 and 6. Patch 6 is the
  unchanged source change from patch 5 in v1, renumbered by the new patch.
- Drop the unused sparc_valid_addr_bitmap in a preparation patch.
- Use for_each_mem_pfn_range() and the standard max_low_pfn variable in
  the early memory setup. This tightens LEON's _pfn_valid() upper bound
  from all memory to the lowmem limit, with no functional change because
  LEON does not use highmem.

Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/20260817153237.GA702187@ravnborg.org

Magnus Lindholm (6):
  sparc32: use memblock when mapping the kernel
  sparc32: use memblock to find available system memory
  sparc32: populate memblock from the PROM memory map
  sparc32: drop unused valid address bitmap
  sparc32: move early memory setup to setup_arch
  sparc32: drop sp_banks

 arch/sparc/include/asm/highmem.h    |   3 -
 arch/sparc/include/asm/leon.h       |   2 +-
 arch/sparc/include/asm/page_32.h    |  16 ---
 arch/sparc/include/asm/pgtable_32.h |   3 +-
 arch/sparc/include/asm/pgtsrmmu.h   |   1 -
 arch/sparc/kernel/setup_32.c        | 112 ++++++++++---------
 arch/sparc/mm/init_32.c             | 167 +---------------------------
 arch/sparc/mm/leon_mm.c             |   1 +
 arch/sparc/mm/srmmu.c               |  69 ++++--------
 arch/sparc/prom/memory.c            |  51 ++-------
 10 files changed, 98 insertions(+), 327 deletions(-)

-- 
2.43.0
Re: [PATCH v3 0/6] sparc32: replace sp_banks with memblock
Posted by Sam Ravnborg 3 weeks, 3 days ago
Hi Magnus.
On Tue, Sep 01, 2026 at 11:45:44PM +0200, Magnus Lindholm wrote:
> Replace the sparc32-private sp_banks memory description with memblock.
> 
> The first two patches convert the SRMMU consumers that already run after
> bootmem_init() has populated memblock. The third patch moves memblock
> population to prom_meminit() and applies the mem= limit there. Patch 4
> removes an unused address bitmap before patch 5 moves the early memory
> setup into setup_32.c. Patch 6 removes the now-unused sp_banks array.
> 
> This work is based on an earlier eight-patch series by Sam Ravnborg.
> Patch 2 directly carries over Sam's memblock sizing conversion. The series
> has otherwise been substantially reorganized and reworked for the current
> kernel. It retains the sparc32 mem= command-line option by using
> memblock_enforce_memory_limit() and uses memblock's exclusive range-end
> semantics throughout.
> 
> The series applies on top of the sparc32 phys_base and Viking fixes.
> setup_memory() preserves relocated-kernel handling by removing RAM below
> the physical address to which PAGE_OFFSET maps.
> 
> Link: https://lore.kernel.org/sparclinux/20260816075141.3489194-1-linmag7@gmail.com/T/#t
> 
> The v1 series was boot tested on a Sun SPARCstation 20 with dual
> SuperSPARC-II CPUs (SM71).
> The v2 series was boot tested on a Sun SPARCstation 20 with dual
> ROSS HyperSPARC (RT626) CPUs.
> The v3 series was cross-compiled with the SPARCstation 20 and LEON
> configurations as well as boot tested on a Sun SPARCstation 20
> with dual ROSS HyperSPARC (RT626) CPUs.
> 
> Changes in v3:
> - Add Sam's Reviewed-by tag to patch 4.
> - Initialize max_pfn in patch 5 and use it as the highmem zone limit.
> - Use PHYS_PFN() instead of open-coded PAGE_SHIFT conversions in patch 5.
> - Remove the obsolete highstart_pfn and highend_pfn declarations.
> - Use the generic max_low_pfn declaration from linux/memblock.h.
> - Document removal of the duplicate private HIGHMEM summary.
> 
> Changes in v2:
> - Add Sam's Reviewed-by tags to patches 1-3 and 6. Patch 6 is the
>   unchanged source change from patch 5 in v1, renumbered by the new patch.
> - Drop the unused sparc_valid_addr_bitmap in a preparation patch.
> - Use for_each_mem_pfn_range() and the standard max_low_pfn variable in
>   the early memory setup. This tightens LEON's _pfn_valid() upper bound
>   from all memory to the lowmem limit, with no functional change because
>   LEON does not use highmem.


The full series looks good now, thanks for picking this up and adressing
my review feedback.
For anyone looking at sparc32 code this is now much more standard
and you managed to remove ~250 lines of old code.

It is now ready for Andreas to take a look.

	Sam
Re: [PATCH v3 0/6] sparc32: replace sp_banks with memblock
Posted by Magnus Lindholm 3 weeks, 3 days ago
Hi Sam,

On Wed, Sep 2, 2026 at 7:35 AM Sam Ravnborg <sam@ravnborg.org> wrote:

> The full series looks good now, thanks for picking this up and adressing
> my review feedback.
> For anyone looking at sparc32 code this is now much more standard
> and you managed to remove ~250 lines of old code.
>
> It is now ready for Andreas to take a look.
>

Thanks alot for spending time on reviewing this, and for all the
feedback pointing me in the right direction.

Magnus