Lines Matching defs:lock

55  * Add the current task to the lock wait queue, and attempt to take to lock.
60 struct drm_lock *lock = data;
66 if (lock->context == DRM_KERNEL_CONTEXT) {
68 DRM_CURRENTPID, lock->context);
72 if (master->lock.hw_lock == NULL)
75 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
76 lock->context, DRM_CURRENTPID,
77 master->lock.hw_lock->lock, lock->flags);
80 if (lock->context < 0)
83 mutex_enter(&master->lock.lock_mutex);
84 master->lock.user_waiters++;
86 if (drm_lock_take(&master->lock, lock->context)) {
87 master->lock.file_priv = file;
88 master->lock.lock_time = ddi_get_lbolt();
90 break; /* Got lock */
93 ret = cv_wait_sig(&master->lock.lock_cv,
94 &master->lock.lock_mutex);
100 master->lock.user_waiters--;
101 mutex_exit(&master->lock.lock_mutex);
103 DRM_DEBUG("%d %s\n", lock->context,
104 ret ? "interrupted" : "has lock");
107 if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
111 lock->context);
128 * Transfer and free the lock.
133 struct drm_lock *lock = data;
136 if (lock->context == DRM_KERNEL_CONTEXT) {
138 DRM_CURRENTPID, lock->context);
148 if (drm_lock_free(&master->lock, lock->context)) {
156 * Take the heavyweight lock.
158 * \param lock lock pointer.
160 * \return one if the lock is held, or zero otherwise.
162 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
168 volatile unsigned int *lock = &lock_data->hw_lock->lock;
171 old = *lock;
179 } while (!atomic_cmpset_int(lock, old, new));
184 DRM_ERROR("%d holds heavyweight lock\n",
192 /* Have lock */
199 * This takes a lock forcibly and hands it to context. Should ONLY be used
200 * inside *_unlock to give lock to kernel before calling *_dma_schedule.
203 * \param lock lock pointer.
207 * Resets the lock file pointer.
208 * Marks the lock as held by the given context, via the \p cmpxchg instruction.
214 volatile unsigned int *lock = &lock_data->hw_lock->lock;
218 old = *lock;
220 } while (!atomic_cmpset_int(lock, old, new));
225 * Free lock.
228 * \param lock lock.
231 * Resets the lock file pointer.
232 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
233 * waiting on the lock queue.
238 volatile unsigned int *lock = &lock_data->hw_lock->lock;
249 old = *lock;
251 } while (!atomic_cmpset_int(lock, old, new));
254 DRM_ERROR("%d freed heavyweight lock held by %d\n",
265 * This function returns immediately and takes the hw lock
269 * This guarantees that the kernel will _eventually_ have the lock _unless_ it is held
270 * by a blocked process. (In the latter case an explicit wait for the hardware lock would cause
296 volatile unsigned int *lock = &lock_data->hw_lock->lock;
302 old = *lock;
303 } while (!atomic_cmpset_int(lock, old, DRM_KERNEL_CONTEXT));
315 return (file_priv->lock_count && master->lock.hw_lock &&
316 _DRM_LOCK_IS_HELD(master->lock.hw_lock->lock) &&
317 master->lock.file_priv == file_priv);