]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
m68k: introduce arch_zone_limits_init()
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sun, 11 Jan 2026 08:20:43 +0000 (10:20 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 27 Jan 2026 04:02:15 +0000 (20:02 -0800)
Move calculations of zone limits to a dedicated arch_zone_limits_init()
function.

Later MM core will use this function as an architecture specific callback
during nodes and zones initialization and thus there won't be a need to
call free_area_init() from every architecture.

Since all variants of m68k add all memory to ZONE_DMA, it is possible to
use unified implementation for arch_zone_limits_init() that sets the end
of ZONE_DMA to memblock_end_of_DRAM().

Link: https://lkml.kernel.org/r/20260111082105.290734-10-rppt@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alex Shi <alexs@kernel.org>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Klara Modin <klarasmodin@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/m68k/mm/init.c
arch/m68k/mm/mcfmmu.c
arch/m68k/mm/motorola.c
arch/m68k/mm/sun3mmu.c

index 488411af1b3fbb19c7b1f52b0b4530e179c89caf..6b1d9d2434b5067128541f879a217408bd17a4a6 100644 (file)
 void *empty_zero_page;
 EXPORT_SYMBOL(empty_zero_page);
 
+void __init arch_zone_limits_init(unsigned long *max_zone_pfns)
+{
+       max_zone_pfns[ZONE_DMA] = PFN_DOWN(memblock_end_of_DRAM());
+}
+
 #ifdef CONFIG_MMU
 
 int m68k_virt_to_node_shift;
@@ -69,7 +74,7 @@ void __init paging_init(void)
        high_memory = (void *) end_mem;
 
        empty_zero_page = memblock_alloc_or_panic(PAGE_SIZE, PAGE_SIZE);
-       max_zone_pfn[ZONE_DMA] = end_mem >> PAGE_SHIFT;
+       arch_zone_limits_init(max_zone_pfn);
        free_area_init(max_zone_pfn);
 }
 
index 19a75029036caf2b3701863532d4d43507cde4c0..24a6f7bbd1cebb732b3cb5a1be2d7d11981d0fd8 100644 (file)
@@ -73,7 +73,7 @@ void __init paging_init(void)
        }
 
        current->mm = NULL;
-       max_zone_pfn[ZONE_DMA] = PFN_DOWN(_ramend);
+       arch_zone_limits_init(max_zone_pfn);
        free_area_init(max_zone_pfn);
 }
 
index 62283bc2ed79479c77b1a0b47dcc496a5a88bccf..d6ccd23caf617445589d86d60cf58c2ad4335f47 100644 (file)
@@ -517,6 +517,6 @@ void __init paging_init(void)
                if (node_present_pages(i))
                        node_set_state(i, N_NORMAL_MEMORY);
 
-       max_zone_pfn[ZONE_DMA] = memblock_end_of_DRAM();
+       arch_zone_limits_init(max_zone_pfn);
        free_area_init(max_zone_pfn);
 }
index 1ecf6bdd08bf95e9c1ee7e82ab0366c65c59d277..fdd69cc4240c66b258b8066cfe54a8948c7f9bd3 100644 (file)
@@ -82,7 +82,7 @@ void __init paging_init(void)
        current->mm = NULL;
 
        /* memory sizing is a hack stolen from motorola.c..  hope it works for us */
-       max_zone_pfn[ZONE_DMA] = ((unsigned long)high_memory) >> PAGE_SHIFT;
+       arch_zone_limits_init(max_zone_pfn);
 
        /* I really wish I knew why the following change made things better...  -- Sam */
        free_area_init(max_zone_pfn);