aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 15:06:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 15:06:03 -0400
commite4f30545a23b6e22fb347a1ad034ce1aa280209c (patch)
tree415db60ace3ab89fe150bca797c690ddaf021432 /arch/arm64/mm
parentd586c86d50cefa0897a51a2dbc714060ccedae76 (diff)
parentebf81a938dade3b450eb11c57fa744cfac4b523f (diff)
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull second set of arm64 updates from Catalin Marinas: "A second pull request for this merging window, mainly with fixes and docs clarification: - Documentation clarification on CPU topology and booting requirements - Additional cache flushing during boot (needed in the presence of external caches or under virtualisation) - DMA range invalidation fix for non cache line aligned buffers - Build failure fix with !COMPAT - Kconfig update for STRICT_DEVMEM" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: Fix DMA range invalidation for cache line unaligned buffers arm64: Add missing Kconfig for CONFIG_STRICT_DEVMEM arm64: fix !CONFIG_COMPAT build failures Revert "arm64: virt: ensure visibility of __boot_cpu_mode" arm64: Relax the kernel cache requirements for boot arm64: Update the TCR_EL1 translation granule definitions for 16K pages ARM: topology: Make it clear that all CPUs need to be described
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r--arch/arm64/mm/cache.S24
-rw-r--r--arch/arm64/mm/proc.S25
2 files changed, 34 insertions, 15 deletions
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index c46f48b33c14..fda756875fa6 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -168,6 +168,14 @@ ENTRY(__flush_dcache_area)
168ENDPROC(__flush_dcache_area) 168ENDPROC(__flush_dcache_area)
169 169
170/* 170/*
171 * __inval_cache_range(start, end)
172 * - start - start address of region
173 * - end - end address of region
174 */
175ENTRY(__inval_cache_range)
176 /* FALLTHROUGH */
177
178/*
171 * __dma_inv_range(start, end) 179 * __dma_inv_range(start, end)
172 * - start - virtual start address of region 180 * - start - virtual start address of region
173 * - end - virtual end address of region 181 * - end - virtual end address of region
@@ -175,14 +183,22 @@ ENDPROC(__flush_dcache_area)
175__dma_inv_range: 183__dma_inv_range:
176 dcache_line_size x2, x3 184 dcache_line_size x2, x3
177 sub x3, x2, #1 185 sub x3, x2, #1
178 bic x0, x0, x3 186 tst x1, x3 // end cache line aligned?
179 bic x1, x1, x3 187 bic x1, x1, x3
1801: dc ivac, x0 // invalidate D / U line 188 b.eq 1f
181 add x0, x0, x2 189 dc civac, x1 // clean & invalidate D / U line
1901: tst x0, x3 // start cache line aligned?
191 bic x0, x0, x3
192 b.eq 2f
193 dc civac, x0 // clean & invalidate D / U line
194 b 3f
1952: dc ivac, x0 // invalidate D / U line
1963: add x0, x0, x2
182 cmp x0, x1 197 cmp x0, x1
183 b.lo 1b 198 b.lo 2b
184 dsb sy 199 dsb sy
185 ret 200 ret
201ENDPROC(__inval_cache_range)
186ENDPROC(__dma_inv_range) 202ENDPROC(__dma_inv_range)
187 203
188/* 204/*
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)