18 #ifndef _ASM_TILE_SPINLOCK_64_H
19 #define _ASM_TILE_SPINLOCK_64_H
22 #define __ARCH_SPIN_CURRENT_SHIFT 17
23 #define __ARCH_SPIN_NEXT_MASK 0x7fff
24 #define __ARCH_SPIN_NEXT_OVERFLOW 0x8000
30 static inline int arch_spin_current(
u32 val)
39 static inline int arch_spin_next(
u32 val)
48 return arch_spin_current(val) != arch_spin_next(val);
70 if (
unlikely(arch_spin_current(val) != ticket))
78 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
88 #define __WRITE_LOCK_BIT (1 << 31)
90 static inline int arch_write_val_locked(
int val)
101 return !arch_write_val_locked(rw->
lock);
110 return rw->
lock == 0;
117 u32 val = __insn_fetchaddgez4(&rw->
lock, 1);
118 if (
unlikely(arch_write_val_locked(val)))
134 __insn_fetchadd4(&rw->
lock, -1);
140 __insn_exch4(&rw->
lock, 0);
145 return !arch_write_val_locked(__insn_fetchaddgez4(&rw->
lock, 1));
153 if (!arch_write_val_locked(val))
158 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
159 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)