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#include <asm/cmpxchg.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* sync_bitops functions are equivalent to the SMP implementation of the
98c2ecf20Sopenharmony_ci * original functions, independently from CONFIG_SMP being defined.
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But
128c2ecf20Sopenharmony_ci * under Xen you might be communicating with a completely external entity
138c2ecf20Sopenharmony_ci * who might be on another CPU (e.g. two uniprocessor guests communicating
148c2ecf20Sopenharmony_ci * via event channels and grant tables). So we need a variant of the bit
158c2ecf20Sopenharmony_ci * ops which are SMP safe even on a UP kernel.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define sync_set_bit(nr, p)			set_bit(nr, p)
198c2ecf20Sopenharmony_ci#define sync_clear_bit(nr, p)			clear_bit(nr, p)
208c2ecf20Sopenharmony_ci#define sync_change_bit(nr, p)			change_bit(nr, p)
218c2ecf20Sopenharmony_ci#define sync_test_and_set_bit(nr, p)		test_and_set_bit(nr, p)
228c2ecf20Sopenharmony_ci#define sync_test_and_clear_bit(nr, p)		test_and_clear_bit(nr, p)
238c2ecf20Sopenharmony_ci#define sync_test_and_change_bit(nr, p)		test_and_change_bit(nr, p)
248c2ecf20Sopenharmony_ci#define sync_test_bit(nr, addr)			test_bit(nr, addr)
258c2ecf20Sopenharmony_ci#define arch_sync_cmpxchg			arch_cmpxchg
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#endif
28