// SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * * Copyright 2009-2015 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #include <linux/pci.h> #include <linux/sched/signal.h> #include "vmwgfx_drv.h" #define VMW_FENCE_WRAP … static u32 vmw_irqflag_fence_goal(struct vmw_private *vmw) { … } /** * vmw_thread_fn - Deferred (process context) irq handler * * @irq: irq number * @arg: Closure argument. Pointer to a struct drm_device cast to void * * * This function implements the deferred part of irq processing. * The function is guaranteed to run at least once after the * vmw_irq_handler has returned with IRQ_WAKE_THREAD. * */ static irqreturn_t vmw_thread_fn(int irq, void *arg) { … } /** * vmw_irq_handler: irq handler * * @irq: irq number * @arg: Closure argument. Pointer to a struct drm_device cast to void * * * This function implements the quick part of irq processing. * The function performs fast actions like clearing the device interrupt * flags and also reasonably quick actions like waking processes waiting for * FIFO space. Other IRQ actions are deferred to the IRQ thread. */ static irqreturn_t vmw_irq_handler(int irq, void *arg) { … } static bool vmw_fifo_idle(struct vmw_private *dev_priv, uint32_t seqno) { … } void vmw_update_seqno(struct vmw_private *dev_priv) { … } bool vmw_seqno_passed(struct vmw_private *dev_priv, uint32_t seqno) { … } int vmw_fallback_wait(struct vmw_private *dev_priv, bool lazy, bool fifo_idle, uint32_t seqno, bool interruptible, unsigned long timeout) { … } void vmw_generic_waiter_add(struct vmw_private *dev_priv, u32 flag, int *waiter_count) { … } void vmw_generic_waiter_remove(struct vmw_private *dev_priv, u32 flag, int *waiter_count) { … } void vmw_seqno_waiter_add(struct vmw_private *dev_priv) { … } void vmw_seqno_waiter_remove(struct vmw_private *dev_priv) { … } void vmw_goal_waiter_add(struct vmw_private *dev_priv) { … } void vmw_goal_waiter_remove(struct vmw_private *dev_priv) { … } static void vmw_irq_preinstall(struct drm_device *dev) { … } void vmw_irq_uninstall(struct drm_device *dev) { … } /** * vmw_irq_install - Install the irq handlers * * @dev_priv: Pointer to the vmw_private device. * Return: Zero if successful. Negative number otherwise. */ int vmw_irq_install(struct vmw_private *dev_priv) { … }