18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_SYNC_BITOPS_H__
38c2ecf20Sopenharmony_ci#define __ASM_SYNC_BITOPS_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/bitops.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* sync_bitops functions are equivalent to the SMP implementation of the
88c2ecf20Sopenharmony_ci * original functions, independently from CONFIG_SMP being defined.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But
118c2ecf20Sopenharmony_ci * under Xen you might be communicating with a completely external entity
128c2ecf20Sopenharmony_ci * who might be on another CPU (e.g. two uniprocessor guests communicating
138c2ecf20Sopenharmony_ci * via event channels and grant tables). So we need a variant of the bit
148c2ecf20Sopenharmony_ci * ops which are SMP safe even on a UP kernel.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define sync_set_bit(nr, p)		_set_bit(nr, p)
188c2ecf20Sopenharmony_ci#define sync_clear_bit(nr, p)		_clear_bit(nr, p)
198c2ecf20Sopenharmony_ci#define sync_change_bit(nr, p)		_change_bit(nr, p)
208c2ecf20Sopenharmony_ci#define sync_test_and_set_bit(nr, p)	_test_and_set_bit(nr, p)
218c2ecf20Sopenharmony_ci#define sync_test_and_clear_bit(nr, p)	_test_and_clear_bit(nr, p)
228c2ecf20Sopenharmony_ci#define sync_test_and_change_bit(nr, p)	_test_and_change_bit(nr, p)
238c2ecf20Sopenharmony_ci#define sync_test_bit(nr, addr)		test_bit(nr, addr)
248c2ecf20Sopenharmony_ci#define sync_cmpxchg			cmpxchg
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#endif
28