summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h')
-rw-r--r--drivers/gpu/nvgpu/common/linux/clk_arb_linux.h163
1 files changed, 0 insertions, 163 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h
deleted file mode 100644
index 464590d5..00000000
--- a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __NVGPU_CLK_ARB_LINUX_H__
18#define __NVGPU_CLK_ARB_LINUX_H__
19
20#include <nvgpu/types.h>
21#include <nvgpu/bitops.h>
22#include <nvgpu/lock.h>
23#include <nvgpu/kmem.h>
24#include <nvgpu/atomic.h>
25#include <nvgpu/bug.h>
26#include <nvgpu/kref.h>
27#include <nvgpu/log.h>
28#include <nvgpu/barrier.h>
29#include <nvgpu/cond.h>
30#include <nvgpu/list.h>
31
32#include "gk20a/gk20a.h"
33#include "clk/clk.h"
34#include "pstate/pstate.h"
35#include "lpwr/lpwr.h"
36#include "volt/volt.h"
37
38/*
39 * The defines here should finally move to clk_arb.h, once these are
40 * refactored to be free of Linux fields.
41 */
42
43enum clk_arb_work_item_type {
44 CLK_ARB_WORK_UPDATE_VF_TABLE,
45 CLK_ARB_WORK_UPDATE_ARB
46};
47
48struct nvgpu_clk_arb_work_item {
49 enum clk_arb_work_item_type item_type;
50 struct nvgpu_clk_arb *arb;
51 struct nvgpu_list_node worker_item;
52};
53
54struct nvgpu_clk_arb {
55 struct nvgpu_spinlock sessions_lock;
56 struct nvgpu_spinlock users_lock;
57 struct nvgpu_spinlock requests_lock;
58
59 struct nvgpu_mutex pstate_lock;
60 struct nvgpu_list_node users;
61 struct nvgpu_list_node sessions;
62 struct nvgpu_list_node requests;
63
64 struct gk20a *g;
65 int status;
66
67 struct nvgpu_clk_arb_target actual_pool[2];
68 struct nvgpu_clk_arb_target *actual;
69
70 u16 gpc2clk_default_mhz;
71 u16 mclk_default_mhz;
72 u32 voltuv_actual;
73
74 u16 gpc2clk_min, gpc2clk_max;
75 u16 mclk_min, mclk_max;
76
77 struct nvgpu_clk_arb_work_item update_vf_table_work_item;
78 struct nvgpu_clk_arb_work_item update_arb_work_item;
79
80 struct nvgpu_cond request_wq;
81
82 struct nvgpu_clk_vf_table *current_vf_table;
83 struct nvgpu_clk_vf_table vf_table_pool[2];
84 u32 vf_table_index;
85
86 u16 *mclk_f_points;
87 nvgpu_atomic_t req_nr;
88
89 u32 mclk_f_numpoints;
90 u16 *gpc2clk_f_points;
91 u32 gpc2clk_f_numpoints;
92
93 nvgpu_atomic64_t alarm_mask;
94 struct nvgpu_clk_notification_queue notification_queue;
95
96#ifdef CONFIG_DEBUG_FS
97 struct nvgpu_clk_arb_debug debug_pool[2];
98 struct nvgpu_clk_arb_debug *debug;
99 bool debugfs_set;
100#endif
101};
102
103struct nvgpu_clk_dev {
104 struct nvgpu_clk_session *session;
105 union {
106 struct nvgpu_list_node link;
107 struct nvgpu_list_node node;
108 };
109 struct nvgpu_cond readout_wq;
110 nvgpu_atomic_t poll_mask;
111 u16 gpc2clk_target_mhz;
112 u16 mclk_target_mhz;
113 u32 alarms_reported;
114 nvgpu_atomic_t enabled_mask;
115 struct nvgpu_clk_notification_queue queue;
116 u32 arb_queue_head;
117 struct nvgpu_ref refcount;
118};
119
120struct nvgpu_clk_session {
121 bool zombie;
122 struct gk20a *g;
123 struct nvgpu_ref refcount;
124 struct nvgpu_list_node link;
125 struct nvgpu_list_node targets;
126
127 struct nvgpu_spinlock session_lock;
128 struct nvgpu_clk_arb_target target_pool[2];
129 struct nvgpu_clk_arb_target *target;
130};
131
132static inline struct nvgpu_clk_session *
133nvgpu_clk_session_from_link(struct nvgpu_list_node *node)
134{
135 return (struct nvgpu_clk_session *)
136 ((uintptr_t)node - offsetof(struct nvgpu_clk_session, link));
137};
138
139static inline struct nvgpu_clk_dev *
140nvgpu_clk_dev_from_node(struct nvgpu_list_node *node)
141{
142 return (struct nvgpu_clk_dev *)
143 ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, node));
144};
145
146static inline struct nvgpu_clk_dev *
147nvgpu_clk_dev_from_link(struct nvgpu_list_node *node)
148{
149 return (struct nvgpu_clk_dev *)
150 ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link));
151};
152
153static inline struct nvgpu_clk_arb_work_item *
154nvgpu_clk_arb_work_item_from_worker_item(struct nvgpu_list_node *node)
155{
156 return (struct nvgpu_clk_arb_work_item *)
157 ((uintptr_t)node - offsetof(struct nvgpu_clk_arb_work_item, worker_item));
158};
159
160void nvgpu_clk_arb_worker_enqueue(struct gk20a *g,
161 struct nvgpu_clk_arb_work_item *work_item);
162#endif /* __NVGPU_CLK_ARB_LINUX_H__ */
163