1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 /** 23 * Mali structures define to support arbitration feature 24 */ 25 26 #ifndef _MALI_KBASE_ARBITER_DEFS_H_ 27 #define _MALI_KBASE_ARBITER_DEFS_H_ 28 29 #include "mali_kbase_arbiter_pm.h" 30 31 /** 32 * struct kbase_arbiter_vm_state - Struct representing the state and containing the 33 * data of pm work 34 * @kbdev: Pointer to kbase device structure (must be a valid pointer) 35 * @vm_state_lock: The lock protecting the VM state when arbiter is used. 36 * This lock must also be held whenever the VM state is being 37 * transitioned 38 * @vm_state_wait: Wait queue set when GPU is granted 39 * @vm_state: Current state of VM 40 * @vm_arb_wq: Work queue for resuming or stopping work on the GPU for use 41 * with the Arbiter 42 * @vm_suspend_work: Work item for vm_arb_wq to stop current work on GPU 43 * @vm_resume_work: Work item for vm_arb_wq to resume current work on GPU 44 * @vm_arb_starting: Work queue resume in progress 45 * @vm_arb_stopping: Work queue suspend in progress 46 * @interrupts_installed: Flag set when interrupts are installed 47 * @vm_request_timer: Timer to monitor GPU request 48 */ 49 struct kbase_arbiter_vm_state { 50 struct kbase_device *kbdev; 51 struct mutex vm_state_lock; 52 wait_queue_head_t vm_state_wait; 53 enum kbase_vm_state vm_state; 54 struct workqueue_struct *vm_arb_wq; 55 struct work_struct vm_suspend_work; 56 struct work_struct vm_resume_work; 57 bool vm_arb_starting; 58 bool vm_arb_stopping; 59 bool interrupts_installed; 60 struct hrtimer vm_request_timer; 61 }; 62 63 /** 64 * struct kbase_arbiter_device - Representing an instance of arbiter device, 65 * allocated from the probe method of Mali driver 66 * @arb_if: Pointer to the arbiter interface device 67 * @arb_dev: Pointer to the arbiter device 68 * @arb_freq: GPU clock frequency retrieved from arbiter. 69 */ 70 struct kbase_arbiter_device { 71 struct arbiter_if_dev *arb_if; 72 struct device *arb_dev; 73 struct kbase_arbiter_freq arb_freq; 74 }; 75 76 #endif /* _MALI_KBASE_ARBITER_DEFS_H_ */ 77