aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/assembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/include/asm/assembler.h')
-rw-r--r--arch/arm64/include/asm/assembler.h53
1 files changed, 49 insertions, 4 deletions
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index d5025c69ca81..28bfe6132eb6 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -87,6 +87,15 @@
87 .endm 87 .endm
88 88
89/* 89/*
90 * NOP sequence
91 */
92 .macro nops, num
93 .rept \num
94 nop
95 .endr
96 .endm
97
98/*
90 * Emit an entry into the exception table 99 * Emit an entry into the exception table
91 */ 100 */
92 .macro _asm_extable, from, to 101 .macro _asm_extable, from, to
@@ -216,11 +225,26 @@ lr .req x30 // link register
216 .macro mmid, rd, rn 225 .macro mmid, rd, rn
217 ldr \rd, [\rn, #MM_CONTEXT_ID] 226 ldr \rd, [\rn, #MM_CONTEXT_ID]
218 .endm 227 .endm
228/*
229 * read_ctr - read CTR_EL0. If the system has mismatched
230 * cache line sizes, provide the system wide safe value
231 * from arm64_ftr_reg_ctrel0.sys_val
232 */
233 .macro read_ctr, reg
234alternative_if_not ARM64_MISMATCHED_CACHE_LINE_SIZE
235 mrs \reg, ctr_el0 // read CTR
236 nop
237alternative_else
238 ldr_l \reg, arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL
239alternative_endif
240 .endm
241
219 242
220/* 243/*
221 * dcache_line_size - get the minimum D-cache line size from the CTR register. 244 * raw_dcache_line_size - get the minimum D-cache line size on this CPU
245 * from the CTR register.
222 */ 246 */
223 .macro dcache_line_size, reg, tmp 247 .macro raw_dcache_line_size, reg, tmp
224 mrs \tmp, ctr_el0 // read CTR 248 mrs \tmp, ctr_el0 // read CTR
225 ubfm \tmp, \tmp, #16, #19 // cache line size encoding 249 ubfm \tmp, \tmp, #16, #19 // cache line size encoding
226 mov \reg, #4 // bytes per word 250 mov \reg, #4 // bytes per word
@@ -228,9 +252,20 @@ lr .req x30 // link register
228 .endm 252 .endm
229 253
230/* 254/*
231 * icache_line_size - get the minimum I-cache line size from the CTR register. 255 * dcache_line_size - get the safe D-cache line size across all CPUs
232 */ 256 */
233 .macro icache_line_size, reg, tmp 257 .macro dcache_line_size, reg, tmp
258 read_ctr \tmp
259 ubfm \tmp, \tmp, #16, #19 // cache line size encoding
260 mov \reg, #4 // bytes per word
261 lsl \reg, \reg, \tmp // actual cache line size
262 .endm
263
264/*
265 * raw_icache_line_size - get the minimum I-cache line size on this CPU
266 * from the CTR register.
267 */
268 .macro raw_icache_line_size, reg, tmp
234 mrs \tmp, ctr_el0 // read CTR 269 mrs \tmp, ctr_el0 // read CTR
235 and \tmp, \tmp, #0xf // cache line size encoding 270 and \tmp, \tmp, #0xf // cache line size encoding
236 mov \reg, #4 // bytes per word 271 mov \reg, #4 // bytes per word
@@ -238,6 +273,16 @@ lr .req x30 // link register
238 .endm 273 .endm
239 274
240/* 275/*
276 * icache_line_size - get the safe I-cache line size across all CPUs
277 */
278 .macro icache_line_size, reg, tmp
279 read_ctr \tmp
280 and \tmp, \tmp, #0xf // cache line size encoding
281 mov \reg, #4 // bytes per word
282 lsl \reg, \reg, \tmp // actual cache line size
283 .endm
284
285/*
241 * tcr_set_idmap_t0sz - update TCR.T0SZ so that we can load the ID map 286 * tcr_set_idmap_t0sz - update TCR.T0SZ so that we can load the ID map
242 */ 287 */
243 .macro tcr_set_idmap_t0sz, valreg, tmpreg 288 .macro tcr_set_idmap_t0sz, valreg, tmpreg