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

Configure Feed

Select the types of activity you want to include in your feed.

locking/atomic: sh: add preprocessor symbols

Some atomics can be implemented in several different ways, e.g.
FULL/ACQUIRE/RELEASE ordered atomics can be implemented in terms of
RELAXED atomics, and ACQUIRE/RELEASE/RELAXED can be implemented in terms
of FULL ordered atomics. Other atomics are optional, and don't exist in
some configurations (e.g. not all architectures implement the 128-bit
cmpxchg ops).

Subsequent patches will require that architectures define a preprocessor
symbol for any atomic (or ordering variant) which is optional. This will
make the fallback ifdeffery more robust, and simplify future changes.

Add the required definitions to arch/sh.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230605070124.3741859-11-mark.rutland@arm.com

authored by

Mark Rutland and committed by
Peter Zijlstra
770345ad 07bf3dcb

+27
+9
arch/sh/include/asm/atomic-grb.h
··· 71 71 ATOMIC_OPS(add) 72 72 ATOMIC_OPS(sub) 73 73 74 + #define arch_atomic_add_return arch_atomic_add_return 75 + #define arch_atomic_sub_return arch_atomic_sub_return 76 + #define arch_atomic_fetch_add arch_atomic_fetch_add 77 + #define arch_atomic_fetch_sub arch_atomic_fetch_sub 78 + 74 79 #undef ATOMIC_OPS 75 80 #define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) 76 81 77 82 ATOMIC_OPS(and) 78 83 ATOMIC_OPS(or) 79 84 ATOMIC_OPS(xor) 85 + 86 + #define arch_atomic_fetch_and arch_atomic_fetch_and 87 + #define arch_atomic_fetch_or arch_atomic_fetch_or 88 + #define arch_atomic_fetch_xor arch_atomic_fetch_xor 80 89 81 90 #undef ATOMIC_OPS 82 91 #undef ATOMIC_FETCH_OP
+9
arch/sh/include/asm/atomic-irq.h
··· 55 55 ATOMIC_OPS(add, +=) 56 56 ATOMIC_OPS(sub, -=) 57 57 58 + #define arch_atomic_add_return arch_atomic_add_return 59 + #define arch_atomic_sub_return arch_atomic_sub_return 60 + #define arch_atomic_fetch_add arch_atomic_fetch_add 61 + #define arch_atomic_fetch_sub arch_atomic_fetch_sub 62 + 58 63 #undef ATOMIC_OPS 59 64 #define ATOMIC_OPS(op, c_op) \ 60 65 ATOMIC_OP(op, c_op) \ ··· 68 63 ATOMIC_OPS(and, &=) 69 64 ATOMIC_OPS(or, |=) 70 65 ATOMIC_OPS(xor, ^=) 66 + 67 + #define arch_atomic_fetch_and arch_atomic_fetch_and 68 + #define arch_atomic_fetch_or arch_atomic_fetch_or 69 + #define arch_atomic_fetch_xor arch_atomic_fetch_xor 71 70 72 71 #undef ATOMIC_OPS 73 72 #undef ATOMIC_FETCH_OP
+9
arch/sh/include/asm/atomic-llsc.h
··· 73 73 ATOMIC_OPS(add) 74 74 ATOMIC_OPS(sub) 75 75 76 + #define arch_atomic_add_return arch_atomic_add_return 77 + #define arch_atomic_sub_return arch_atomic_sub_return 78 + #define arch_atomic_fetch_add arch_atomic_fetch_add 79 + #define arch_atomic_fetch_sub arch_atomic_fetch_sub 80 + 76 81 #undef ATOMIC_OPS 77 82 #define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) 78 83 79 84 ATOMIC_OPS(and) 80 85 ATOMIC_OPS(or) 81 86 ATOMIC_OPS(xor) 87 + 88 + #define arch_atomic_fetch_and arch_atomic_fetch_and 89 + #define arch_atomic_fetch_or arch_atomic_fetch_or 90 + #define arch_atomic_fetch_xor arch_atomic_fetch_xor 82 91 83 92 #undef ATOMIC_OPS 84 93 #undef ATOMIC_FETCH_OP