mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
xtensa: split out printing of virtual memory layout to a function
This will help with pulling out memblock_free_all() to the generic code and reducing code duplication in arch::mem_init(). Link: https://lkml.kernel.org/r/20250313135003.836600-9-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Betkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David S. Miller <davem@davemloft.net> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Guo Ren (csky) <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: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Brown <broonie@kernel.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Richard Weinberger <richard@nod.at> Cc: Russel King <linux@armlinux.org.uk> Cc: Stafford Horne <shorne@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleinxer <tglx@linutronix.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vineet Gupta <vgupta@kernel.org> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
54ccf66f99
commit
d319c8b491
@ -66,59 +66,8 @@ void __init bootmem_init(void)
|
||||
memblock_dump_all();
|
||||
}
|
||||
|
||||
|
||||
void __init zones_init(void)
|
||||
static void __init print_vm_layout(void)
|
||||
{
|
||||
/* All pages are DMA-able, so we put them all in the DMA zone. */
|
||||
unsigned long max_zone_pfn[MAX_NR_ZONES] = {
|
||||
[ZONE_NORMAL] = max_low_pfn,
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
[ZONE_HIGHMEM] = max_pfn,
|
||||
#endif
|
||||
};
|
||||
free_area_init(max_zone_pfn);
|
||||
}
|
||||
|
||||
static void __init free_highpages(void)
|
||||
{
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
unsigned long max_low = max_low_pfn;
|
||||
phys_addr_t range_start, range_end;
|
||||
u64 i;
|
||||
|
||||
/* set highmem page free */
|
||||
for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
|
||||
&range_start, &range_end, NULL) {
|
||||
unsigned long start = PFN_UP(range_start);
|
||||
unsigned long end = PFN_DOWN(range_end);
|
||||
|
||||
/* Ignore complete lowmem entries */
|
||||
if (end <= max_low)
|
||||
continue;
|
||||
|
||||
/* Truncate partial highmem entries */
|
||||
if (start < max_low)
|
||||
start = max_low;
|
||||
|
||||
for (; start < end; start++)
|
||||
free_highmem_page(pfn_to_page(start));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize memory pages.
|
||||
*/
|
||||
|
||||
void __init mem_init(void)
|
||||
{
|
||||
free_highpages();
|
||||
|
||||
max_mapnr = max_pfn - ARCH_PFN_OFFSET;
|
||||
high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
|
||||
|
||||
memblock_free_all();
|
||||
|
||||
pr_info("virtual kernel memory layout:\n"
|
||||
#ifdef CONFIG_KASAN
|
||||
" kasan : 0x%08lx - 0x%08lx (%5lu MB)\n"
|
||||
@ -167,6 +116,60 @@ void __init mem_init(void)
|
||||
(unsigned long)(__bss_stop - __bss_start) >> 10);
|
||||
}
|
||||
|
||||
void __init zones_init(void)
|
||||
{
|
||||
/* All pages are DMA-able, so we put them all in the DMA zone. */
|
||||
unsigned long max_zone_pfn[MAX_NR_ZONES] = {
|
||||
[ZONE_NORMAL] = max_low_pfn,
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
[ZONE_HIGHMEM] = max_pfn,
|
||||
#endif
|
||||
};
|
||||
free_area_init(max_zone_pfn);
|
||||
print_vm_layout();
|
||||
}
|
||||
|
||||
static void __init free_highpages(void)
|
||||
{
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
unsigned long max_low = max_low_pfn;
|
||||
phys_addr_t range_start, range_end;
|
||||
u64 i;
|
||||
|
||||
/* set highmem page free */
|
||||
for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
|
||||
&range_start, &range_end, NULL) {
|
||||
unsigned long start = PFN_UP(range_start);
|
||||
unsigned long end = PFN_DOWN(range_end);
|
||||
|
||||
/* Ignore complete lowmem entries */
|
||||
if (end <= max_low)
|
||||
continue;
|
||||
|
||||
/* Truncate partial highmem entries */
|
||||
if (start < max_low)
|
||||
start = max_low;
|
||||
|
||||
for (; start < end; start++)
|
||||
free_highmem_page(pfn_to_page(start));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize memory pages.
|
||||
*/
|
||||
|
||||
void __init mem_init(void)
|
||||
{
|
||||
free_highpages();
|
||||
|
||||
max_mapnr = max_pfn - ARCH_PFN_OFFSET;
|
||||
high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
|
||||
|
||||
memblock_free_all();
|
||||
}
|
||||
|
||||
static void __init parse_memmap_one(char *p)
|
||||
{
|
||||
char *oldp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user