162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __ASM_SYNC_BITOPS_H__
362306a36Sopenharmony_ci#define __ASM_SYNC_BITOPS_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <asm/bitops.h>
662306a36Sopenharmony_ci#include <asm/cmpxchg.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/* sync_bitops functions are equivalent to the SMP implementation of the
962306a36Sopenharmony_ci * original functions, independently from CONFIG_SMP being defined.
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But
1262306a36Sopenharmony_ci * under Xen you might be communicating with a completely external entity
1362306a36Sopenharmony_ci * who might be on another CPU (e.g. two uniprocessor guests communicating
1462306a36Sopenharmony_ci * via event channels and grant tables). So we need a variant of the bit
1562306a36Sopenharmony_ci * ops which are SMP safe even on a UP kernel.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define sync_set_bit(nr, p)			set_bit(nr, p)
1962306a36Sopenharmony_ci#define sync_clear_bit(nr, p)			clear_bit(nr, p)
2062306a36Sopenharmony_ci#define sync_change_bit(nr, p)			change_bit(nr, p)
2162306a36Sopenharmony_ci#define sync_test_and_set_bit(nr, p)		test_and_set_bit(nr, p)
2262306a36Sopenharmony_ci#define sync_test_and_clear_bit(nr, p)		test_and_clear_bit(nr, p)
2362306a36Sopenharmony_ci#define sync_test_and_change_bit(nr, p)		test_and_change_bit(nr, p)
2462306a36Sopenharmony_ci#define sync_test_bit(nr, addr)			test_bit(nr, addr)
2562306a36Sopenharmony_ci#define arch_sync_cmpxchg			arch_cmpxchg
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#endif
28