• Home
  • Raw
  • Download

Lines Matching +full:n +full:- +full:1

1 /* SPDX-License-Identifier: GPL-2.0 */
12 * Ticket-based spin-locking.
17 u32 ticket_next = 1 << TICKET_NEXT; in arch_spin_lock()
18 u32 *p = &lock->lock; in arch_spin_lock()
22 "1: ldex.w %0, (%2) \n" in arch_spin_lock()
23 " mov %1, %0 \n" in arch_spin_lock()
24 " add %0, %3 \n" in arch_spin_lock()
25 " stex.w %0, (%2) \n" in arch_spin_lock()
26 " bez %0, 1b \n" in arch_spin_lock()
32 lockval.tickets.owner = READ_ONCE(lock->tickets.owner); in arch_spin_lock()
40 u32 ticket_next = 1 << TICKET_NEXT; in arch_spin_trylock()
41 u32 *p = &lock->lock; in arch_spin_trylock()
45 " ldex.w %0, (%3) \n" in arch_spin_trylock()
46 " movi %2, 1 \n" in arch_spin_trylock()
47 " rotli %1, %0, 16 \n" in arch_spin_trylock()
48 " cmpne %1, %0 \n" in arch_spin_trylock()
49 " bt 1f \n" in arch_spin_trylock()
50 " movi %2, 0 \n" in arch_spin_trylock()
51 " add %0, %0, %4 \n" in arch_spin_trylock()
52 " stex.w %0, (%3) \n" in arch_spin_trylock()
53 "1: \n" in arch_spin_trylock()
68 WRITE_ONCE(lock->tickets.owner, lock->tickets.owner + 1); in arch_spin_unlock()
83 struct __raw_tickets tickets = READ_ONCE(lock->tickets); in arch_spin_is_contended()
85 return (tickets.next - tickets.owner) > 1; in arch_spin_is_contended()
97 * Test-and-set spin-locking.
101 u32 *p = &lock->lock; in arch_spin_lock()
105 "1: ldex.w %0, (%1) \n" in arch_spin_lock()
106 " bnez %0, 1b \n" in arch_spin_lock()
107 " movi %0, 1 \n" in arch_spin_lock()
108 " stex.w %0, (%1) \n" in arch_spin_lock()
109 " bez %0, 1b \n" in arch_spin_lock()
119 WRITE_ONCE(lock->lock, 0); in arch_spin_unlock()
124 u32 *p = &lock->lock; in arch_spin_trylock()
128 "1: ldex.w %0, (%1) \n" in arch_spin_trylock()
129 " bnez %0, 2f \n" in arch_spin_trylock()
130 " movi %0, 1 \n" in arch_spin_trylock()
131 " stex.w %0, (%1) \n" in arch_spin_trylock()
132 " bez %0, 1b \n" in arch_spin_trylock()
133 " movi %0, 0 \n" in arch_spin_trylock()
134 "2: \n" in arch_spin_trylock()
145 #define arch_spin_is_locked(x) (READ_ONCE((x)->lock) != 0)
152 u32 *p = &lock->lock; in arch_read_lock()
156 "1: ldex.w %0, (%1) \n" in arch_read_lock()
157 " blz %0, 1b \n" in arch_read_lock()
158 " addi %0, 1 \n" in arch_read_lock()
159 " stex.w %0, (%1) \n" in arch_read_lock()
160 " bez %0, 1b \n" in arch_read_lock()
169 u32 *p = &lock->lock; in arch_read_unlock()
174 "1: ldex.w %0, (%1) \n" in arch_read_unlock()
175 " subi %0, 1 \n" in arch_read_unlock()
176 " stex.w %0, (%1) \n" in arch_read_unlock()
177 " bez %0, 1b \n" in arch_read_unlock()
185 u32 *p = &lock->lock; in arch_read_trylock()
189 "1: ldex.w %0, (%1) \n" in arch_read_trylock()
190 " blz %0, 2f \n" in arch_read_trylock()
191 " addi %0, 1 \n" in arch_read_trylock()
192 " stex.w %0, (%1) \n" in arch_read_trylock()
193 " bez %0, 1b \n" in arch_read_trylock()
194 " movi %0, 0 \n" in arch_read_trylock()
195 "2: \n" in arch_read_trylock()
211 u32 *p = &lock->lock; in arch_write_lock()
215 "1: ldex.w %0, (%1) \n" in arch_write_lock()
216 " bnez %0, 1b \n" in arch_write_lock()
217 " subi %0, 1 \n" in arch_write_lock()
218 " stex.w %0, (%1) \n" in arch_write_lock()
219 " bez %0, 1b \n" in arch_write_lock()
229 WRITE_ONCE(lock->lock, 0); in arch_write_unlock()
234 u32 *p = &lock->lock; in arch_write_trylock()
238 "1: ldex.w %0, (%1) \n" in arch_write_trylock()
239 " bnez %0, 2f \n" in arch_write_trylock()
240 " subi %0, 1 \n" in arch_write_trylock()
241 " stex.w %0, (%1) \n" in arch_write_trylock()
242 " bez %0, 1b \n" in arch_write_trylock()
243 " movi %0, 0 \n" in arch_write_trylock()
244 "2: \n" in arch_write_trylock()