Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm64: introduce arch_zone_limits_init()

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.

While on it rename zone_sizes_init() to dma_limits_init() to better
reflect what that function does.

Link: https://lkml.kernel.org/r/20260111082105.290734-6-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>

authored by

Mike Rapoport (Microsoft) and committed by
Andrew Morton
60b35af0 18b7cc70

+17 -5
+17 -5
arch/arm64/mm/init.c
··· 118 118 return min(zone_limit, memblock_end_of_DRAM() - 1) + 1; 119 119 } 120 120 121 - static void __init zone_sizes_init(void) 121 + void __init arch_zone_limits_init(unsigned long *max_zone_pfns) 122 + { 123 + phys_addr_t __maybe_unused dma32_phys_limit = 124 + max_zone_phys(DMA_BIT_MASK(32)); 125 + 126 + #ifdef CONFIG_ZONE_DMA 127 + max_zone_pfns[ZONE_DMA] = PFN_DOWN(max_zone_phys(zone_dma_limit)); 128 + #endif 129 + #ifdef CONFIG_ZONE_DMA32 130 + max_zone_pfns[ZONE_DMA32] = PFN_DOWN(dma32_phys_limit); 131 + #endif 132 + max_zone_pfns[ZONE_NORMAL] = max_pfn; 133 + } 134 + 135 + static void __init dma_limits_init(void) 122 136 { 123 137 unsigned long max_zone_pfns[MAX_NR_ZONES] = {0}; 124 138 phys_addr_t __maybe_unused acpi_zone_dma_limit; ··· 153 139 if (memblock_start_of_DRAM() < U32_MAX) 154 140 zone_dma_limit = min(zone_dma_limit, U32_MAX); 155 141 arm64_dma_phys_limit = max_zone_phys(zone_dma_limit); 156 - max_zone_pfns[ZONE_DMA] = PFN_DOWN(arm64_dma_phys_limit); 157 142 #endif 158 143 #ifdef CONFIG_ZONE_DMA32 159 - max_zone_pfns[ZONE_DMA32] = PFN_DOWN(dma32_phys_limit); 160 144 if (!arm64_dma_phys_limit) 161 145 arm64_dma_phys_limit = dma32_phys_limit; 162 146 #endif 163 147 if (!arm64_dma_phys_limit) 164 148 arm64_dma_phys_limit = PHYS_MASK + 1; 165 - max_zone_pfns[ZONE_NORMAL] = max_pfn; 166 149 150 + arch_zone_limits_init(max_zone_pfns); 167 151 free_area_init(max_zone_pfns); 168 152 } 169 153 ··· 331 319 * done after the fixed reservations 332 320 */ 333 321 sparse_init(); 334 - zone_sizes_init(); 322 + dma_limits_init(); 335 323 336 324 /* 337 325 * Reserve the CMA area after arm64_dma_phys_limit was initialised.