summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-14 18:12:57 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-14 03:05:12 -0400
commit7acc993cdbcc202854f188e7f53646f387573a09 (patch)
tree61d213424ed8985973fa7ee3e4580c7b1b95bd3b
parentab22d66386e3a23e0dfe897bca25e01623f6d61c (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>
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c21
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c24
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c8
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c30
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h7
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c4
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c10
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c4
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c2
13 files changed, 62 insertions, 61 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 7d6acf91..c2f31afc 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -113,6 +113,8 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
113 g->has_syncpoints = platform->has_syncpoints; 113 g->has_syncpoints = platform->has_syncpoints;
114 g->ptimer_src_freq = platform->ptimer_src_freq; 114 g->ptimer_src_freq = platform->ptimer_src_freq;
115 g->support_pmu = support_gk20a_pmu(g->dev); 115 g->support_pmu = support_gk20a_pmu(g->dev);
116 g->can_railgate = platform->can_railgate_init;
117 g->railgate_delay = platform->railgate_delay_init;
116 118
117 /* set default values to aelpg parameters */ 119 /* set default values to aelpg parameters */
118 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US; 120 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index ebc25a26..708190f2 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -312,7 +312,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
312 * If User disables rail gating, we take one more 312 * If User disables rail gating, we take one more
313 * extra refcount 313 * extra refcount
314 */ 314 */
315 if (platform->user_railgate_disabled) 315 if (g->user_railgate_disabled)
316 target_ref_cnt = 2; 316 target_ref_cnt = 2;
317 else 317 else
318 target_ref_cnt = 1; 318 target_ref_cnt = 1;
@@ -339,7 +339,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
339 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS, 339 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
340 NVGPU_TIMER_CPU_TIMER); 340 NVGPU_TIMER_CPU_TIMER);
341 341
342 if (platform->can_railgate && !force_reset) { 342 if (g->can_railgate && !force_reset) {
343 /* 343 /*
344 * Case 1 : GPU railgate is supported 344 * Case 1 : GPU railgate is supported
345 * 345 *
@@ -349,7 +349,7 @@ int __gk20a_do_idle(struct device *dev, bool force_reset)
349 pm_runtime_put_sync(dev); 349 pm_runtime_put_sync(dev);
350 350
351 /* add sufficient delay to allow GPU to rail gate */ 351 /* add sufficient delay to allow GPU to rail gate */
352 nvgpu_msleep(platform->railgate_delay); 352 nvgpu_msleep(g->railgate_delay);
353 353
354 /* check in loop if GPU is railgated or not */ 354 /* check in loop if GPU is railgated or not */
355 do { 355 do {
@@ -757,7 +757,7 @@ static int gk20a_pm_suspend(struct device *dev)
757 struct gk20a *g = get_gk20a(dev); 757 struct gk20a *g = get_gk20a(dev);
758 int ret = 0; 758 int ret = 0;
759 759
760 if (platform->user_railgate_disabled) 760 if (g->user_railgate_disabled)
761 gk20a_idle_nosuspend(dev); 761 gk20a_idle_nosuspend(dev);
762 762
763 if (atomic_read(&dev->power.usage_count) > 1) { 763 if (atomic_read(&dev->power.usage_count) > 1) {
@@ -780,7 +780,7 @@ static int gk20a_pm_suspend(struct device *dev)
780 return 0; 780 return 0;
781 781
782fail: 782fail:
783 if (platform->user_railgate_disabled) 783 if (g->user_railgate_disabled)
784 gk20a_busy_noresume(dev); 784 gk20a_busy_noresume(dev);
785 785
786 return ret; 786 return ret;
@@ -789,10 +789,9 @@ fail:
789static int gk20a_pm_resume(struct device *dev) 789static int gk20a_pm_resume(struct device *dev)
790{ 790{
791 struct gk20a *g = get_gk20a(dev); 791 struct gk20a *g = get_gk20a(dev);
792 struct gk20a_platform *platform = dev_get_drvdata(dev);
793 int ret = 0; 792 int ret = 0;
794 793
795 if (platform->user_railgate_disabled) 794 if (g->user_railgate_disabled)
796 gk20a_busy_noresume(dev); 795 gk20a_busy_noresume(dev);
797 796
798 if (!g->suspended) 797 if (!g->suspended)
@@ -815,19 +814,19 @@ static const struct dev_pm_ops gk20a_pm_ops = {
815 814
816int gk20a_pm_init(struct device *dev) 815int gk20a_pm_init(struct device *dev)
817{ 816{
818 struct gk20a_platform *platform = dev_get_drvdata(dev); 817 struct gk20a *g = get_gk20a(dev);
819 int err = 0; 818 int err = 0;
820 819
821 gk20a_dbg_fn(""); 820 gk20a_dbg_fn("");
822 821
823 /* Initialise pm runtime */ 822 /* Initialise pm runtime */
824 if (platform->railgate_delay) { 823 if (g->railgate_delay) {
825 pm_runtime_set_autosuspend_delay(dev, 824 pm_runtime_set_autosuspend_delay(dev,
826 platform->railgate_delay); 825 g->railgate_delay);
827 pm_runtime_use_autosuspend(dev); 826 pm_runtime_use_autosuspend(dev);
828 } 827 }
829 828
830 if (platform->can_railgate) { 829 if (g->can_railgate) {
831 pm_runtime_enable(dev); 830 pm_runtime_enable(dev);
832 if (!pm_runtime_enabled(dev)) 831 if (!pm_runtime_enabled(dev))
833 gk20a_pm_unrailgate(dev); 832 gk20a_pm_unrailgate(dev);
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index b4e6cb7c..a603135f 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -64,8 +64,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
64 .remove = nvgpu_pci_tegra_remove, 64 .remove = nvgpu_pci_tegra_remove,
65 65
66 /* power management configuration */ 66 /* power management configuration */
67 .railgate_delay = 500, 67 .railgate_delay_init = 500,
68 .can_railgate = false, 68 .can_railgate_init = false,
69 .can_elpg = true, 69 .can_elpg = true,
70 .enable_elpg = true, 70 .enable_elpg = true,
71 .enable_elcg = false, 71 .enable_elcg = false,
@@ -98,8 +98,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
98 .remove = nvgpu_pci_tegra_remove, 98 .remove = nvgpu_pci_tegra_remove,
99 99
100 /* power management configuration */ 100 /* power management configuration */
101 .railgate_delay = 500, 101 .railgate_delay_init = 500,
102 .can_railgate = false, 102 .can_railgate_init = false,
103 .can_elpg = true, 103 .can_elpg = true,
104 .enable_elpg = true, 104 .enable_elpg = true,
105 .enable_elcg = false, 105 .enable_elcg = false,
@@ -132,8 +132,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
132 .remove = nvgpu_pci_tegra_remove, 132 .remove = nvgpu_pci_tegra_remove,
133 133
134 /* power management configuration */ 134 /* power management configuration */
135 .railgate_delay = 500, 135 .railgate_delay_init = 500,
136 .can_railgate = false, 136 .can_railgate_init = false,
137 .can_elpg = true, 137 .can_elpg = true,
138 .enable_elpg = true, 138 .enable_elpg = true,
139 .enable_elcg = false, 139 .enable_elcg = false,
@@ -166,8 +166,8 @@ static struct gk20a_platform nvgpu_pci_device[] = {
166 .remove = nvgpu_pci_tegra_remove, 166 .remove = nvgpu_pci_tegra_remove,
167 167
168 /* power management configuration */ 168 /* power management configuration */
169 .railgate_delay = 500, 169 .railgate_delay_init = 500,
170 .can_railgate = false, 170 .can_railgate_init = false,
171 .can_elpg = true, 171 .can_elpg = true,
172 .enable_elpg = true, 172 .enable_elpg = true,
173 .enable_elcg = false, 173 .enable_elcg = false,
@@ -311,14 +311,14 @@ static const struct dev_pm_ops nvgpu_pci_pm_ops = {
311static int nvgpu_pci_pm_init(struct device *dev) 311static int nvgpu_pci_pm_init(struct device *dev)
312{ 312{
313#ifdef CONFIG_PM 313#ifdef CONFIG_PM
314 struct gk20a_platform *platform = gk20a_get_platform(dev); 314 struct gk20a *g = get_gk20a(dev);
315 315
316 if (!platform->can_railgate) { 316 if (!g->can_railgate) {
317 pm_runtime_disable(dev); 317 pm_runtime_disable(dev);
318 } else { 318 } else {
319 if (platform->railgate_delay) 319 if (g->railgate_delay)
320 pm_runtime_set_autosuspend_delay(dev, 320 pm_runtime_set_autosuspend_delay(dev,
321 platform->railgate_delay); 321 g->railgate_delay);
322 322
323 /* 323 /*
324 * Runtime PM for PCI devices is disabled by default, 324 * Runtime PM for PCI devices is disabled by default,
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)
397int gk20a_wait_for_idle(struct device *dev) 397int 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,
288static ssize_t railgate_enable_store(struct device *dev, 288static 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,
320static ssize_t railgate_enable_read(struct device *dev, 319static 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
328static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, 327static 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,
361static ssize_t railgate_delay_show(struct device *dev, 359static 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}
368static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, 366static 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,
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
index 5a178960..4ff4804f 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
@@ -955,7 +955,7 @@ static int gk20a_tegra_probe(struct device *dev)
955 955
956 if (joint_xpu_rail) { 956 if (joint_xpu_rail) {
957 gk20a_dbg_info("XPU rails are joint\n"); 957 gk20a_dbg_info("XPU rails are joint\n");
958 platform->can_railgate = false; 958 platform->g->can_railgate = false;
959 } 959 }
960 960
961 platform->g->clk.gpc_pll.id = GK20A_GPC_PLL; 961 platform->g->clk.gpc_pll.id = GK20A_GPC_PLL;
@@ -1051,8 +1051,8 @@ struct gk20a_platform gk20a_tegra_platform = {
1051 .aggressive_sync_destroy_thresh = 64, 1051 .aggressive_sync_destroy_thresh = 64,
1052 1052
1053 /* power management configuration */ 1053 /* power management configuration */
1054 .railgate_delay = 500, 1054 .railgate_delay_init = 500,
1055 .can_railgate = true, 1055 .can_railgate_init = true,
1056 .can_elpg = true, 1056 .can_elpg = true,
1057 .enable_slcg = true, 1057 .enable_slcg = true,
1058 .enable_blcg = true, 1058 .enable_blcg = true,
@@ -1108,8 +1108,8 @@ struct gk20a_platform gm20b_tegra_platform = {
1108 .aggressive_sync_destroy_thresh = 64, 1108 .aggressive_sync_destroy_thresh = 64,
1109 1109
1110 /* power management configuration */ 1110 /* power management configuration */
1111 .railgate_delay = 500, 1111 .railgate_delay_init = 500,
1112 .can_railgate = true, 1112 .can_railgate_init = true,
1113 .can_elpg = true, 1113 .can_elpg = true,
1114 .enable_slcg = true, 1114 .enable_slcg = true,
1115 .enable_blcg = true, 1115 .enable_blcg = true,
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
index 138b8fda..2587d5fa 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c
@@ -382,10 +382,10 @@ struct gk20a_platform gp10b_tegra_platform = {
382 .has_syncpoints = true, 382 .has_syncpoints = true,
383 383
384 /* power management configuration */ 384 /* power management configuration */
385 .railgate_delay = 500, 385 .railgate_delay_init = 500,
386 386
387 /* power management configuration */ 387 /* power management configuration */
388 .can_railgate = true, 388 .can_railgate_init = true,
389 .enable_elpg = true, 389 .enable_elpg = true,
390 .can_elpg = true, 390 .can_elpg = true,
391 .enable_blcg = true, 391 .enable_blcg = true,
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 7e012fb0..248d2a1b 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -242,6 +242,8 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
242 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; 242 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
243 g->has_syncpoints = platform->has_syncpoints; 243 g->has_syncpoints = platform->has_syncpoints;
244 g->ptimer_src_freq = platform->ptimer_src_freq; 244 g->ptimer_src_freq = platform->ptimer_src_freq;
245 g->can_railgate = platform->can_railgate_init;
246 g->railgate_delay = platform->railgate_delay_init;
245} 247}
246 248
247static int vgpu_init_support(struct platform_device *pdev) 249static int vgpu_init_support(struct platform_device *pdev)