102d94be93d1e1cb89bc7ca3df28b142110ee954
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / backend / gpu / mali_kbase_jm_rb.h
1 /*
2  *
3  * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15
16
17
18
19 /*
20  * Register-based HW access backend specific APIs
21  */
22
23 #ifndef _KBASE_HWACCESS_GPU_H_
24 #define _KBASE_HWACCESS_GPU_H_
25
26 #include <backend/gpu/mali_kbase_pm_internal.h>
27
28 /**
29  * kbase_gpu_irq_evict - Evict an atom from a NEXT slot
30  *
31  * @kbdev:         Device pointer
32  * @js:            Job slot to evict from
33  *
34  * Evict the atom in the NEXT slot for the specified job slot. This function is
35  * called from the job complete IRQ handler when the previous job has failed.
36  *
37  * Return: true if job evicted from NEXT registers, false otherwise
38  */
39 bool kbase_gpu_irq_evict(struct kbase_device *kbdev, int js);
40
41 /**
42  * kbase_gpu_complete_hw - Complete an atom on job slot js
43  *
44  * @kbdev:           Device pointer
45  * @js:              Job slot that has completed
46  * @completion_code: Event code from job that has completed
47  * @job_tail:        The tail address from the hardware if the job has partially
48  *                   completed
49  * @end_timestamp:   Time of completion
50  */
51 void kbase_gpu_complete_hw(struct kbase_device *kbdev, int js,
52                                 u32 completion_code,
53                                 u64 job_tail,
54                                 ktime_t *end_timestamp);
55
56 /**
57  * kbase_gpu_inspect - Inspect the contents of the HW access ringbuffer
58  *
59  * @kbdev:  Device pointer
60  * @js:     Job slot to inspect
61  * @idx:    Index into ringbuffer. 0 is the job currently running on
62  *          the slot, 1 is the job waiting, all other values are invalid.
63  * Return:  The atom at that position in the ringbuffer
64  *          or NULL if no atom present
65  */
66 struct kbase_jd_atom *kbase_gpu_inspect(struct kbase_device *kbdev, int js,
67                                         int idx);
68
69 /**
70  * kbase_gpu_slot_update - Update state based on slot ringbuffers
71  *
72  * @kbdev:  Device pointer
73  *
74  * Inspect the jobs in the slot ringbuffers and update state.
75  *
76  * This will cause jobs to be submitted to hardware if they are unblocked
77  */
78 void kbase_gpu_slot_update(struct kbase_device *kbdev);
79
80 /**
81  * kbase_gpu_dump_slots - Print the contents of the slot ringbuffers
82  *
83  * @kbdev:  Device pointer
84  */
85 void kbase_gpu_dump_slots(struct kbase_device *kbdev);
86
87 #endif /* _KBASE_HWACCESS_GPU_H_ */