mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
arm64: Determine the vmalloc/vmemmap space at build time based on VA_BITS
Rather than guessing what the maximum vmmemap space should be, this patch allows the calculation based on the VA_BITS and sizeof(struct page). The vmalloc space extends to the beginning of the vmemmap space. Since the virtual kernel memory layout now depends on the build configuration, this patch removes the detailed description in Documentation/arm64/memory.txt in favour of information printed during kernel booting. Signed-off-by: Catalin Marinas <[email protected]> Tested-by: Jungseok Lee <[email protected]>
This commit is contained in:
parent
b4a0d8b377
commit
08375198b0
3 changed files with 38 additions and 95 deletions
|
|
@ -33,13 +33,16 @@
|
|||
|
||||
/*
|
||||
* VMALLOC and SPARSEMEM_VMEMMAP ranges.
|
||||
*
|
||||
* VMEMAP_SIZE: allows the whole VA space to be covered by a struct page array
|
||||
* (rounded up to PUD_SIZE).
|
||||
* VMALLOC_START: beginning of the kernel VA space
|
||||
* VMALLOC_END: extends to the available space below vmmemmap, PCI I/O space,
|
||||
* fixed mappings and modules
|
||||
*/
|
||||
#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
|
||||
#define VMALLOC_START (UL(0xffffffffffffffff) << VA_BITS)
|
||||
#if CONFIG_ARM64_PGTABLE_LEVELS != 4
|
||||
#define VMALLOC_END (PAGE_OFFSET - UL(0x400000000) - SZ_64K)
|
||||
#else
|
||||
#define VMALLOC_END (PAGE_OFFSET - UL(0x40000000000) - SZ_64K)
|
||||
#endif
|
||||
#define VMALLOC_END (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
|
||||
|
||||
#define vmemmap ((struct page *)(VMALLOC_END + SZ_64K))
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dma-contiguous.h>
|
||||
|
||||
#include <asm/fixmap.h>
|
||||
#include <asm/sections.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/sizes.h>
|
||||
|
|
@ -256,26 +257,33 @@ void __init mem_init(void)
|
|||
|
||||
#define MLK(b, t) b, t, ((t) - (b)) >> 10
|
||||
#define MLM(b, t) b, t, ((t) - (b)) >> 20
|
||||
#define MLG(b, t) b, t, ((t) - (b)) >> 30
|
||||
#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
|
||||
|
||||
pr_notice("Virtual kernel memory layout:\n"
|
||||
" vmalloc : 0x%16lx - 0x%16lx (%6ld MB)\n"
|
||||
" vmalloc : 0x%16lx - 0x%16lx (%6ld GB)\n"
|
||||
#ifdef CONFIG_SPARSEMEM_VMEMMAP
|
||||
" vmemmap : 0x%16lx - 0x%16lx (%6ld MB)\n"
|
||||
" vmemmap : 0x%16lx - 0x%16lx (%6ld GB maximum)\n"
|
||||
" 0x%16lx - 0x%16lx (%6ld MB actual)\n"
|
||||
#endif
|
||||
" PCI I/O : 0x%16lx - 0x%16lx (%6ld MB)\n"
|
||||
" fixed : 0x%16lx - 0x%16lx (%6ld KB)\n"
|
||||
" modules : 0x%16lx - 0x%16lx (%6ld MB)\n"
|
||||
" memory : 0x%16lx - 0x%16lx (%6ld MB)\n"
|
||||
" .init : 0x%p" " - 0x%p" " (%6ld kB)\n"
|
||||
" .text : 0x%p" " - 0x%p" " (%6ld kB)\n"
|
||||
" .data : 0x%p" " - 0x%p" " (%6ld kB)\n",
|
||||
MLM(VMALLOC_START, VMALLOC_END),
|
||||
" .init : 0x%p" " - 0x%p" " (%6ld KB)\n"
|
||||
" .text : 0x%p" " - 0x%p" " (%6ld KB)\n"
|
||||
" .data : 0x%p" " - 0x%p" " (%6ld KB)\n",
|
||||
MLG(VMALLOC_START, VMALLOC_END),
|
||||
#ifdef CONFIG_SPARSEMEM_VMEMMAP
|
||||
MLG((unsigned long)vmemmap,
|
||||
(unsigned long)vmemmap + VMEMMAP_SIZE),
|
||||
MLM((unsigned long)virt_to_page(PAGE_OFFSET),
|
||||
(unsigned long)virt_to_page(high_memory)),
|
||||
#endif
|
||||
MLM((unsigned long)PCI_IOBASE, (unsigned long)PCI_IOBASE + SZ_16M),
|
||||
MLK(FIXADDR_START, FIXADDR_TOP),
|
||||
MLM(MODULES_VADDR, MODULES_END),
|
||||
MLM(PAGE_OFFSET, (unsigned long)high_memory),
|
||||
|
||||
MLK_ROUNDUP(__init_begin, __init_end),
|
||||
MLK_ROUNDUP(_text, _etext),
|
||||
MLK_ROUNDUP(_sdata, _edata));
|
||||
|
|
|
|||
Loading…
Reference in a new issue