diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2014-07-21 10:54:50 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-07-23 10:28:15 -0400 |
commit | 383c2799113b00a5f12c820ff0fd3dfca9e5be89 (patch) | |
tree | f2f9788dcbfa62fe6160cae82e67b8d83eca5bc0 | |
parent | 7078db46215f9137801a122f87ac31c504220a94 (diff) |
arm64: Add support for 48-bit VA space with 64KB page configuration
This patch allows support for 3 levels of page tables with 64KB page
configuration allowing 48-bit VA space. The pgd is no longer a full
PAGE_SIZE (PTRS_PER_PGD is 64) and (swapper|idmap)_pg_dir are not fully
populated (pgd_alloc falls back to kzalloc).
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Jungseok Lee <jungseoklee85@gmail.com>
-rw-r--r-- | Documentation/arm64/memory.txt | 8 | ||||
-rw-r--r-- | arch/arm64/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/page.h | 16 | ||||
-rw-r--r-- | arch/arm64/kernel/head.S | 6 |
4 files changed, 22 insertions, 9 deletions
diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt index 8845d0847a66..344e85cc7323 100644 --- a/Documentation/arm64/memory.txt +++ b/Documentation/arm64/memory.txt | |||
@@ -45,6 +45,14 @@ Start End Size Use | |||
45 | fffffc0000000000 ffffffffffffffff 4TB kernel | 45 | fffffc0000000000 ffffffffffffffff 4TB kernel |
46 | 46 | ||
47 | 47 | ||
48 | AArch64 Linux memory layout with 64KB pages + 3 levels: | ||
49 | |||
50 | Start End Size Use | ||
51 | ----------------------------------------------------------------------- | ||
52 | 0000000000000000 0000ffffffffffff 256TB user | ||
53 | ffff000000000000 ffffffffffffffff 256TB kernel | ||
54 | |||
55 | |||
48 | For details of the virtual kernel memory layout please see the kernel | 56 | For details of the virtual kernel memory layout please see the kernel |
49 | booting log. | 57 | booting log. |
50 | 58 | ||
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8cdb7f36bfc8..f4615ba88a77 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -210,6 +210,7 @@ config ARM64_VA_BITS | |||
210 | config ARM64_PGTABLE_LEVELS | 210 | config ARM64_PGTABLE_LEVELS |
211 | int | 211 | int |
212 | default 2 if ARM64_64K_PAGES && ARM64_VA_BITS_42 | 212 | default 2 if ARM64_64K_PAGES && ARM64_VA_BITS_42 |
213 | default 3 if ARM64_64K_PAGES && ARM64_VA_BITS_48 | ||
213 | default 3 if ARM64_4K_PAGES && ARM64_VA_BITS_39 | 214 | default 3 if ARM64_4K_PAGES && ARM64_VA_BITS_39 |
214 | default 4 if ARM64_4K_PAGES && ARM64_VA_BITS_48 | 215 | default 4 if ARM64_4K_PAGES && ARM64_VA_BITS_48 |
215 | 216 | ||
diff --git a/arch/arm64/include/asm/page.h b/arch/arm64/include/asm/page.h index 2502754d1921..7a3f462133b0 100644 --- a/arch/arm64/include/asm/page.h +++ b/arch/arm64/include/asm/page.h | |||
@@ -34,17 +34,19 @@ | |||
34 | /* | 34 | /* |
35 | * The idmap and swapper page tables need some space reserved in the kernel | 35 | * The idmap and swapper page tables need some space reserved in the kernel |
36 | * image. Both require pgd, pud (4 levels only) and pmd tables to (section) | 36 | * image. Both require pgd, pud (4 levels only) and pmd tables to (section) |
37 | * map the kernel. The swapper also maps the FDT (see __create_page_tables for | 37 | * map the kernel. With the 64K page configuration, swapper and idmap need to |
38 | * more information). | 38 | * map to pte level. The swapper also maps the FDT (see __create_page_tables |
39 | * for more information). | ||
39 | */ | 40 | */ |
40 | #if CONFIG_ARM64_PGTABLE_LEVELS == 4 | 41 | #ifdef CONFIG_ARM64_64K_PAGES |
41 | #define SWAPPER_DIR_SIZE (3 * PAGE_SIZE) | 42 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_ARM64_PGTABLE_LEVELS) |
42 | #define IDMAP_DIR_SIZE (3 * PAGE_SIZE) | ||
43 | #else | 43 | #else |
44 | #define SWAPPER_DIR_SIZE (2 * PAGE_SIZE) | 44 | #define SWAPPER_PGTABLE_LEVELS (CONFIG_ARM64_PGTABLE_LEVELS - 1) |
45 | #define IDMAP_DIR_SIZE (2 * PAGE_SIZE) | ||
46 | #endif | 45 | #endif |
47 | 46 | ||
47 | #define SWAPPER_DIR_SIZE (SWAPPER_PGTABLE_LEVELS * PAGE_SIZE) | ||
48 | #define IDMAP_DIR_SIZE (SWAPPER_DIR_SIZE) | ||
49 | |||
48 | #ifndef __ASSEMBLY__ | 50 | #ifndef __ASSEMBLY__ |
49 | 51 | ||
50 | #include <asm/pgtable-types.h> | 52 | #include <asm/pgtable-types.h> |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a6db505411bc..0bce493495e9 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -55,9 +55,11 @@ | |||
55 | #ifdef CONFIG_ARM64_64K_PAGES | 55 | #ifdef CONFIG_ARM64_64K_PAGES |
56 | #define BLOCK_SHIFT PAGE_SHIFT | 56 | #define BLOCK_SHIFT PAGE_SHIFT |
57 | #define BLOCK_SIZE PAGE_SIZE | 57 | #define BLOCK_SIZE PAGE_SIZE |
58 | #define TABLE_SHIFT PMD_SHIFT | ||
58 | #else | 59 | #else |
59 | #define BLOCK_SHIFT SECTION_SHIFT | 60 | #define BLOCK_SHIFT SECTION_SHIFT |
60 | #define BLOCK_SIZE SECTION_SIZE | 61 | #define BLOCK_SIZE SECTION_SIZE |
62 | #define TABLE_SHIFT PUD_SHIFT | ||
61 | #endif | 63 | #endif |
62 | 64 | ||
63 | #define KERNEL_START KERNEL_RAM_VADDR | 65 | #define KERNEL_START KERNEL_RAM_VADDR |
@@ -505,8 +507,8 @@ ENDPROC(__calc_phys_offset) | |||
505 | */ | 507 | */ |
506 | .macro create_pgd_entry, tbl, virt, tmp1, tmp2 | 508 | .macro create_pgd_entry, tbl, virt, tmp1, tmp2 |
507 | create_table_entry \tbl, \virt, PGDIR_SHIFT, PTRS_PER_PGD, \tmp1, \tmp2 | 509 | create_table_entry \tbl, \virt, PGDIR_SHIFT, PTRS_PER_PGD, \tmp1, \tmp2 |
508 | #if CONFIG_ARM64_PGTABLE_LEVELS == 4 | 510 | #if SWAPPER_PGTABLE_LEVELS == 3 |
509 | create_table_entry \tbl, \virt, PUD_SHIFT, PTRS_PER_PUD, \tmp1, \tmp2 | 511 | create_table_entry \tbl, \virt, TABLE_SHIFT, PTRS_PER_PTE, \tmp1, \tmp2 |
510 | #endif | 512 | #endif |
511 | .endm | 513 | .endm |
512 | 514 | ||