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

MIPS: Octeon: Reverse the order of register accesses to the FAU

64 bit access is unaffected but for 32 bit access, swap high and
low words. Similarly for 16 bit access, reverse the order of the
four possible words, and for 8 bit access reverse the order of byte
accesses.

Signed-off-by: Paul Martin <paul.martin@codethink.co.uk>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9630/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Martin and committed by
Ralf Baechle
f1e770cf b0abf36f

+22
+22
arch/mips/include/asm/octeon/cvmx-fau.h
··· 105 105 } s; 106 106 } cvmx_fau_async_tagwait_result_t; 107 107 108 + #ifdef __BIG_ENDIAN_BITFIELD 109 + #define SWIZZLE_8 0 110 + #define SWIZZLE_16 0 111 + #define SWIZZLE_32 0 112 + #else 113 + #define SWIZZLE_8 0x7 114 + #define SWIZZLE_16 0x6 115 + #define SWIZZLE_32 0x4 116 + #endif 117 + 108 118 /** 109 119 * Builds a store I/O address for writing to the FAU 110 120 * ··· 185 175 static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg, 186 176 int32_t value) 187 177 { 178 + reg ^= SWIZZLE_32; 188 179 return cvmx_read64_int32(__cvmx_fau_atomic_address(0, reg, value)); 189 180 } 190 181 ··· 200 189 static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg, 201 190 int16_t value) 202 191 { 192 + reg ^= SWIZZLE_16; 203 193 return cvmx_read64_int16(__cvmx_fau_atomic_address(0, reg, value)); 204 194 } 205 195 ··· 213 201 */ 214 202 static inline int8_t cvmx_fau_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value) 215 203 { 204 + reg ^= SWIZZLE_8; 216 205 return cvmx_read64_int8(__cvmx_fau_atomic_address(0, reg, value)); 217 206 } 218 207 ··· 260 247 uint64_t i32; 261 248 cvmx_fau_tagwait32_t t; 262 249 } result; 250 + reg ^= SWIZZLE_32; 263 251 result.i32 = 264 252 cvmx_read64_int32(__cvmx_fau_atomic_address(1, reg, value)); 265 253 return result.t; ··· 284 270 uint64_t i16; 285 271 cvmx_fau_tagwait16_t t; 286 272 } result; 273 + reg ^= SWIZZLE_16; 287 274 result.i16 = 288 275 cvmx_read64_int16(__cvmx_fau_atomic_address(1, reg, value)); 289 276 return result.t; ··· 307 292 uint64_t i8; 308 293 cvmx_fau_tagwait8_t t; 309 294 } result; 295 + reg ^= SWIZZLE_8; 310 296 result.i8 = cvmx_read64_int8(__cvmx_fau_atomic_address(1, reg, value)); 311 297 return result.t; 312 298 } ··· 537 521 */ 538 522 static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value) 539 523 { 524 + reg ^= SWIZZLE_32; 540 525 cvmx_write64_int32(__cvmx_fau_store_address(0, reg), value); 541 526 } 542 527 ··· 550 533 */ 551 534 static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value) 552 535 { 536 + reg ^= SWIZZLE_16; 553 537 cvmx_write64_int16(__cvmx_fau_store_address(0, reg), value); 554 538 } 555 539 ··· 562 544 */ 563 545 static inline void cvmx_fau_atomic_add8(cvmx_fau_reg_8_t reg, int8_t value) 564 546 { 547 + reg ^= SWIZZLE_8; 565 548 cvmx_write64_int8(__cvmx_fau_store_address(0, reg), value); 566 549 } 567 550 ··· 587 568 */ 588 569 static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value) 589 570 { 571 + reg ^= SWIZZLE_32; 590 572 cvmx_write64_int32(__cvmx_fau_store_address(1, reg), value); 591 573 } 592 574 ··· 600 580 */ 601 581 static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value) 602 582 { 583 + reg ^= SWIZZLE_16; 603 584 cvmx_write64_int16(__cvmx_fau_store_address(1, reg), value); 604 585 } 605 586 ··· 612 591 */ 613 592 static inline void cvmx_fau_atomic_write8(cvmx_fau_reg_8_t reg, int8_t value) 614 593 { 594 + reg ^= SWIZZLE_8; 615 595 cvmx_write64_int8(__cvmx_fau_store_address(1, reg), value); 616 596 } 617 597