Skip to content

Commit d319c8b

Browse files
rpptakpm00
authored andcommitted
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/[email protected] Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> Reviewed-by: Max Filippov <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Andreas Larsson <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Borislav Betkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Guo Ren (csky) <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Helge Deller <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Johannes Berg <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Mark Brown <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Simek <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Russel King <[email protected]> Cc: Stafford Horne <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleinxer <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 54ccf66 commit d319c8b

File tree

1 file changed

+50
-47
lines changed

1 file changed

+50
-47
lines changed

arch/xtensa/mm/init.c

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,55 @@ void __init bootmem_init(void)
6666
memblock_dump_all();
6767
}
6868

69+
static void __init print_vm_layout(void)
70+
{
71+
pr_info("virtual kernel memory layout:\n"
72+
#ifdef CONFIG_KASAN
73+
" kasan : 0x%08lx - 0x%08lx (%5lu MB)\n"
74+
#endif
75+
#ifdef CONFIG_MMU
76+
" vmalloc : 0x%08lx - 0x%08lx (%5lu MB)\n"
77+
#endif
78+
#ifdef CONFIG_HIGHMEM
79+
" pkmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
80+
" fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
81+
#endif
82+
" lowmem : 0x%08lx - 0x%08lx (%5lu MB)\n"
83+
" .text : 0x%08lx - 0x%08lx (%5lu kB)\n"
84+
" .rodata : 0x%08lx - 0x%08lx (%5lu kB)\n"
85+
" .data : 0x%08lx - 0x%08lx (%5lu kB)\n"
86+
" .init : 0x%08lx - 0x%08lx (%5lu kB)\n"
87+
" .bss : 0x%08lx - 0x%08lx (%5lu kB)\n",
88+
#ifdef CONFIG_KASAN
89+
KASAN_SHADOW_START, KASAN_SHADOW_START + KASAN_SHADOW_SIZE,
90+
KASAN_SHADOW_SIZE >> 20,
91+
#endif
92+
#ifdef CONFIG_MMU
93+
VMALLOC_START, VMALLOC_END,
94+
(VMALLOC_END - VMALLOC_START) >> 20,
95+
#ifdef CONFIG_HIGHMEM
96+
PKMAP_BASE, PKMAP_BASE + LAST_PKMAP * PAGE_SIZE,
97+
(LAST_PKMAP*PAGE_SIZE) >> 10,
98+
FIXADDR_START, FIXADDR_END,
99+
(FIXADDR_END - FIXADDR_START) >> 10,
100+
#endif
101+
PAGE_OFFSET, PAGE_OFFSET +
102+
(max_low_pfn - min_low_pfn) * PAGE_SIZE,
103+
#else
104+
min_low_pfn * PAGE_SIZE, max_low_pfn * PAGE_SIZE,
105+
#endif
106+
((max_low_pfn - min_low_pfn) * PAGE_SIZE) >> 20,
107+
(unsigned long)_text, (unsigned long)_etext,
108+
(unsigned long)(_etext - _text) >> 10,
109+
(unsigned long)__start_rodata, (unsigned long)__end_rodata,
110+
(unsigned long)(__end_rodata - __start_rodata) >> 10,
111+
(unsigned long)_sdata, (unsigned long)_edata,
112+
(unsigned long)(_edata - _sdata) >> 10,
113+
(unsigned long)__init_begin, (unsigned long)__init_end,
114+
(unsigned long)(__init_end - __init_begin) >> 10,
115+
(unsigned long)__bss_start, (unsigned long)__bss_stop,
116+
(unsigned long)(__bss_stop - __bss_start) >> 10);
117+
}
69118

70119
void __init zones_init(void)
71120
{
@@ -77,6 +126,7 @@ void __init zones_init(void)
77126
#endif
78127
};
79128
free_area_init(max_zone_pfn);
129+
print_vm_layout();
80130
}
81131

82132
static void __init free_highpages(void)
@@ -118,53 +168,6 @@ void __init mem_init(void)
118168
high_memory = (void *)__va(max_low_pfn << PAGE_SHIFT);
119169

120170
memblock_free_all();
121-
122-
pr_info("virtual kernel memory layout:\n"
123-
#ifdef CONFIG_KASAN
124-
" kasan : 0x%08lx - 0x%08lx (%5lu MB)\n"
125-
#endif
126-
#ifdef CONFIG_MMU
127-
" vmalloc : 0x%08lx - 0x%08lx (%5lu MB)\n"
128-
#endif
129-
#ifdef CONFIG_HIGHMEM
130-
" pkmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
131-
" fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
132-
#endif
133-
" lowmem : 0x%08lx - 0x%08lx (%5lu MB)\n"
134-
" .text : 0x%08lx - 0x%08lx (%5lu kB)\n"
135-
" .rodata : 0x%08lx - 0x%08lx (%5lu kB)\n"
136-
" .data : 0x%08lx - 0x%08lx (%5lu kB)\n"
137-
" .init : 0x%08lx - 0x%08lx (%5lu kB)\n"
138-
" .bss : 0x%08lx - 0x%08lx (%5lu kB)\n",
139-
#ifdef CONFIG_KASAN
140-
KASAN_SHADOW_START, KASAN_SHADOW_START + KASAN_SHADOW_SIZE,
141-
KASAN_SHADOW_SIZE >> 20,
142-
#endif
143-
#ifdef CONFIG_MMU
144-
VMALLOC_START, VMALLOC_END,
145-
(VMALLOC_END - VMALLOC_START) >> 20,
146-
#ifdef CONFIG_HIGHMEM
147-
PKMAP_BASE, PKMAP_BASE + LAST_PKMAP * PAGE_SIZE,
148-
(LAST_PKMAP*PAGE_SIZE) >> 10,
149-
FIXADDR_START, FIXADDR_END,
150-
(FIXADDR_END - FIXADDR_START) >> 10,
151-
#endif
152-
PAGE_OFFSET, PAGE_OFFSET +
153-
(max_low_pfn - min_low_pfn) * PAGE_SIZE,
154-
#else
155-
min_low_pfn * PAGE_SIZE, max_low_pfn * PAGE_SIZE,
156-
#endif
157-
((max_low_pfn - min_low_pfn) * PAGE_SIZE) >> 20,
158-
(unsigned long)_text, (unsigned long)_etext,
159-
(unsigned long)(_etext - _text) >> 10,
160-
(unsigned long)__start_rodata, (unsigned long)__end_rodata,
161-
(unsigned long)(__end_rodata - __start_rodata) >> 10,
162-
(unsigned long)_sdata, (unsigned long)_edata,
163-
(unsigned long)(_edata - _sdata) >> 10,
164-
(unsigned long)__init_begin, (unsigned long)__init_end,
165-
(unsigned long)(__init_end - __init_begin) >> 10,
166-
(unsigned long)__bss_start, (unsigned long)__bss_stop,
167-
(unsigned long)(__bss_stop - __bss_start) >> 10);
168171
}
169172

170173
static void __init parse_memmap_one(char *p)

0 commit comments

Comments
 (0)