summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-06-20 15:18:47 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-21 20:34:49 -0400
commit92c43deefca150854193c6720717d56b61989c23 (patch)
tree2dbfdcdb3a0809b80d4fc50e1d882326e54c7d17 /drivers/gpu/nvgpu/gk20a
parent2ffbdc50d884215ba043e8afd3c3bcbefd1e66f8 (diff)
gpu: nvgpu: Remove Linux devnode fields from gk20a
Move Linux devnode related fields to a new header file os_linux.h. The class structure is defined in module.c, so move its declaration to module.h. JIRA NVGPU-38 Change-Id: I5d8920169064f4289ff61004f7f81543a9aba221 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1505927 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c6
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c12
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h47
-rw-r--r--drivers/gpu/nvgpu/gk20a/sched_gk20a.c8
4 files changed, 16 insertions, 57 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
index ceee1ae9..c189a00c 100644
--- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
@@ -25,6 +25,7 @@
25#include "gk20a.h" 25#include "gk20a.h"
26#include "platform_gk20a.h" 26#include "platform_gk20a.h"
27#include "gr_gk20a.h" 27#include "gr_gk20a.h"
28#include "common/linux/os_linux.h"
28 29
29#include <nvgpu/log.h> 30#include <nvgpu/log.h>
30#include <nvgpu/atomic.h> 31#include <nvgpu/atomic.h>
@@ -266,6 +267,7 @@ static int gk20a_ctxsw_dev_ioctl_poll(struct gk20a_ctxsw_dev *dev)
266 267
267int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp) 268int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp)
268{ 269{
270 struct nvgpu_os_linux *l;
269 struct gk20a *g; 271 struct gk20a *g;
270 struct gk20a_ctxsw_trace *trace; 272 struct gk20a_ctxsw_trace *trace;
271 struct gk20a_ctxsw_dev *dev; 273 struct gk20a_ctxsw_dev *dev;
@@ -276,8 +278,8 @@ int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp)
276 /* only one VM for now */ 278 /* only one VM for now */
277 const int vmid = 0; 279 const int vmid = 0;
278 280
279 g = container_of(inode->i_cdev, struct gk20a, ctxsw.cdev); 281 l = container_of(inode->i_cdev, struct nvgpu_os_linux, ctxsw.cdev);
280 g = gk20a_get(g); 282 g = gk20a_get(&l->g);
281 if (!g) 283 if (!g)
282 return -ENODEV; 284 return -ENODEV;
283 285
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 77890da8..84edacbb 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -32,6 +32,7 @@
32#include "gr_gk20a.h" 32#include "gr_gk20a.h"
33#include "dbg_gpu_gk20a.h" 33#include "dbg_gpu_gk20a.h"
34#include "regops_gk20a.h" 34#include "regops_gk20a.h"
35#include "common/linux/os_linux.h"
35 36
36#include <nvgpu/hw/gk20a/hw_therm_gk20a.h> 37#include <nvgpu/hw/gk20a/hw_therm_gk20a.h>
37#include <nvgpu/hw/gk20a/hw_gr_gk20a.h> 38#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
@@ -115,6 +116,7 @@ static int alloc_profiler(struct gk20a *g,
115static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, 116static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
116 struct file *filp, bool is_profiler) 117 struct file *filp, bool is_profiler)
117{ 118{
119 struct nvgpu_os_linux *l;
118 struct dbg_session_gk20a *dbg_session; 120 struct dbg_session_gk20a *dbg_session;
119 struct gk20a *g; 121 struct gk20a *g;
120 122
@@ -123,12 +125,12 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
123 int err; 125 int err;
124 126
125 if (!is_profiler) 127 if (!is_profiler)
126 g = container_of(inode->i_cdev, 128 l = container_of(inode->i_cdev,
127 struct gk20a, dbg.cdev); 129 struct nvgpu_os_linux, dbg.cdev);
128 else 130 else
129 g = container_of(inode->i_cdev, 131 l = container_of(inode->i_cdev,
130 struct gk20a, prof.cdev); 132 struct nvgpu_os_linux, prof.cdev);
131 g = gk20a_get(g); 133 g = gk20a_get(&l->g);
132 if (!g) 134 if (!g)
133 return -ENODEV; 135 return -ENODEV;
134 136
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 5acc1074..cda70249 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -37,7 +37,6 @@ struct nvgpu_cpu_time_correlation_sample;
37 37
38#include <nvgpu/lock.h> 38#include <nvgpu/lock.h>
39#include <nvgpu/thread.h> 39#include <nvgpu/thread.h>
40#include <linux/cdev.h>
41#ifdef CONFIG_DEBUG_FS 40#ifdef CONFIG_DEBUG_FS
42#include <linux/debugfs.h> 41#include <linux/debugfs.h>
43#endif 42#endif
@@ -1157,53 +1156,11 @@ struct gk20a {
1157 1156
1158 struct nvgpu_gpu_characteristics gpu_characteristics; 1157 struct nvgpu_gpu_characteristics gpu_characteristics;
1159 1158
1160 struct {
1161 struct cdev cdev;
1162 struct device *node;
1163 } channel;
1164
1165 struct gk20a_as as; 1159 struct gk20a_as as;
1166 1160
1167 struct {
1168 struct cdev cdev;
1169 struct device *node;
1170 } ctrl;
1171
1172 struct {
1173 struct cdev cdev;
1174 struct device *node;
1175 } as_dev;
1176
1177 struct {
1178 struct cdev cdev;
1179 struct device *node;
1180 } dbg;
1181
1182 struct {
1183 struct cdev cdev;
1184 struct device *node;
1185 } prof;
1186
1187 struct {
1188 struct cdev cdev;
1189 struct device *node;
1190 } tsg;
1191
1192 struct {
1193 struct cdev cdev;
1194 struct device *node;
1195 } ctxsw;
1196
1197 struct {
1198 struct cdev cdev;
1199 struct device *node;
1200 } sched;
1201
1202 struct nvgpu_mutex client_lock; 1161 struct nvgpu_mutex client_lock;
1203 int client_refcount; /* open channels and ctrl nodes */ 1162 int client_refcount; /* open channels and ctrl nodes */
1204 1163
1205 dev_t cdev_region;
1206
1207 struct gpu_ops ops; 1164 struct gpu_ops ops;
1208 1165
1209 int irqs_enabled; 1166 int irqs_enabled;
@@ -1518,10 +1475,6 @@ static inline u32 scale_ptimer(u32 timeout , u32 scale10x)
1518 return (timeout * 10) / scale10x; 1475 return (timeout * 10) / scale10x;
1519} 1476}
1520 1477
1521extern struct class nvgpu_class;
1522
1523#define INTERFACE_NAME "nvhost%s-gpu"
1524
1525int gk20a_prepare_poweroff(struct gk20a *g); 1478int gk20a_prepare_poweroff(struct gk20a *g);
1526int gk20a_finalize_poweron(struct gk20a *g); 1479int gk20a_finalize_poweron(struct gk20a *g);
1527 1480
diff --git a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c b/drivers/gpu/nvgpu/gk20a/sched_gk20a.c
index 3f3119af..014848ba 100644
--- a/drivers/gpu/nvgpu/gk20a/sched_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/sched_gk20a.c
@@ -25,6 +25,7 @@
25#include "gk20a.h" 25#include "gk20a.h"
26#include "gr_gk20a.h" 26#include "gr_gk20a.h"
27#include "sched_gk20a.h" 27#include "sched_gk20a.h"
28#include "common/linux/os_linux.h"
28 29
29#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> 30#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h>
30#include <nvgpu/hw/gk20a/hw_gr_gk20a.h> 31#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
@@ -370,12 +371,13 @@ static int gk20a_sched_dev_ioctl_put_tsg(struct gk20a_sched_ctrl *sched,
370 371
371int gk20a_sched_dev_open(struct inode *inode, struct file *filp) 372int gk20a_sched_dev_open(struct inode *inode, struct file *filp)
372{ 373{
373 struct gk20a *g = container_of(inode->i_cdev, 374 struct nvgpu_os_linux *l = container_of(inode->i_cdev,
374 struct gk20a, sched.cdev); 375 struct nvgpu_os_linux, sched.cdev);
376 struct gk20a *g;
375 struct gk20a_sched_ctrl *sched; 377 struct gk20a_sched_ctrl *sched;
376 int err = 0; 378 int err = 0;
377 379
378 g = gk20a_get(g); 380 g = gk20a_get(&l->g);
379 if (!g) 381 if (!g)
380 return -ENODEV; 382 return -ENODEV;
381 sched = &g->sched_ctrl; 383 sched = &g->sched_ctrl;