aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2014-04-02 12:55:40 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2014-04-03 05:43:11 -0400
commit35a86976924a9eda7775b5b02ad47268dca1a5b4 (patch)
tree8adb3553d3443c9d37997c129b8ca1b6f616afbe
parent33648de0b664b2aee48bc6eeea21e107c5757cb5 (diff)
arm64: Update the TCR_EL1 translation granule definitions for 16K pages
The current TCR register setting in arch/arm64/mm/proc.S assumes that TCR_EL1.TG* fields are one bit wide and bit 31 is RES1 (reserved, set to 1). With the addition of 16K pages (currently unsupported in the kernel), the TCR_EL1.TG* fields have been extended to two bits. This patch updates the corresponding Linux definitions and drops the bit 31 setting in proc.S in favour of the new macros. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Joe Sylve <joe.sylve@gmail.com>
-rw-r--r--arch/arm64/include/asm/pgtable-hwdef.h6
-rw-r--r--arch/arm64/mm/proc.S25
2 files changed, 19 insertions, 12 deletions
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index f7af66b54cb2..5fc8a66c3924 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -120,8 +120,12 @@
120#define TCR_ORGN_WBnWA ((UL(3) << 10) | (UL(3) << 26)) 120#define TCR_ORGN_WBnWA ((UL(3) << 10) | (UL(3) << 26))
121#define TCR_ORGN_MASK ((UL(3) << 10) | (UL(3) << 26)) 121#define TCR_ORGN_MASK ((UL(3) << 10) | (UL(3) << 26))
122#define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28)) 122#define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28))
123#define TCR_TG0_4K (UL(0) << 14)
123#define TCR_TG0_64K (UL(1) << 14) 124#define TCR_TG0_64K (UL(1) << 14)
124#define TCR_TG1_64K (UL(1) << 30) 125#define TCR_TG0_16K (UL(2) << 14)
126#define TCR_TG1_16K (UL(1) << 30)
127#define TCR_TG1_4K (UL(2) << 30)
128#define TCR_TG1_64K (UL(3) << 30)
125#define TCR_ASID16 (UL(1) << 36) 129#define TCR_ASID16 (UL(1) << 36)
126#define TCR_TBI0 (UL(1) << 37) 130#define TCR_TBI0 (UL(1) << 37)
127 131
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index e085ee6ef4e2..9042aff5e9e3 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -28,14 +28,21 @@
28 28
29#include "proc-macros.S" 29#include "proc-macros.S"
30 30
31#ifndef CONFIG_SMP 31#ifdef CONFIG_ARM64_64K_PAGES
32/* PTWs cacheable, inner/outer WBWA not shareable */ 32#define TCR_TG_FLAGS TCR_TG0_64K | TCR_TG1_64K
33#define TCR_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA 33#else
34#define TCR_TG_FLAGS TCR_TG0_4K | TCR_TG1_4K
35#endif
36
37#ifdef CONFIG_SMP
38#define TCR_SMP_FLAGS TCR_SHARED
34#else 39#else
35/* PTWs cacheable, inner/outer WBWA shareable */ 40#define TCR_SMP_FLAGS 0
36#define TCR_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA | TCR_SHARED
37#endif 41#endif
38 42
43/* PTWs cacheable, inner/outer WBWA */
44#define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA
45
39#define MAIR(attr, mt) ((attr) << ((mt) * 8)) 46#define MAIR(attr, mt) ((attr) << ((mt) * 8))
40 47
41/* 48/*
@@ -209,18 +216,14 @@ ENTRY(__cpu_setup)
209 * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for 216 * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for
210 * both user and kernel. 217 * both user and kernel.
211 */ 218 */
212 ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | \ 219 ldr x10, =TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \
213 TCR_ASID16 | TCR_TBI0 | (1 << 31) 220 TCR_TG_FLAGS | TCR_ASID16 | TCR_TBI0
214 /* 221 /*
215 * Read the PARange bits from ID_AA64MMFR0_EL1 and set the IPS bits in 222 * Read the PARange bits from ID_AA64MMFR0_EL1 and set the IPS bits in
216 * TCR_EL1. 223 * TCR_EL1.
217 */ 224 */
218 mrs x9, ID_AA64MMFR0_EL1 225 mrs x9, ID_AA64MMFR0_EL1
219 bfi x10, x9, #32, #3 226 bfi x10, x9, #32, #3
220#ifdef CONFIG_ARM64_64K_PAGES
221 orr x10, x10, TCR_TG0_64K
222 orr x10, x10, TCR_TG1_64K
223#endif
224 msr tcr_el1, x10 227 msr tcr_el1, x10
225 ret // return to head.S 228 ret // return to head.S
226ENDPROC(__cpu_setup) 229ENDPROC(__cpu_setup)