3 * (C) COPYRIGHT 2012-2016 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 <linux/debugfs.h>
22 #include <linux/seq_file.h>
24 #define REGISTER_DUMP_TERMINATION_FLAG 0xFFFFFFFF
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
31 * Return: Zero on success or a negative error code.
33 int kbase_debug_job_fault_dev_init(struct kbase_device *kbdev);
36 * kbase_debug_job_fault_debugfs_init - Initialize job fault debug sysfs
37 * @kbdev: Device pointer
39 void kbase_debug_job_fault_debugfs_init(struct kbase_device *kbdev);
42 * kbase_debug_job_fault_dev_term - Clean up resources created in
43 * kbase_debug_job_fault_dev_init.
44 * @kbdev: Device pointer
46 void kbase_debug_job_fault_dev_term(struct kbase_device *kbdev);
49 * kbase_debug_job_fault_context_init - Initialize the relevant
50 * data structure per context
51 * @kctx: KBase context pointer
53 void kbase_debug_job_fault_context_init(struct kbase_context *kctx);
56 * kbase_debug_job_fault_context_term - Release the relevant
57 * resource per context
58 * @kctx: KBase context pointer
60 void kbase_debug_job_fault_context_term(struct kbase_context *kctx);
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
69 * @katom: The failed atom pointer
70 * @completion_code: the job status
71 * @return true if dump is going on
73 bool kbase_debug_job_fault_process(struct kbase_jd_atom *katom,
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
85 bool kbase_debug_job_fault_reg_snapshot_init(struct kbase_context *kctx,
89 * kbase_job_fault_get_reg_snapshot - Read the interested registers for
91 * @kctx: KBase context pointer
92 * @return true if getting registers successfully
94 bool kbase_job_fault_get_reg_snapshot(struct kbase_context *kctx);
96 #endif /*_KBASE_DEBUG_JOB_FAULT_H*/