diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-04-14 18:12:57 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-14 03:05:12 -0400 |
commit | 7acc993cdbcc202854f188e7f53646f387573a09 (patch) | |
tree | 61d213424ed8985973fa7ee3e4580c7b1b95bd3b /drivers/gpu/nvgpu/gk20a | |
parent | ab22d66386e3a23e0dfe897bca25e01623f6d61c (diff) |
gpu: nvgpu: Move can_railgate & railgate_delay to gk20a
Copy can_railgate and railgate_delay to struct gk20a at probe time,
and access them from gk20a instead of platform_gk20a.
JIRA NVGPU-16
Change-Id: I63d4f4aff7eb17a167775fd7982a1b548bbca3a5
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1463543
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/channel_gk20a.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 30 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | 4 |
7 files changed, 29 insertions, 31 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 04765eea..0d615d65 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -2454,7 +2454,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
2454 | need_job_tracking = (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) || | 2454 | need_job_tracking = (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_WAIT) || |
2455 | (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) || | 2455 | (flags & NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET) || |
2456 | c->wdt_enabled || | 2456 | c->wdt_enabled || |
2457 | platform->can_railgate || | 2457 | g->can_railgate || |
2458 | !skip_buffer_refcounting; | 2458 | !skip_buffer_refcounting; |
2459 | 2459 | ||
2460 | if (need_job_tracking) { | 2460 | if (need_job_tracking) { |
@@ -2492,7 +2492,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
2492 | need_deferred_cleanup = !c->deterministic || | 2492 | need_deferred_cleanup = !c->deterministic || |
2493 | need_sync_framework || | 2493 | need_sync_framework || |
2494 | c->wdt_enabled || | 2494 | c->wdt_enabled || |
2495 | platform->can_railgate || | 2495 | g->can_railgate || |
2496 | !skip_buffer_refcounting; | 2496 | !skip_buffer_refcounting; |
2497 | 2497 | ||
2498 | /* | 2498 | /* |
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c index cd5c646f..f863b056 100644 --- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c | |||
@@ -285,8 +285,9 @@ int gk20a_railgating_debugfs_init(struct device *dev) | |||
285 | { | 285 | { |
286 | struct dentry *d; | 286 | struct dentry *d; |
287 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 287 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
288 | struct gk20a *g = get_gk20a(dev); | ||
288 | 289 | ||
289 | if (!platform->can_railgate) | 290 | if (!g->can_railgate) |
290 | return 0; | 291 | return 0; |
291 | 292 | ||
292 | d = debugfs_create_file( | 293 | d = debugfs_create_file( |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 7f110821..ea03ba98 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -397,15 +397,13 @@ void gk20a_driver_start_unload(struct gk20a *g) | |||
397 | int gk20a_wait_for_idle(struct device *dev) | 397 | int gk20a_wait_for_idle(struct device *dev) |
398 | { | 398 | { |
399 | struct gk20a *g = get_gk20a(dev); | 399 | struct gk20a *g = get_gk20a(dev); |
400 | struct gk20a_platform *platform; | ||
401 | int wait_length = 150; /* 3 second overall max wait. */ | 400 | int wait_length = 150; /* 3 second overall max wait. */ |
402 | int target_usage_count = 0; | 401 | int target_usage_count = 0; |
403 | 402 | ||
404 | if (!g) | 403 | if (!g) |
405 | return -ENODEV; | 404 | return -ENODEV; |
406 | 405 | ||
407 | platform = dev_get_drvdata(dev); | 406 | if (g->user_railgate_disabled) |
408 | if (platform->user_railgate_disabled) | ||
409 | target_usage_count = 1; | 407 | target_usage_count = 1; |
410 | 408 | ||
411 | while ((atomic_read(&g->usage_count) != target_usage_count) | 409 | while ((atomic_read(&g->usage_count) != target_usage_count) |
@@ -467,7 +465,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g) | |||
467 | * that depends on job tracking. (Here, fast means strictly no | 465 | * that depends on job tracking. (Here, fast means strictly no |
468 | * metadata, just the gpfifo contents are copied and gp_put updated). | 466 | * metadata, just the gpfifo contents are copied and gp_put updated). |
469 | */ | 467 | */ |
470 | if (!platform->can_railgate) | 468 | if (!g->can_railgate) |
471 | gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING; | 469 | gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING; |
472 | 470 | ||
473 | /* | 471 | /* |
@@ -476,7 +474,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g) | |||
476 | * provided that the user doesn't request anything that depends on | 474 | * provided that the user doesn't request anything that depends on |
477 | * deferred cleanup. | 475 | * deferred cleanup. |
478 | */ | 476 | */ |
479 | if (!platform->can_railgate | 477 | if (!g->can_railgate |
480 | && !gk20a_channel_sync_needs_sync_framework(g)) | 478 | && !gk20a_channel_sync_needs_sync_framework(g)) |
481 | gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_FULL; | 479 | gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_FULL; |
482 | 480 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 626ed2bd..6d1707a6 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -1023,6 +1023,10 @@ struct gk20a { | |||
1023 | 1023 | ||
1024 | u32 ptimer_src_freq; | 1024 | u32 ptimer_src_freq; |
1025 | 1025 | ||
1026 | bool can_railgate; | ||
1027 | bool user_railgate_disabled; | ||
1028 | int railgate_delay; | ||
1029 | |||
1026 | unsigned int aggressive_sync_destroy_thresh; | 1030 | unsigned int aggressive_sync_destroy_thresh; |
1027 | bool aggressive_sync_destroy; | 1031 | bool aggressive_sync_destroy; |
1028 | 1032 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 4d5854d4..783ff6fb 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -288,7 +288,6 @@ static DEVICE_ATTR(ptimer_src_freq, | |||
288 | static ssize_t railgate_enable_store(struct device *dev, | 288 | static ssize_t railgate_enable_store(struct device *dev, |
289 | struct device_attribute *attr, const char *buf, size_t count) | 289 | struct device_attribute *attr, const char *buf, size_t count) |
290 | { | 290 | { |
291 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
292 | unsigned long railgate_enable = 0; | 291 | unsigned long railgate_enable = 0; |
293 | /* dev is guaranteed to be valid here. Ok to de-reference */ | 292 | /* dev is guaranteed to be valid here. Ok to de-reference */ |
294 | struct gk20a *g = get_gk20a(dev); | 293 | struct gk20a *g = get_gk20a(dev); |
@@ -297,21 +296,21 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
297 | if (kstrtoul(buf, 10, &railgate_enable) < 0) | 296 | if (kstrtoul(buf, 10, &railgate_enable) < 0) |
298 | return -EINVAL; | 297 | return -EINVAL; |
299 | 298 | ||
300 | if (railgate_enable && !platform->can_railgate) { | 299 | if (railgate_enable && !g->can_railgate) { |
301 | /* release extra ref count */ | 300 | /* release extra ref count */ |
302 | gk20a_idle(g); | 301 | gk20a_idle(g); |
303 | platform->can_railgate = true; | 302 | g->can_railgate = true; |
304 | platform->user_railgate_disabled = false; | 303 | g->user_railgate_disabled = false; |
305 | } else if (railgate_enable == 0 && platform->can_railgate) { | 304 | } else if (railgate_enable == 0 && g->can_railgate) { |
306 | /* take extra ref count */ | 305 | /* take extra ref count */ |
307 | err = gk20a_busy(g); | 306 | err = gk20a_busy(g); |
308 | if (err) | 307 | if (err) |
309 | return err; | 308 | return err; |
310 | platform->can_railgate = false; | 309 | g->can_railgate = false; |
311 | platform->user_railgate_disabled = true; | 310 | g->user_railgate_disabled = true; |
312 | } | 311 | } |
313 | 312 | ||
314 | dev_info(dev, "railgate is %s.\n", platform->can_railgate ? | 313 | dev_info(dev, "railgate is %s.\n", g->can_railgate ? |
315 | "enabled" : "disabled"); | 314 | "enabled" : "disabled"); |
316 | 315 | ||
317 | return count; | 316 | return count; |
@@ -320,9 +319,9 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
320 | static ssize_t railgate_enable_read(struct device *dev, | 319 | static ssize_t railgate_enable_read(struct device *dev, |
321 | struct device_attribute *attr, char *buf) | 320 | struct device_attribute *attr, char *buf) |
322 | { | 321 | { |
323 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 322 | struct gk20a *g = get_gk20a(dev); |
324 | 323 | ||
325 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->can_railgate ? 1 : 0); | 324 | return snprintf(buf, PAGE_SIZE, "%d\n", g->can_railgate ? 1 : 0); |
326 | } | 325 | } |
327 | 326 | ||
328 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, | 327 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, |
@@ -333,20 +332,19 @@ static ssize_t railgate_delay_store(struct device *dev, | |||
333 | struct device_attribute *attr, | 332 | struct device_attribute *attr, |
334 | const char *buf, size_t count) | 333 | const char *buf, size_t count) |
335 | { | 334 | { |
336 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
337 | int railgate_delay = 0, ret = 0; | 335 | int railgate_delay = 0, ret = 0; |
338 | struct gk20a *g = get_gk20a(dev); | 336 | struct gk20a *g = get_gk20a(dev); |
339 | int err; | 337 | int err; |
340 | 338 | ||
341 | if (!platform->can_railgate) { | 339 | if (!g->can_railgate) { |
342 | dev_info(dev, "does not support power-gating\n"); | 340 | dev_info(dev, "does not support power-gating\n"); |
343 | return count; | 341 | return count; |
344 | } | 342 | } |
345 | 343 | ||
346 | ret = sscanf(buf, "%d", &railgate_delay); | 344 | ret = sscanf(buf, "%d", &railgate_delay); |
347 | if (ret == 1 && railgate_delay >= 0) { | 345 | if (ret == 1 && railgate_delay >= 0) { |
348 | platform->railgate_delay = railgate_delay; | 346 | g->railgate_delay = railgate_delay; |
349 | pm_runtime_set_autosuspend_delay(dev, platform->railgate_delay); | 347 | pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); |
350 | } else | 348 | } else |
351 | dev_err(dev, "Invalid powergate delay\n"); | 349 | dev_err(dev, "Invalid powergate delay\n"); |
352 | 350 | ||
@@ -361,9 +359,9 @@ static ssize_t railgate_delay_store(struct device *dev, | |||
361 | static ssize_t railgate_delay_show(struct device *dev, | 359 | static ssize_t railgate_delay_show(struct device *dev, |
362 | struct device_attribute *attr, char *buf) | 360 | struct device_attribute *attr, char *buf) |
363 | { | 361 | { |
364 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 362 | struct gk20a *g = get_gk20a(dev); |
365 | 363 | ||
366 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay); | 364 | return snprintf(buf, PAGE_SIZE, "%d\n", g->railgate_delay); |
367 | } | 365 | } |
368 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, | 366 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, |
369 | railgate_delay_store); | 367 | railgate_delay_store); |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 44277abf..2cbc1056 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -39,10 +39,7 @@ struct gk20a_platform { | |||
39 | struct gk20a *g; | 39 | struct gk20a *g; |
40 | 40 | ||
41 | /* Should be populated at probe. */ | 41 | /* Should be populated at probe. */ |
42 | bool can_railgate; | 42 | bool can_railgate_init; |
43 | |||
44 | /* Set by User while disabling railgating */ | ||
45 | bool user_railgate_disabled; | ||
46 | 43 | ||
47 | /* Should be populated at probe. */ | 44 | /* Should be populated at probe. */ |
48 | bool can_elpg; | 45 | bool can_elpg; |
@@ -77,7 +74,7 @@ struct gk20a_platform { | |||
77 | #endif | 74 | #endif |
78 | 75 | ||
79 | /* Delay before rail gated */ | 76 | /* Delay before rail gated */ |
80 | int railgate_delay; | 77 | int railgate_delay_init; |
81 | 78 | ||
82 | /* Second Level Clock Gating: true = enable false = disable */ | 79 | /* Second Level Clock Gating: true = enable false = disable */ |
83 | bool enable_slcg; | 80 | bool enable_slcg; |
diff --git a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c index 8c424065..e38ad506 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra Virtualized GPU Platform Interface | 2 | * Tegra Virtualized GPU Platform Interface |
3 | * | 3 | * |
4 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2017, 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, |
@@ -52,7 +52,7 @@ struct gk20a_platform vgpu_tegra_platform = { | |||
52 | .aggressive_sync_destroy_thresh = 64, | 52 | .aggressive_sync_destroy_thresh = 64, |
53 | 53 | ||
54 | /* power management configuration */ | 54 | /* power management configuration */ |
55 | .can_railgate = false, | 55 | .can_railgate_init = false, |
56 | .can_elpg = false, | 56 | .can_elpg = false, |
57 | .enable_slcg = false, | 57 | .enable_slcg = false, |
58 | .enable_blcg = false, | 58 | .enable_blcg = false, |