3 * (C) COPYRIGHT 2012-2015 ARM Limited. All rights reserved.
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
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.
18 #ifndef _KBASE_DEBUG_JOB_FAULT_H
19 #define _KBASE_DEBUG_JOB_FAULT_H
21 #include <mali_kbase.h>
22 #include <linux/debugfs.h>
23 #include <linux/seq_file.h>
25 #define REGISTER_DUMP_TERMINATION_FLAG 0xFFFFFFFF
28 * kbase_debug_job_fault_dev_init - Create the fault event wait queue
29 * per device and initialize the required lists.
30 * @kbdev: Device pointer
32 * Return: Zero on success or a negative error code.
34 int kbase_debug_job_fault_dev_init(struct kbase_device *kbdev);
37 * kbase_debug_job_fault_debugfs_init - Initialize job fault debug sysfs
38 * @kbdev: Device pointer
40 void kbase_debug_job_fault_debugfs_init(struct kbase_device *kbdev);
43 * kbase_debug_job_fault_dev_term - Clean up resources created in
44 * kbase_debug_job_fault_dev_init.
45 * @kbdev: Device pointer
47 void kbase_debug_job_fault_dev_term(struct kbase_device *kbdev);
50 * kbase_debug_job_fault_context_init - Initialize the relevant
51 * data structure per context
52 * @kctx: KBase context pointer
54 void kbase_debug_job_fault_context_init(struct kbase_context *kctx);
57 * kbase_debug_job_fault_context_term - Release the relevant
58 * resource per context
59 * @kctx: KBase context pointer
61 void kbase_debug_job_fault_context_term(struct kbase_context *kctx);
64 * kbase_debug_job_fault_process - Process the failed job.
65 * It will send a event and wake up the job fault waiting queue
66 * Then create a work queue to wait for job dump finish
67 * This function should be called in the interrupt handler and before
68 * jd_done that make sure the jd_done_worker will be delayed until the
70 * @katom: The failed atom pointer
71 * @completion_code: the job status
72 * @return true if dump is going on
74 bool kbase_debug_job_fault_process(struct kbase_jd_atom *katom,
79 * kbase_debug_job_fault_reg_snapshot_init - Set the interested registers
80 * address during the job fault process, the relevant registers will
81 * be saved when a job fault happen
82 * @kctx: KBase context pointer
83 * @reg_range: Maximum register address space
84 * @return true if initializing successfully
86 bool kbase_debug_job_fault_reg_snapshot_init(struct kbase_context *kctx,
90 * kbase_job_fault_get_reg_snapshot - Read the interested registers for
92 * @kctx: KBase context pointer
93 * @return true if getting registers successfully
95 bool kbase_job_fault_get_reg_snapshot(struct kbase_context *kctx);
97 #endif /*_KBASE_DEBUG_JOB_FAULT_H*/