diff options
author | Radha Mohan Chintakuntla <rchintakuntla@cavium.com> | 2014-03-07 03:49:25 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-03-13 07:22:36 -0400 |
commit | 87366d8cf7b3f6dc34633938aa8766e5a390ce33 (patch) | |
tree | 9af5603c6cf5627207b0b78a44777bdfde6a1f87 | |
parent | 71fdb6bf61bf0692f004f9daf5650392c0cfe300 (diff) |
arm64: Add boot time configuration of Intermediate Physical Address size
ARMv8 supports a range of physical address bit sizes. The PARange bits
from ID_AA64MMFR0_EL1 register are read during boot-time and the
intermediate physical address size bits are written in the translation
control registers (TCR_EL1 and VTCR_EL2).
There is no change in the VA bits and levels of translation.
Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Reviewed-by: Will Deacon <Will.deacon@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/include/asm/kvm_arm.h | 15 | ||||
-rw-r--r-- | arch/arm64/include/asm/pgtable-hwdef.h | 5 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp-init.S | 6 | ||||
-rw-r--r-- | arch/arm64/mm/proc.S | 8 |
4 files changed, 21 insertions, 13 deletions
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 0eb398655378..21ef48d32ff2 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h | |||
@@ -106,7 +106,6 @@ | |||
106 | 106 | ||
107 | /* VTCR_EL2 Registers bits */ | 107 | /* VTCR_EL2 Registers bits */ |
108 | #define VTCR_EL2_PS_MASK (7 << 16) | 108 | #define VTCR_EL2_PS_MASK (7 << 16) |
109 | #define VTCR_EL2_PS_40B (2 << 16) | ||
110 | #define VTCR_EL2_TG0_MASK (1 << 14) | 109 | #define VTCR_EL2_TG0_MASK (1 << 14) |
111 | #define VTCR_EL2_TG0_4K (0 << 14) | 110 | #define VTCR_EL2_TG0_4K (0 << 14) |
112 | #define VTCR_EL2_TG0_64K (1 << 14) | 111 | #define VTCR_EL2_TG0_64K (1 << 14) |
@@ -129,10 +128,9 @@ | |||
129 | * 64kB pages (TG0 = 1) | 128 | * 64kB pages (TG0 = 1) |
130 | * 2 level page tables (SL = 1) | 129 | * 2 level page tables (SL = 1) |
131 | */ | 130 | */ |
132 | #define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_64K | \ | 131 | #define VTCR_EL2_FLAGS (VTCR_EL2_TG0_64K | VTCR_EL2_SH0_INNER | \ |
133 | VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \ | 132 | VTCR_EL2_ORGN0_WBWA | VTCR_EL2_IRGN0_WBWA | \ |
134 | VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \ | 133 | VTCR_EL2_SL0_LVL1 | VTCR_EL2_T0SZ_40B) |
135 | VTCR_EL2_T0SZ_40B) | ||
136 | #define VTTBR_X (38 - VTCR_EL2_T0SZ_40B) | 134 | #define VTTBR_X (38 - VTCR_EL2_T0SZ_40B) |
137 | #else | 135 | #else |
138 | /* | 136 | /* |
@@ -142,10 +140,9 @@ | |||
142 | * 4kB pages (TG0 = 0) | 140 | * 4kB pages (TG0 = 0) |
143 | * 3 level page tables (SL = 1) | 141 | * 3 level page tables (SL = 1) |
144 | */ | 142 | */ |
145 | #define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_4K | \ | 143 | #define VTCR_EL2_FLAGS (VTCR_EL2_TG0_4K | VTCR_EL2_SH0_INNER | \ |
146 | VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \ | 144 | VTCR_EL2_ORGN0_WBWA | VTCR_EL2_IRGN0_WBWA | \ |
147 | VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \ | 145 | VTCR_EL2_SL0_LVL1 | VTCR_EL2_T0SZ_40B) |
148 | VTCR_EL2_T0SZ_40B) | ||
149 | #define VTTBR_X (37 - VTCR_EL2_T0SZ_40B) | 146 | #define VTTBR_X (37 - VTCR_EL2_T0SZ_40B) |
150 | #endif | 147 | #endif |
151 | 148 | ||
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index b1d2e26c3c88..f7af66b54cb2 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h | |||
@@ -100,9 +100,9 @@ | |||
100 | #define PTE_HYP PTE_USER | 100 | #define PTE_HYP PTE_USER |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * 40-bit physical address supported. | 103 | * Highest possible physical address supported. |
104 | */ | 104 | */ |
105 | #define PHYS_MASK_SHIFT (40) | 105 | #define PHYS_MASK_SHIFT (48) |
106 | #define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) | 106 | #define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) |
107 | 107 | ||
108 | /* | 108 | /* |
@@ -122,7 +122,6 @@ | |||
122 | #define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28)) | 122 | #define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28)) |
123 | #define TCR_TG0_64K (UL(1) << 14) | 123 | #define TCR_TG0_64K (UL(1) << 14) |
124 | #define TCR_TG1_64K (UL(1) << 30) | 124 | #define TCR_TG1_64K (UL(1) << 30) |
125 | #define TCR_IPS_40BIT (UL(2) << 32) | ||
126 | #define TCR_ASID16 (UL(1) << 36) | 125 | #define TCR_ASID16 (UL(1) << 36) |
127 | #define TCR_TBI0 (UL(1) << 37) | 126 | #define TCR_TBI0 (UL(1) << 37) |
128 | 127 | ||
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index 2b0244d65c16..d968796f4b2d 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S | |||
@@ -68,6 +68,12 @@ __do_hyp_init: | |||
68 | msr tcr_el2, x4 | 68 | msr tcr_el2, x4 |
69 | 69 | ||
70 | ldr x4, =VTCR_EL2_FLAGS | 70 | ldr x4, =VTCR_EL2_FLAGS |
71 | /* | ||
72 | * Read the PARange bits from ID_AA64MMFR0_EL1 and set the PS bits in | ||
73 | * VTCR_EL2. | ||
74 | */ | ||
75 | mrs x5, ID_AA64MMFR0_EL1 | ||
76 | bfi x4, x5, #16, #3 | ||
71 | msr vtcr_el2, x4 | 77 | msr vtcr_el2, x4 |
72 | 78 | ||
73 | mrs x4, mair_el1 | 79 | mrs x4, mair_el1 |
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index e0ef63cd05dc..e085ee6ef4e2 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S | |||
@@ -209,8 +209,14 @@ ENTRY(__cpu_setup) | |||
209 | * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for | 209 | * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for |
210 | * both user and kernel. | 210 | * both user and kernel. |
211 | */ | 211 | */ |
212 | ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | TCR_IPS_40BIT | \ | 212 | ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | \ |
213 | TCR_ASID16 | TCR_TBI0 | (1 << 31) | 213 | TCR_ASID16 | TCR_TBI0 | (1 << 31) |
214 | /* | ||
215 | * Read the PARange bits from ID_AA64MMFR0_EL1 and set the IPS bits in | ||
216 | * TCR_EL1. | ||
217 | */ | ||
218 | mrs x9, ID_AA64MMFR0_EL1 | ||
219 | bfi x10, x9, #32, #3 | ||
214 | #ifdef CONFIG_ARM64_64K_PAGES | 220 | #ifdef CONFIG_ARM64_64K_PAGES |
215 | orr x10, x10, TCR_TG0_64K | 221 | orr x10, x10, TCR_TG0_64K |
216 | orr x10, x10, TCR_TG1_64K | 222 | orr x10, x10, TCR_TG1_64K |