xref: /OK3568_Linux_fs/kernel/include/uapi/gpu/arm/bifrost/mali_kbase_kinstr_jm_reader.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 /*
23  * mali_kbase_kinstr_jm_reader.h
24  * Provides an ioctl API to read kernel atom state changes. The flow of the
25  * API is:
26  *    1. Obtain the file descriptor with ``KBASE_IOCTL_KINSTR_JM_FD``
27  *    2. Determine the buffer structure layout via the above ioctl's returned
28  *       size and version fields in ``struct kbase_kinstr_jm_fd_out``
29  *    4. Poll the file descriptor for ``POLLIN``
30  *    5. Get data with read() on the fd
31  *    6. Use the structure version to understand how to read the data from the
32  *       buffer
33  *    7. Repeat 4-6
34  *    8. Close the file descriptor
35  */
36 
37 #ifndef _UAPI_KBASE_KINSTR_JM_READER_H_
38 #define _UAPI_KBASE_KINSTR_JM_READER_H_
39 
40 /**
41  * enum kbase_kinstr_jm_reader_atom_state - Determines the work state of an atom
42  * @KBASE_KINSTR_JM_READER_ATOM_STATE_QUEUE:    Signifies that an atom has
43  *                                              entered a hardware queue
44  * @KBASE_KINSTR_JM_READER_ATOM_STATE_START:    Signifies that work has started
45  *                                              on an atom
46  * @KBASE_KINSTR_JM_READER_ATOM_STATE_STOP:     Signifies that work has stopped
47  *                                              on an atom
48  * @KBASE_KINSTR_JM_READER_ATOM_STATE_COMPLETE: Signifies that work has
49  *                                              completed on an atom
50  * @KBASE_KINSTR_JM_READER_ATOM_STATE_COUNT:    The number of state enumerations
51  *
52  * We can add new states to the end of this if they do not break the existing
53  * state machine. Old user mode code can gracefully ignore states they do not
54  * understand.
55  *
56  * If we need to make a breaking change to the state machine, we can do that by
57  * changing the version reported by KBASE_IOCTL_KINSTR_JM_FD. This will
58  * mean that old user mode code will fail to understand the new state field in
59  * the structure and gracefully not use the state change API.
60  */
61 enum kbase_kinstr_jm_reader_atom_state {
62 	KBASE_KINSTR_JM_READER_ATOM_STATE_QUEUE,
63 	KBASE_KINSTR_JM_READER_ATOM_STATE_START,
64 	KBASE_KINSTR_JM_READER_ATOM_STATE_STOP,
65 	KBASE_KINSTR_JM_READER_ATOM_STATE_COMPLETE,
66 	KBASE_KINSTR_JM_READER_ATOM_STATE_COUNT
67 };
68 
69 #endif /* _UAPI_KBASE_KINSTR_JM_READER_H_ */
70