MALI: rockchip: linux: upgrade to DDK r13p0-00rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard_for_linux / mali_kbase_debug_job_fault.h
1 /*
2  *
3  * (C) COPYRIGHT 2012-2016 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 #ifndef _KBASE_DEBUG_JOB_FAULT_H
19 #define _KBASE_DEBUG_JOB_FAULT_H
20
21 #include <linux/debugfs.h>
22 #include <linux/seq_file.h>
23
24 #define REGISTER_DUMP_TERMINATION_FLAG 0xFFFFFFFF
25
26 /**
27  * kbase_debug_job_fault_dev_init - Create the fault event wait queue
28  *              per device and initialize the required lists.
29  * @kbdev:      Device pointer
30  *
31  * Return: Zero on success or a negative error code.
32  */
33 int kbase_debug_job_fault_dev_init(struct kbase_device *kbdev);
34
35 /**
36  * kbase_debug_job_fault_debugfs_init - Initialize job fault debug sysfs
37  * @kbdev:      Device pointer
38  */
39 void kbase_debug_job_fault_debugfs_init(struct kbase_device *kbdev);
40
41 /**
42  * kbase_debug_job_fault_dev_term - Clean up resources created in
43  *              kbase_debug_job_fault_dev_init.
44  * @kbdev:      Device pointer
45  */
46 void kbase_debug_job_fault_dev_term(struct kbase_device *kbdev);
47
48 /**
49  * kbase_debug_job_fault_context_init - Initialize the relevant
50  *              data structure per context
51  * @kctx: KBase context pointer
52  */
53 void kbase_debug_job_fault_context_init(struct kbase_context *kctx);
54
55 /**
56  * kbase_debug_job_fault_context_term - Release the relevant
57  *              resource per context
58  * @kctx: KBase context pointer
59  */
60 void kbase_debug_job_fault_context_term(struct kbase_context *kctx);
61
62 /**
63  * kbase_debug_job_fault_process - Process the failed job.
64  *      It will send a event and wake up the job fault waiting queue
65  *      Then create a work queue to wait for job dump finish
66  *      This function should be called in the interrupt handler and before
67  *      jd_done that make sure the jd_done_worker will be delayed until the
68  *      job dump finish
69  * @katom: The failed atom pointer
70  * @completion_code: the job status
71  * @return true if dump is going on
72  */
73 bool kbase_debug_job_fault_process(struct kbase_jd_atom *katom,
74                 u32 completion_code);
75
76
77 /**
78  * kbase_debug_job_fault_reg_snapshot_init - Set the interested registers
79  *      address during the job fault process, the relevant registers will
80  *      be saved when a job fault happen
81  * @kctx: KBase context pointer
82  * @reg_range: Maximum register address space
83  * @return true if initializing successfully
84  */
85 bool kbase_debug_job_fault_reg_snapshot_init(struct kbase_context *kctx,
86                 int reg_range);
87
88 /**
89  * kbase_job_fault_get_reg_snapshot - Read the interested registers for
90  *      failed job dump
91  * @kctx: KBase context pointer
92  * @return true if getting registers successfully
93  */
94 bool kbase_job_fault_get_reg_snapshot(struct kbase_context *kctx);
95
96 #endif  /*_KBASE_DEBUG_JOB_FAULT_H*/