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

MIPS: Add microMIPS MSA support.

This patch adds support for the microMIPS implementation of the MSA
instructions.

Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Reviewed-by: Paul Burton <Paul.Burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6763/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Steven J. Hill and committed by
Ralf Baechle
d96cc3d1 8e9ecbc5

+43 -10
+32 -8
arch/mips/include/asm/asmmacro.h
··· 249 249 .set pop 250 250 .endm 251 251 #else 252 + 253 + #ifdef CONFIG_CPU_MICROMIPS 254 + #define CFC_MSA_INSN 0x587e0056 255 + #define CTC_MSA_INSN 0x583e0816 256 + #define LDD_MSA_INSN 0x58000837 257 + #define STD_MSA_INSN 0x5800083f 258 + #define COPY_UW_MSA_INSN 0x58f00056 259 + #define COPY_UD_MSA_INSN 0x58f80056 260 + #define INSERT_W_MSA_INSN 0x59300816 261 + #define INSERT_D_MSA_INSN 0x59380816 262 + #else 263 + #define CFC_MSA_INSN 0x787e0059 264 + #define CTC_MSA_INSN 0x783e0819 265 + #define LDD_MSA_INSN 0x78000823 266 + #define STD_MSA_INSN 0x78000827 267 + #define COPY_UW_MSA_INSN 0x78f00059 268 + #define COPY_UD_MSA_INSN 0x78f80059 269 + #define INSERT_W_MSA_INSN 0x79300819 270 + #define INSERT_D_MSA_INSN 0x79380819 271 + #endif 272 + 252 273 /* 253 274 * Temporary until all toolchains in use include MSA support. 254 275 */ 255 276 .macro cfcmsa rd, cs 256 277 .set push 257 278 .set noat 258 - .word 0x787e0059 | (\cs << 11) 279 + .insn 280 + .word CFC_MSA_INSN | (\cs << 11) 259 281 move \rd, $1 260 282 .set pop 261 283 .endm ··· 286 264 .set push 287 265 .set noat 288 266 move $1, \rs 289 - .word 0x783e0819 | (\cd << 6) 267 + .word CTC_MSA_INSN | (\cd << 6) 290 268 .set pop 291 269 .endm 292 270 ··· 294 272 .set push 295 273 .set noat 296 274 add $1, \base, \off 297 - .word 0x78000823 | (\wd << 6) 275 + .word LDD_MSA_INSN | (\wd << 6) 298 276 .set pop 299 277 .endm 300 278 ··· 302 280 .set push 303 281 .set noat 304 282 add $1, \base, \off 305 - .word 0x78000827 | (\wd << 6) 283 + .word STD_MSA_INSN | (\wd << 6) 306 284 .set pop 307 285 .endm 308 286 309 287 .macro copy_u_w rd, ws, n 310 288 .set push 311 289 .set noat 312 - .word 0x78f00059 | (\n << 16) | (\ws << 11) 290 + .insn 291 + .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) 313 292 /* move triggers an assembler bug... */ 314 293 or \rd, $1, zero 315 294 .set pop ··· 319 296 .macro copy_u_d rd, ws, n 320 297 .set push 321 298 .set noat 322 - .word 0x78f80059 | (\n << 16) | (\ws << 11) 299 + .insn 300 + .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) 323 301 /* move triggers an assembler bug... */ 324 302 or \rd, $1, zero 325 303 .set pop ··· 331 307 .set noat 332 308 /* move triggers an assembler bug... */ 333 309 or $1, \rs, zero 334 - .word 0x79300819 | (\n << 16) | (\wd << 6) 310 + .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) 335 311 .set pop 336 312 .endm 337 313 ··· 340 316 .set noat 341 317 /* move triggers an assembler bug... */ 342 318 or $1, \rs, zero 343 - .word 0x79380819 | (\n << 16) | (\wd << 6) 319 + .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) 344 320 .set pop 345 321 .endm 346 322 #endif
+11 -2
arch/mips/include/asm/msa.h
··· 96 96 * allow compilation with toolchains that do not support MSA. Once all 97 97 * toolchains in use support MSA these can be removed. 98 98 */ 99 + #ifdef CONFIG_CPU_MICROMIPS 100 + #define CFC_MSA_INSN 0x587e0056 101 + #define CTC_MSA_INSN 0x583e0816 102 + #else 103 + #define CFC_MSA_INSN 0x787e0059 104 + #define CTC_MSA_INSN 0x783e0819 105 + #endif 99 106 100 107 #define __BUILD_MSA_CTL_REG(name, cs) \ 101 108 static inline unsigned int read_msa_##name(void) \ ··· 111 104 __asm__ __volatile__( \ 112 105 " .set push\n" \ 113 106 " .set noat\n" \ 114 - " .word 0x787e0059 | (" #cs " << 11)\n" \ 107 + " .insn\n" \ 108 + " .word #CFC_MSA_INSN | (" #cs " << 11)\n" \ 115 109 " move %0, $1\n" \ 116 110 " .set pop\n" \ 117 111 : "=r"(reg)); \ ··· 125 117 " .set push\n" \ 126 118 " .set noat\n" \ 127 119 " move $1, %0\n" \ 128 - " .word 0x783e0819 | (" #cs " << 6)\n" \ 120 + " .insn\n" \ 121 + " .word #CTC_MSA_INSN | (" #cs " << 6)\n" \ 129 122 " .set pop\n" \ 130 123 : : "r"(val)); \ 131 124 }