drm/amdgpu/mes: add definitions of ip callback function
[sfrench/cifs-2.6.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_mes.h
1 /*
2  * Copyright 2019 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23
24 #ifndef __AMDGPU_MES_H__
25 #define __AMDGPU_MES_H__
26
27 struct amdgpu_mes_funcs;
28
29 struct amdgpu_mes {
30         struct amdgpu_adev *adev;
31
32         /* ip specific functions */
33         struct amdgpu_mes_funcs *funcs;
34 };
35
36 struct mes_add_queue_input {
37         uint32_t        process_id;
38         uint64_t        page_table_base_addr;
39         uint64_t        process_va_start;
40         uint64_t        process_va_end;
41         uint64_t        process_quantum;
42         uint64_t        process_context_addr;
43         uint64_t        gang_quantum;
44         uint64_t        gang_context_addr;
45         uint32_t        inprocess_gang_priority;
46         uint32_t        gang_global_priority_level;
47         uint32_t        doorbell_offset;
48         uint64_t        mqd_addr;
49         uint64_t        wptr_addr;
50         uint32_t        queue_type;
51         uint32_t        paging;
52 };
53
54 struct mes_remove_queue_input {
55         uint32_t        doorbell_offset;
56         uint64_t        gang_context_addr;
57 };
58
59 struct mes_suspend_gang_input {
60         bool            suspend_all_gangs;
61         uint64_t        gang_context_addr;
62         uint64_t        suspend_fence_addr;
63         uint32_t        suspend_fence_value;
64 };
65
66 struct mes_resume_gang_input {
67         bool            resume_all_gangs;
68         uint64_t        gang_context_addr;
69 };
70
71 struct amdgpu_mes_funcs {
72         int (*add_hw_queue)(struct amdgpu_mes *mes,
73                             struct mes_add_queue_input *input);
74
75         int (*remove_hw_queue)(struct amdgpu_mes *mes,
76                                struct mes_remove_queue_input *input);
77
78         int (*suspend_gang)(struct amdgpu_mes *mes,
79                             struct mes_suspend_gang_input *input);
80
81         int (*resume_gang)(struct amdgpu_mes *mes,
82                            struct mes_resume_gang_input *input);
83 };
84
85 #endif /* __AMDGPU_MES_H__ */