summaryrefslogtreecommitdiff
path: root/mali-midgard-16.0/mali_kbase_debug_job_fault.h
blob: a2bf8983c37c8eea76ad971c80d62605481b79e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 *
 * (C) COPYRIGHT 2012-2016 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU licence.
 *
 * A copy of the licence is included with the program, and can also be obtained
 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 */



#ifndef _KBASE_DEBUG_JOB_FAULT_H
#define _KBASE_DEBUG_JOB_FAULT_H

#include <linux/debugfs.h>
#include <linux/seq_file.h>

#define REGISTER_DUMP_TERMINATION_FLAG 0xFFFFFFFF

/**
 * kbase_debug_job_fault_dev_init - Create the fault event wait queue
 *		per device and initialize the required lists.
 * @kbdev:	Device pointer
 *
 * Return: Zero on success or a negative error code.
 */
int kbase_debug_job_fault_dev_init(struct kbase_device *kbdev);

/**
 * kbase_debug_job_fault_debugfs_init - Initialize job fault debug sysfs
 * @kbdev:	Device pointer
 */
void kbase_debug_job_fault_debugfs_init(struct kbase_device *kbdev);

/**
 * kbase_debug_job_fault_dev_term - Clean up resources created in
 *		kbase_debug_job_fault_dev_init.
 * @kbdev:	Device pointer
 */
void kbase_debug_job_fault_dev_term(struct kbase_device *kbdev);

/**
 * kbase_debug_job_fault_context_init - Initialize the relevant
 *		data structure per context
 * @kctx: KBase context pointer
 */
void kbase_debug_job_fault_context_init(struct kbase_context *kctx);

/**
 * kbase_debug_job_fault_context_term - Release the relevant
 *		resource per context
 * @kctx: KBase context pointer
 */
void kbase_debug_job_fault_context_term(struct kbase_context *kctx);

/**
 * kbase_debug_job_fault_process - Process the failed job.
 *      It will send a event and wake up the job fault waiting queue
 *      Then create a work queue to wait for job dump finish
 *      This function should be called in the interrupt handler and before
 *      jd_done that make sure the jd_done_worker will be delayed until the
 *      job dump finish
 * @katom: The failed atom pointer
 * @completion_code: the job status
 * @return true if dump is going on
 */
bool kbase_debug_job_fault_process(struct kbase_jd_atom *katom,
		u32 completion_code);


/**
 * kbase_debug_job_fault_reg_snapshot_init - Set the interested registers
 *      address during the job fault process, the relevant registers will
 *      be saved when a job fault happen
 * @kctx: KBase context pointer
 * @reg_range: Maximum register address space
 * @return true if initializing successfully
 */
bool kbase_debug_job_fault_reg_snapshot_init(struct kbase_context *kctx,
		int reg_range);

/**
 * kbase_job_fault_get_reg_snapshot - Read the interested registers for
 *      failed job dump
 * @kctx: KBase context pointer
 * @return true if getting registers successfully
 */
bool kbase_job_fault_get_reg_snapshot(struct kbase_context *kctx);

#endif  /*_KBASE_DEBUG_JOB_FAULT_H*/