Lines Matching refs:dev_priv

48 	struct vmw_private *dev_priv = vmw_priv(dev);  in vmw_thread_fn()  local
52 dev_priv->irqthread_pending)) { in vmw_thread_fn()
53 vmw_fences_update(dev_priv->fman); in vmw_thread_fn()
54 wake_up_all(&dev_priv->fence_queue); in vmw_thread_fn()
59 dev_priv->irqthread_pending)) { in vmw_thread_fn()
60 vmw_cmdbuf_irqthread(dev_priv->cman); in vmw_thread_fn()
81 struct vmw_private *dev_priv = vmw_priv(dev); in vmw_irq_handler() local
85 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_handler()
86 masked_status = status & READ_ONCE(dev_priv->irq_mask); in vmw_irq_handler()
89 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_handler()
95 wake_up_all(&dev_priv->fifo_queue); in vmw_irq_handler()
99 !test_and_set_bit(VMW_IRQTHREAD_FENCE, dev_priv->irqthread_pending)) in vmw_irq_handler()
105 dev_priv->irqthread_pending)) in vmw_irq_handler()
111 static bool vmw_fifo_idle(struct vmw_private *dev_priv, uint32_t seqno) in vmw_fifo_idle() argument
114 return (vmw_read(dev_priv, SVGA_REG_BUSY) == 0); in vmw_fifo_idle()
117 void vmw_update_seqno(struct vmw_private *dev_priv, in vmw_update_seqno() argument
120 u32 *fifo_mem = dev_priv->mmio_virt; in vmw_update_seqno()
123 if (dev_priv->last_read_seqno != seqno) { in vmw_update_seqno()
124 dev_priv->last_read_seqno = seqno; in vmw_update_seqno()
126 vmw_fences_update(dev_priv->fman); in vmw_update_seqno()
130 bool vmw_seqno_passed(struct vmw_private *dev_priv, in vmw_seqno_passed() argument
136 if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP)) in vmw_seqno_passed()
139 fifo_state = &dev_priv->fifo; in vmw_seqno_passed()
140 vmw_update_seqno(dev_priv, fifo_state); in vmw_seqno_passed()
141 if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP)) in vmw_seqno_passed()
145 vmw_fifo_idle(dev_priv, seqno)) in vmw_seqno_passed()
153 ret = ((atomic_read(&dev_priv->marker_seq) - seqno) in vmw_seqno_passed()
159 int vmw_fallback_wait(struct vmw_private *dev_priv, in vmw_fallback_wait() argument
166 struct vmw_fifo_state *fifo_state = &dev_priv->fifo; in vmw_fallback_wait()
184 if (dev_priv->cman) { in vmw_fallback_wait()
185 ret = vmw_cmdbuf_idle(dev_priv->cman, interruptible, in vmw_fallback_wait()
192 signal_seq = atomic_read(&dev_priv->marker_seq); in vmw_fallback_wait()
196 prepare_to_wait(&dev_priv->fence_queue, &__wait, in vmw_fallback_wait()
199 if (wait_condition(dev_priv, seqno)) in vmw_fallback_wait()
224 finish_wait(&dev_priv->fence_queue, &__wait); in vmw_fallback_wait()
226 u32 *fifo_mem = dev_priv->mmio_virt; in vmw_fallback_wait()
230 wake_up_all(&dev_priv->fence_queue); in vmw_fallback_wait()
238 void vmw_generic_waiter_add(struct vmw_private *dev_priv, in vmw_generic_waiter_add() argument
241 spin_lock_bh(&dev_priv->waiter_lock); in vmw_generic_waiter_add()
243 outl(flag, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_generic_waiter_add()
244 dev_priv->irq_mask |= flag; in vmw_generic_waiter_add()
245 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask); in vmw_generic_waiter_add()
247 spin_unlock_bh(&dev_priv->waiter_lock); in vmw_generic_waiter_add()
250 void vmw_generic_waiter_remove(struct vmw_private *dev_priv, in vmw_generic_waiter_remove() argument
253 spin_lock_bh(&dev_priv->waiter_lock); in vmw_generic_waiter_remove()
255 dev_priv->irq_mask &= ~flag; in vmw_generic_waiter_remove()
256 vmw_write(dev_priv, SVGA_REG_IRQMASK, dev_priv->irq_mask); in vmw_generic_waiter_remove()
258 spin_unlock_bh(&dev_priv->waiter_lock); in vmw_generic_waiter_remove()
261 void vmw_seqno_waiter_add(struct vmw_private *dev_priv) in vmw_seqno_waiter_add() argument
263 vmw_generic_waiter_add(dev_priv, SVGA_IRQFLAG_ANY_FENCE, in vmw_seqno_waiter_add()
264 &dev_priv->fence_queue_waiters); in vmw_seqno_waiter_add()
267 void vmw_seqno_waiter_remove(struct vmw_private *dev_priv) in vmw_seqno_waiter_remove() argument
269 vmw_generic_waiter_remove(dev_priv, SVGA_IRQFLAG_ANY_FENCE, in vmw_seqno_waiter_remove()
270 &dev_priv->fence_queue_waiters); in vmw_seqno_waiter_remove()
273 void vmw_goal_waiter_add(struct vmw_private *dev_priv) in vmw_goal_waiter_add() argument
275 vmw_generic_waiter_add(dev_priv, SVGA_IRQFLAG_FENCE_GOAL, in vmw_goal_waiter_add()
276 &dev_priv->goal_queue_waiters); in vmw_goal_waiter_add()
279 void vmw_goal_waiter_remove(struct vmw_private *dev_priv) in vmw_goal_waiter_remove() argument
281 vmw_generic_waiter_remove(dev_priv, SVGA_IRQFLAG_FENCE_GOAL, in vmw_goal_waiter_remove()
282 &dev_priv->goal_queue_waiters); in vmw_goal_waiter_remove()
285 int vmw_wait_seqno(struct vmw_private *dev_priv, in vmw_wait_seqno() argument
290 struct vmw_fifo_state *fifo = &dev_priv->fifo; in vmw_wait_seqno()
292 if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP)) in vmw_wait_seqno()
295 if (likely(vmw_seqno_passed(dev_priv, seqno))) in vmw_wait_seqno()
298 vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC); in vmw_wait_seqno()
301 return vmw_fallback_wait(dev_priv, lazy, true, seqno, in vmw_wait_seqno()
304 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK)) in vmw_wait_seqno()
305 return vmw_fallback_wait(dev_priv, lazy, false, seqno, in vmw_wait_seqno()
308 vmw_seqno_waiter_add(dev_priv); in vmw_wait_seqno()
312 (dev_priv->fence_queue, in vmw_wait_seqno()
313 vmw_seqno_passed(dev_priv, seqno), in vmw_wait_seqno()
317 (dev_priv->fence_queue, in vmw_wait_seqno()
318 vmw_seqno_passed(dev_priv, seqno), in vmw_wait_seqno()
321 vmw_seqno_waiter_remove(dev_priv); in vmw_wait_seqno()
333 struct vmw_private *dev_priv = vmw_priv(dev); in vmw_irq_preinstall() local
336 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_preinstall()
337 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_preinstall()
342 struct vmw_private *dev_priv = vmw_priv(dev); in vmw_irq_uninstall() local
345 if (!(dev_priv->capabilities & SVGA_CAP_IRQMASK)) in vmw_irq_uninstall()
351 vmw_write(dev_priv, SVGA_REG_IRQMASK, 0); in vmw_irq_uninstall()
353 status = inl(dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_uninstall()
354 outl(status, dev_priv->io_start + VMWGFX_IRQSTATUS_PORT); in vmw_irq_uninstall()