diff options
author | Jungseok Lee <[email protected]> | 2014-05-12 18:40:51 +0900 |
---|---|---|
committer | Catalin Marinas <[email protected]> | 2014-07-23 15:27:40 +0100 |
commit | c79b954bf6c006f2d3dd9d01f231abeead13a410 (patch) | |
tree | b7d4375c12d2b61554af0e5eb7596b22c60c643e /arch/arm64/include/asm/pgalloc.h | |
parent | 57e0139041a978c0cfa4d2366c96ea3418e7d553 (diff) |
arm64: mm: Implement 4 levels of translation tables
This patch implements 4 levels of translation tables since 3 levels
of page tables with 4KB pages cannot support 40-bit physical address
space described in [1] due to the following issue.
It is a restriction that kernel logical memory map with 4KB + 3 levels
(0xffffffc000000000-0xffffffffffffffff) cannot cover RAM region from
544GB to 1024GB in [1]. Specifically, ARM64 kernel fails to create
mapping for this region in map_mem function since __phys_to_virt for
this region reaches to address overflow.
If SoC design follows the document, [1], over 32GB RAM would be placed
from 544GB. Even 64GB system is supposed to use the region from 544GB
to 576GB for only 32GB RAM. Naturally, it would reach to enable 4 levels
of page tables to avoid hacking __virt_to_phys and __phys_to_virt.
However, it is recommended 4 levels of page table should be only enabled
if memory map is too sparse or there is about 512GB RAM.
References
----------
[1]: Principles of ARM Memory Maps, White Paper, Issue C
Signed-off-by: Jungseok Lee <[email protected]>
Reviewed-by: Sungjinn Chung <[email protected]>
Acked-by: Kukjin Kim <[email protected]>
Reviewed-by: Christoffer Dall <[email protected]>
Reviewed-by: Steve Capper <[email protected]>
[[email protected]: MEMBLOCK_INITIAL_LIMIT removed, same as PUD_SIZE]
[[email protected]: early_ioremap_init() updated for 4 levels]
[[email protected]: 48-bit VA depends on BROKEN until KVM is fixed]
Signed-off-by: Catalin Marinas <[email protected]>
Tested-by: Jungseok Lee <[email protected]>
Diffstat (limited to 'arch/arm64/include/asm/pgalloc.h')
-rw-r--r-- | arch/arm64/include/asm/pgalloc.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h index 48298376e46a..7deb5750a945 100644 --- a/arch/arm64/include/asm/pgalloc.h +++ b/arch/arm64/include/asm/pgalloc.h @@ -46,6 +46,26 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) #endif /* CONFIG_ARM64_2_LEVELS */ +#ifdef CONFIG_ARM64_4_LEVELS + +static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) +{ + return (pud_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); +} + +static inline void pud_free(struct mm_struct *mm, pud_t *pud) +{ + BUG_ON((unsigned long)pud & (PAGE_SIZE-1)); + free_page((unsigned long)pud); +} + +static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) +{ + set_pgd(pgd, __pgd(__pa(pud) | PUD_TYPE_TABLE)); +} + +#endif /* CONFIG_ARM64_4_LEVELS */ + extern pgd_t *pgd_alloc(struct mm_struct *mm); extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |