xref: /openbmc/linux/arch/s390/include/asm/rwonce.h (revision d3402925)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef __ASM_S390_RWONCE_H
4 #define __ASM_S390_RWONCE_H
5 
6 #include <linux/compiler_types.h>
7 
8 /*
9  * Use READ_ONCE_ALIGNED_128() for 128-bit block concurrent (atomic) read
10  * accesses. Note that x must be 128-bit aligned, otherwise a specification
11  * exception is generated.
12  */
13 #define READ_ONCE_ALIGNED_128(x)			\
14 ({							\
15 	union {						\
16 		typeof(x) __x;				\
17 		__uint128_t val;			\
18 	} __u;						\
19 							\
20 	BUILD_BUG_ON(sizeof(x) != 16);			\
21 	asm volatile(					\
22 		"	lpq	%[val],%[_x]\n"		\
23 		: [val] "=d" (__u.val)			\
24 		: [_x] "QS" (x)				\
25 		: "memory");				\
26 	__u.__x;					\
27 })
28 
29 #include <asm-generic/rwonce.h>
30 
31 #endif	/* __ASM_S390_RWONCE_H */
32