diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 69 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 1 |
3 files changed, 71 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index 4a175a3c..1c351d9e 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |||
@@ -91,6 +91,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, | |||
91 | dbg_session->g = g; | 91 | dbg_session->g = g; |
92 | dbg_session->is_profiler = is_profiler; | 92 | dbg_session->is_profiler = is_profiler; |
93 | dbg_session->is_pg_disabled = false; | 93 | dbg_session->is_pg_disabled = false; |
94 | dbg_session->is_timeout_disabled = false; | ||
94 | /* For vgpu, all power-gating features are currently disabled | 95 | /* For vgpu, all power-gating features are currently disabled |
95 | * in the server. Set is_pg_disable to true to reflect this | 96 | * in the server. Set is_pg_disable to true to reflect this |
96 | * on the client side. */ | 97 | * on the client side. */ |
@@ -264,6 +265,46 @@ void gk20a_dbg_gpu_post_events(struct channel_gk20a *ch) | |||
264 | static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, | 265 | static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s, |
265 | __u32 powermode); | 266 | __u32 powermode); |
266 | 267 | ||
268 | static int nvgpu_dbg_timeout_enable(struct dbg_session_gk20a *dbg_s, | ||
269 | int timeout_mode) | ||
270 | { | ||
271 | struct gk20a *g = dbg_s->g; | ||
272 | int err = 0; | ||
273 | |||
274 | gk20a_dbg(gpu_dbg_gpu_dbg, "Timeouts mode requested : %d", | ||
275 | timeout_mode); | ||
276 | |||
277 | switch (timeout_mode) { | ||
278 | case NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE: | ||
279 | if (dbg_s->is_timeout_disabled && | ||
280 | --g->dbg_timeout_disabled_refcount == 0) { | ||
281 | g->timeouts_enabled = true; | ||
282 | } | ||
283 | dbg_s->is_timeout_disabled = false; | ||
284 | break; | ||
285 | |||
286 | case NVGPU_DBG_GPU_IOCTL_TIMEOUT_DISABLE: | ||
287 | if ((dbg_s->is_timeout_disabled == false) && | ||
288 | (g->dbg_timeout_disabled_refcount++ == 0)) { | ||
289 | g->timeouts_enabled = false; | ||
290 | } | ||
291 | dbg_s->is_timeout_disabled = true; | ||
292 | break; | ||
293 | |||
294 | default: | ||
295 | gk20a_err(dev_from_gk20a(g), | ||
296 | "unrecognized dbg gpu timeout mode : 0x%x", | ||
297 | timeout_mode); | ||
298 | err = -EINVAL; | ||
299 | break; | ||
300 | } | ||
301 | |||
302 | gk20a_dbg(gpu_dbg_gpu_dbg, "Timeouts enabled : %s", | ||
303 | g->timeouts_enabled ? "Yes" : "No"); | ||
304 | |||
305 | return err; | ||
306 | } | ||
307 | |||
267 | static int dbg_unbind_channel_gk20a(struct dbg_session_gk20a *dbg_s) | 308 | static int dbg_unbind_channel_gk20a(struct dbg_session_gk20a *dbg_s) |
268 | { | 309 | { |
269 | struct channel_gk20a *ch_gk20a = dbg_s->ch; | 310 | struct channel_gk20a *ch_gk20a = dbg_s->ch; |
@@ -305,12 +346,13 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp) | |||
305 | if (dbg_s->ch) | 346 | if (dbg_s->ch) |
306 | dbg_unbind_channel_gk20a(dbg_s); | 347 | dbg_unbind_channel_gk20a(dbg_s); |
307 | 348 | ||
308 | /* Powergate enable is called here as possibility of dbg_session | 349 | /* Powergate/Timeout enable is called here as possibility of dbg_session |
309 | * which called powergate disable ioctl, to be killed without calling | 350 | * which called powergate/timeout disable ioctl, to be killed without |
310 | * powergate enable ioctl | 351 | * calling powergate/timeout enable ioctl |
311 | */ | 352 | */ |
312 | mutex_lock(&g->dbg_sessions_lock); | 353 | mutex_lock(&g->dbg_sessions_lock); |
313 | dbg_set_powergate(dbg_s, NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); | 354 | dbg_set_powergate(dbg_s, NVGPU_DBG_GPU_POWERGATE_MODE_ENABLE); |
355 | nvgpu_dbg_timeout_enable(dbg_s, NVGPU_DBG_GPU_IOCTL_TIMEOUT_ENABLE); | ||
314 | mutex_unlock(&g->dbg_sessions_lock); | 356 | mutex_unlock(&g->dbg_sessions_lock); |
315 | 357 | ||
316 | kfree(dbg_s); | 358 | kfree(dbg_s); |
@@ -391,6 +433,22 @@ static int gk20a_dbg_pc_sampling(struct dbg_session_gk20a *dbg_s, | |||
391 | return g->ops.gr.update_pc_sampling ? | 433 | return g->ops.gr.update_pc_sampling ? |
392 | g->ops.gr.update_pc_sampling(ch, args->enable) : -EINVAL; | 434 | g->ops.gr.update_pc_sampling(ch, args->enable) : -EINVAL; |
393 | } | 435 | } |
436 | |||
437 | static int nvgpu_dbg_gpu_ioctl_timeout(struct dbg_session_gk20a *dbg_s, | ||
438 | struct nvgpu_dbg_gpu_timeout_args *args) | ||
439 | { | ||
440 | int err; | ||
441 | struct gk20a *g = get_gk20a(dbg_s->pdev); | ||
442 | |||
443 | gk20a_dbg_fn("powergate mode = %d", args->enable); | ||
444 | |||
445 | mutex_lock(&g->dbg_sessions_lock); | ||
446 | err = nvgpu_dbg_timeout_enable(dbg_s, args->enable); | ||
447 | mutex_unlock(&g->dbg_sessions_lock); | ||
448 | |||
449 | return err; | ||
450 | } | ||
451 | |||
394 | long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, | 452 | long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, |
395 | unsigned long arg) | 453 | unsigned long arg) |
396 | { | 454 | { |
@@ -468,6 +526,11 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, | |||
468 | (struct nvgpu_dbg_gpu_pc_sampling_args *)buf); | 526 | (struct nvgpu_dbg_gpu_pc_sampling_args *)buf); |
469 | break; | 527 | break; |
470 | 528 | ||
529 | case NVGPU_DBG_GPU_IOCTL_TIMEOUT: | ||
530 | err = nvgpu_dbg_gpu_ioctl_timeout(dbg_s, | ||
531 | (struct nvgpu_dbg_gpu_timeout_args *)buf); | ||
532 | break; | ||
533 | |||
471 | default: | 534 | default: |
472 | gk20a_err(dev_from_gk20a(g), | 535 | gk20a_err(dev_from_gk20a(g), |
473 | "unrecognized dbg gpu ioctl cmd: 0x%x", | 536 | "unrecognized dbg gpu ioctl cmd: 0x%x", |
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h index 27084c0d..fc1f2982 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger Driver | 2 | * Tegra GK20A GPU Debugger Driver |
3 | * | 3 | * |
4 | * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2013-2015, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -53,6 +53,9 @@ struct dbg_session_gk20a { | |||
53 | /* power enabled or disabled */ | 53 | /* power enabled or disabled */ |
54 | bool is_pg_disabled; | 54 | bool is_pg_disabled; |
55 | 55 | ||
56 | /* timeouts enabled or disabled */ | ||
57 | bool is_timeout_disabled; | ||
58 | |||
56 | /* | 59 | /* |
57 | * There can be different versions of the whitelists | 60 | * There can be different versions of the whitelists |
58 | * between both global and per-context sets; as well | 61 | * between both global and per-context sets; as well |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 328bb73b..e106c479 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -532,6 +532,7 @@ struct gk20a { | |||
532 | struct mutex dbg_sessions_lock; | 532 | struct mutex dbg_sessions_lock; |
533 | int dbg_sessions; /* number attached */ | 533 | int dbg_sessions; /* number attached */ |
534 | int dbg_powergating_disabled_refcount; /*refcount for pg disable */ | 534 | int dbg_powergating_disabled_refcount; /*refcount for pg disable */ |
535 | int dbg_timeout_disabled_refcount; /*refcount for timeout disable */ | ||
535 | 536 | ||
536 | void (*remove_support)(struct platform_device *); | 537 | void (*remove_support)(struct platform_device *); |
537 | 538 | ||