Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: uaccess: move uao_* alternatives to asm-uaccess.h

The uao_* alternative asm macros are only used by the uaccess assembly
routines in arch/arm64/lib/, where they are included indirectly via
asm-uaccess.h. Since they're specific to the uaccess assembly (and will
lose the alternatives in subsequent patches), let's move them into
asm-uaccess.h.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
[will: update #include in mte.S to pull in uao asm macros]
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Mark Rutland and committed by
Will Deacon
e2a2190a f8394f23

+60 -60
-59
arch/arm64/include/asm/alternative.h
··· 224 224 _asm_extable 9999b, \label 225 225 .endm 226 226 227 - /* 228 - * Generate the assembly for UAO alternatives with exception table entries. 229 - * This is complicated as there is no post-increment or pair versions of the 230 - * unprivileged instructions, and USER() only works for single instructions. 231 - */ 232 - #ifdef CONFIG_ARM64_UAO 233 - .macro uao_ldp l, reg1, reg2, addr, post_inc 234 - alternative_if_not ARM64_HAS_UAO 235 - 8888: ldp \reg1, \reg2, [\addr], \post_inc; 236 - 8889: nop; 237 - nop; 238 - alternative_else 239 - ldtr \reg1, [\addr]; 240 - ldtr \reg2, [\addr, #8]; 241 - add \addr, \addr, \post_inc; 242 - alternative_endif 243 - 244 - _asm_extable 8888b,\l; 245 - _asm_extable 8889b,\l; 246 - .endm 247 - 248 - .macro uao_stp l, reg1, reg2, addr, post_inc 249 - alternative_if_not ARM64_HAS_UAO 250 - 8888: stp \reg1, \reg2, [\addr], \post_inc; 251 - 8889: nop; 252 - nop; 253 - alternative_else 254 - sttr \reg1, [\addr]; 255 - sttr \reg2, [\addr, #8]; 256 - add \addr, \addr, \post_inc; 257 - alternative_endif 258 - 259 - _asm_extable 8888b,\l; 260 - _asm_extable 8889b,\l; 261 - .endm 262 - 263 - .macro uao_user_alternative l, inst, alt_inst, reg, addr, post_inc 264 - alternative_if_not ARM64_HAS_UAO 265 - 8888: \inst \reg, [\addr], \post_inc; 266 - nop; 267 - alternative_else 268 - \alt_inst \reg, [\addr]; 269 - add \addr, \addr, \post_inc; 270 - alternative_endif 271 - 272 - _asm_extable 8888b,\l; 273 - .endm 274 - #else 275 - .macro uao_ldp l, reg1, reg2, addr, post_inc 276 - USER(\l, ldp \reg1, \reg2, [\addr], \post_inc) 277 - .endm 278 - .macro uao_stp l, reg1, reg2, addr, post_inc 279 - USER(\l, stp \reg1, \reg2, [\addr], \post_inc) 280 - .endm 281 - .macro uao_user_alternative l, inst, alt_inst, reg, addr, post_inc 282 - USER(\l, \inst \reg, [\addr], \post_inc) 283 - .endm 284 - #endif 285 - 286 227 #endif /* __ASSEMBLY__ */ 287 228 288 229 /*
+59
arch/arm64/include/asm/asm-uaccess.h
··· 58 58 .endm 59 59 #endif 60 60 61 + /* 62 + * Generate the assembly for UAO alternatives with exception table entries. 63 + * This is complicated as there is no post-increment or pair versions of the 64 + * unprivileged instructions, and USER() only works for single instructions. 65 + */ 66 + #ifdef CONFIG_ARM64_UAO 67 + .macro uao_ldp l, reg1, reg2, addr, post_inc 68 + alternative_if_not ARM64_HAS_UAO 69 + 8888: ldp \reg1, \reg2, [\addr], \post_inc; 70 + 8889: nop; 71 + nop; 72 + alternative_else 73 + ldtr \reg1, [\addr]; 74 + ldtr \reg2, [\addr, #8]; 75 + add \addr, \addr, \post_inc; 76 + alternative_endif 77 + 78 + _asm_extable 8888b,\l; 79 + _asm_extable 8889b,\l; 80 + .endm 81 + 82 + .macro uao_stp l, reg1, reg2, addr, post_inc 83 + alternative_if_not ARM64_HAS_UAO 84 + 8888: stp \reg1, \reg2, [\addr], \post_inc; 85 + 8889: nop; 86 + nop; 87 + alternative_else 88 + sttr \reg1, [\addr]; 89 + sttr \reg2, [\addr, #8]; 90 + add \addr, \addr, \post_inc; 91 + alternative_endif 92 + 93 + _asm_extable 8888b,\l; 94 + _asm_extable 8889b,\l; 95 + .endm 96 + 97 + .macro uao_user_alternative l, inst, alt_inst, reg, addr, post_inc 98 + alternative_if_not ARM64_HAS_UAO 99 + 8888: \inst \reg, [\addr], \post_inc; 100 + nop; 101 + alternative_else 102 + \alt_inst \reg, [\addr]; 103 + add \addr, \addr, \post_inc; 104 + alternative_endif 105 + 106 + _asm_extable 8888b,\l; 107 + .endm 108 + #else 109 + .macro uao_ldp l, reg1, reg2, addr, post_inc 110 + USER(\l, ldp \reg1, \reg2, [\addr], \post_inc) 111 + .endm 112 + .macro uao_stp l, reg1, reg2, addr, post_inc 113 + USER(\l, stp \reg1, \reg2, [\addr], \post_inc) 114 + .endm 115 + .macro uao_user_alternative l, inst, alt_inst, reg, addr, post_inc 116 + USER(\l, \inst \reg, [\addr], \post_inc) 117 + .endm 118 + #endif 119 + 61 120 #endif
+1 -1
arch/arm64/lib/mte.S
··· 4 4 */ 5 5 #include <linux/linkage.h> 6 6 7 - #include <asm/alternative.h> 7 + #include <asm/asm-uaccess.h> 8 8 #include <asm/assembler.h> 9 9 #include <asm/mte.h> 10 10 #include <asm/page.h>