diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2013-10-23 11:50:07 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-11-05 12:23:52 -0500 |
commit | 847264fb7e73ade5b5e4b6eea3daa243a1f5217e (patch) | |
tree | 3688d8bf1cd8f06e8bff978922d14c79406f5ce8 | |
parent | 122e2fa0d310d262cb85cf0b003032e5d2bc2ae7 (diff) |
arm64: Use 42-bit address space with 64K pages
This patch expands the VA_BITS to 42 when the 64K page configuration is
enabled allowing 2TB kernel linear mapping. Linux still uses 2 levels of
page tables in this configuration with pgd now being a full page.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | Documentation/arm64/memory.txt | 27 | ||||
-rw-r--r-- | arch/arm64/include/asm/memory.h | 11 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable-2level-hwdef.h | 4 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable.h | 2 |
4 files changed, 37 insertions, 7 deletions
diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt index f28899d5c83e..5e054bfe4dde 100644 --- a/Documentation/arm64/memory.txt +++ b/Documentation/arm64/memory.txt | |||
@@ -21,7 +21,7 @@ The swapper_pgd_dir address is written to TTBR1 and never written to | |||
21 | TTBR0. | 21 | TTBR0. |
22 | 22 | ||
23 | 23 | ||
24 | AArch64 Linux memory layout: | 24 | AArch64 Linux memory layout with 4KB pages: |
25 | 25 | ||
26 | Start End Size Use | 26 | Start End Size Use |
27 | ----------------------------------------------------------------------- | 27 | ----------------------------------------------------------------------- |
@@ -46,6 +46,31 @@ ffffffbffc000000 ffffffbfffffffff 64MB modules | |||
46 | ffffffc000000000 ffffffffffffffff 256GB kernel logical memory map | 46 | ffffffc000000000 ffffffffffffffff 256GB kernel logical memory map |
47 | 47 | ||
48 | 48 | ||
49 | AArch64 Linux memory layout with 64KB pages: | ||
50 | |||
51 | Start End Size Use | ||
52 | ----------------------------------------------------------------------- | ||
53 | 0000000000000000 000003ffffffffff 4TB user | ||
54 | |||
55 | fffffc0000000000 fffffdfbfffeffff ~2TB vmalloc | ||
56 | |||
57 | fffffdfbffff0000 fffffdfbffffffff 64KB [guard page] | ||
58 | |||
59 | fffffdfc00000000 fffffdfdffffffff 8GB vmemmap | ||
60 | |||
61 | fffffdfe00000000 fffffdfffbbfffff ~8GB [guard, future vmmemap] | ||
62 | |||
63 | fffffdfffbc00000 fffffdfffbdfffff 2MB earlyprintk device | ||
64 | |||
65 | fffffdfffbe00000 fffffdfffbe0ffff 64KB PCI I/O space | ||
66 | |||
67 | fffffdfffbe10000 fffffdfffbffffff ~2MB [guard] | ||
68 | |||
69 | fffffdfffc000000 fffffdffffffffff 64MB modules | ||
70 | |||
71 | fffffe0000000000 ffffffffffffffff 2TB kernel logical memory map | ||
72 | |||
73 | |||
49 | Translation table lookup with 4KB pages: | 74 | Translation table lookup with 4KB pages: |
50 | 75 | ||
51 | +--------+--------+--------+--------+--------+--------+--------+--------+ | 76 | +--------+--------+--------+--------+--------+--------+--------+--------+ |
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 20925bcf4e2a..37762175896f 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h | |||
@@ -33,18 +33,23 @@ | |||
33 | #define UL(x) _AC(x, UL) | 33 | #define UL(x) _AC(x, UL) |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * PAGE_OFFSET - the virtual address of the start of the kernel image. | 36 | * PAGE_OFFSET - the virtual address of the start of the kernel image (top |
37 | * (VA_BITS - 1)) | ||
37 | * VA_BITS - the maximum number of bits for virtual addresses. | 38 | * VA_BITS - the maximum number of bits for virtual addresses. |
38 | * TASK_SIZE - the maximum size of a user space task. | 39 | * TASK_SIZE - the maximum size of a user space task. |
39 | * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. | 40 | * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. |
40 | * The module space lives between the addresses given by TASK_SIZE | 41 | * The module space lives between the addresses given by TASK_SIZE |
41 | * and PAGE_OFFSET - it must be within 128MB of the kernel text. | 42 | * and PAGE_OFFSET - it must be within 128MB of the kernel text. |
42 | */ | 43 | */ |
43 | #define PAGE_OFFSET UL(0xffffffc000000000) | 44 | #ifdef CONFIG_ARM64_64K_PAGES |
45 | #define VA_BITS (42) | ||
46 | #else | ||
47 | #define VA_BITS (39) | ||
48 | #endif | ||
49 | #define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1)) | ||
44 | #define MODULES_END (PAGE_OFFSET) | 50 | #define MODULES_END (PAGE_OFFSET) |
45 | #define MODULES_VADDR (MODULES_END - SZ_64M) | 51 | #define MODULES_VADDR (MODULES_END - SZ_64M) |
46 | #define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M) | 52 | #define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M) |
47 | #define VA_BITS (39) | ||
48 | #define TASK_SIZE_64 (UL(1) << VA_BITS) | 53 | #define TASK_SIZE_64 (UL(1) << VA_BITS) |
49 | 54 | ||
50 | #ifdef CONFIG_COMPAT | 55 | #ifdef CONFIG_COMPAT |
diff --git a/arch/arm64/include/asm/pgtable-2level-hwdef.h b/arch/arm64/include/asm/pgtable-2level-hwdef.h index 0a8ed3f94e93..2593b490c56a 100644 --- a/arch/arm64/include/asm/pgtable-2level-hwdef.h +++ b/arch/arm64/include/asm/pgtable-2level-hwdef.h | |||
@@ -21,10 +21,10 @@ | |||
21 | * 8192 entries of 8 bytes each, occupying a 64KB page. Levels 0 and 1 are not | 21 | * 8192 entries of 8 bytes each, occupying a 64KB page. Levels 0 and 1 are not |
22 | * used. The 2nd level table (PGD for Linux) can cover a range of 4TB, each | 22 | * used. The 2nd level table (PGD for Linux) can cover a range of 4TB, each |
23 | * entry representing 512MB. The user and kernel address spaces are limited to | 23 | * entry representing 512MB. The user and kernel address spaces are limited to |
24 | * 512GB and therefore we only use 1024 entries in the PGD. | 24 | * 4TB in the 64KB page configuration. |
25 | */ | 25 | */ |
26 | #define PTRS_PER_PTE 8192 | 26 | #define PTRS_PER_PTE 8192 |
27 | #define PTRS_PER_PGD 1024 | 27 | #define PTRS_PER_PGD 8192 |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * PGDIR_SHIFT determines the size a top-level page table entry can map. | 30 | * PGDIR_SHIFT determines the size a top-level page table entry can map. |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index f0bebc5e22cd..17bd3af0a117 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -33,7 +33,7 @@ | |||
33 | /* | 33 | /* |
34 | * VMALLOC and SPARSEMEM_VMEMMAP ranges. | 34 | * VMALLOC and SPARSEMEM_VMEMMAP ranges. |
35 | */ | 35 | */ |
36 | #define VMALLOC_START UL(0xffffff8000000000) | 36 | #define VMALLOC_START (UL(0xffffffffffffffff) << VA_BITS) |
37 | #define VMALLOC_END (PAGE_OFFSET - UL(0x400000000) - SZ_64K) | 37 | #define VMALLOC_END (PAGE_OFFSET - UL(0x400000000) - SZ_64K) |
38 | 38 | ||
39 | #define vmemmap ((struct page *)(VMALLOC_END + SZ_64K)) | 39 | #define vmemmap ((struct page *)(VMALLOC_END + SZ_64K)) |