summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2018-06-26 10:18:17 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-07-04 07:42:05 -0400
commitf403800dce923c8bac982291aee213e1e3afdab0 (patch)
tree01e7b9af55778f1514e5b02e520abf1b7ccd8d39
parent145eb3321fb8b5411c9e4975eada21515c19ebb0 (diff)
gpu: nvgpu: move can_railgate to enabled.h
The g->can_railgate flag is a global constant-ish property like the rest of the flags behind nvgpu_is_enabled() API, so move it there. Bug 200327089 Change-Id: Id1f2f16ea1975a03fb56f10c2f3c8c705574e341 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1764266 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/fifo/submit.c5
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/enabled.h1
-rw-r--r--drivers/gpu/nvgpu/os/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/os/linux/module.c6
-rw-r--r--drivers/gpu/nvgpu/os/linux/pci.c2
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/os/linux/sysfs.c19
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c2
9 files changed, 22 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/submit.c b/drivers/gpu/nvgpu/common/fifo/submit.c
index f6a79f80..00763036 100644
--- a/drivers/gpu/nvgpu/common/fifo/submit.c
+++ b/drivers/gpu/nvgpu/common/fifo/submit.c
@@ -368,7 +368,8 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
368 need_job_tracking = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) || 368 need_job_tracking = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) ||
369 (flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) || 369 (flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) ||
370 c->timeout.enabled || 370 c->timeout.enabled ||
371 (g->can_railgate && !c->deterministic) || 371 (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)
372 && !c->deterministic) ||
372 !skip_buffer_refcounting; 373 !skip_buffer_refcounting;
373 374
374 if (need_job_tracking) { 375 if (need_job_tracking) {
@@ -405,7 +406,7 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
405 need_deferred_cleanup = !c->deterministic || 406 need_deferred_cleanup = !c->deterministic ||
406 need_sync_framework || 407 need_sync_framework ||
407 c->timeout.enabled || 408 c->timeout.enabled ||
408 (g->can_railgate && 409 (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) &&
409 !c->deterministic) || 410 !c->deterministic) ||
410 !skip_buffer_refcounting; 411 !skip_buffer_refcounting;
411 412
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 3c25f8fb..263d0632 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -1401,7 +1401,6 @@ struct gk20a {
1401 1401
1402 u32 ptimer_src_freq; 1402 u32 ptimer_src_freq;
1403 1403
1404 bool can_railgate;
1405 int railgate_delay; 1404 int railgate_delay;
1406 u8 ldiv_slowdown_factor; 1405 u8 ldiv_slowdown_factor;
1407 unsigned int aggressive_sync_destroy_thresh; 1406 unsigned int aggressive_sync_destroy_thresh;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
index c352488c..c0fb9218 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
@@ -35,6 +35,7 @@ struct gk20a;
35#define NVGPU_DRIVER_IS_DYING 2 35#define NVGPU_DRIVER_IS_DYING 2
36#define NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP 3 36#define NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP 3
37#define NVGPU_FECS_TRACE_VA 4 37#define NVGPU_FECS_TRACE_VA 4
38#define NVGPU_CAN_RAILGATE 5
38 39
39/* 40/*
40 * ECC flags 41 * ECC flags
diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c
index c84c8439..8a7cf552 100644
--- a/drivers/gpu/nvgpu/os/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/os/linux/driver_common.c
@@ -167,7 +167,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
167#endif 167#endif
168 g->ptimer_src_freq = platform->ptimer_src_freq; 168 g->ptimer_src_freq = platform->ptimer_src_freq;
169 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); 169 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g));
170 g->can_railgate = platform->can_railgate_init; 170 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, platform->can_railgate_init);
171 g->ldiv_slowdown_factor = platform->ldiv_slowdown_factor_init; 171 g->ldiv_slowdown_factor = platform->ldiv_slowdown_factor_init;
172 /* if default delay is not set, set default delay to 500msec */ 172 /* if default delay is not set, set default delay to 500msec */
173 if (platform->railgate_delay_init) 173 if (platform->railgate_delay_init)
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c
index 4516490b..2df8ab42 100644
--- a/drivers/gpu/nvgpu/os/linux/module.c
+++ b/drivers/gpu/nvgpu/os/linux/module.c
@@ -458,7 +458,7 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset)
458 * If User disables rail gating, we take one more 458 * If User disables rail gating, we take one more
459 * extra refcount 459 * extra refcount
460 */ 460 */
461 if (g->can_railgate) 461 if (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE))
462 target_ref_cnt = 1; 462 target_ref_cnt = 1;
463 else 463 else
464 target_ref_cnt = 2; 464 target_ref_cnt = 2;
@@ -485,7 +485,7 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset)
485 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS, 485 nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
486 NVGPU_TIMER_CPU_TIMER); 486 NVGPU_TIMER_CPU_TIMER);
487 487
488 if (g->can_railgate && !force_reset) { 488 if (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) && !force_reset) {
489 /* 489 /*
490 * Case 1 : GPU railgate is supported 490 * Case 1 : GPU railgate is supported
491 * 491 *
@@ -1047,7 +1047,7 @@ static int gk20a_pm_init(struct device *dev)
1047 * case, set autosuspend delay to negative which 1047 * case, set autosuspend delay to negative which
1048 * will suspend runtime pm 1048 * will suspend runtime pm
1049 */ 1049 */
1050 if (g->railgate_delay && g->can_railgate) 1050 if (g->railgate_delay && nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE))
1051 pm_runtime_set_autosuspend_delay(dev, 1051 pm_runtime_set_autosuspend_delay(dev,
1052 g->railgate_delay); 1052 g->railgate_delay);
1053 else 1053 else
diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c
index 1011b441..205986ec 100644
--- a/drivers/gpu/nvgpu/os/linux/pci.c
+++ b/drivers/gpu/nvgpu/os/linux/pci.c
@@ -605,7 +605,7 @@ static int nvgpu_pci_pm_init(struct device *dev)
605#ifdef CONFIG_PM 605#ifdef CONFIG_PM
606 struct gk20a *g = get_gk20a(dev); 606 struct gk20a *g = get_gk20a(dev);
607 607
608 if (!g->can_railgate) { 608 if (!nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)) {
609 pm_runtime_disable(dev); 609 pm_runtime_disable(dev);
610 } else { 610 } else {
611 if (g->railgate_delay) 611 if (g->railgate_delay)
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
index af55e5b6..432af108 100644
--- a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
@@ -792,7 +792,7 @@ static int gk20a_tegra_probe(struct device *dev)
792 792
793 if (joint_xpu_rail) { 793 if (joint_xpu_rail) {
794 nvgpu_log_info(g, "XPU rails are joint\n"); 794 nvgpu_log_info(g, "XPU rails are joint\n");
795 platform->g->can_railgate = false; 795 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
796 } 796 }
797 797
798 platform->g->clk.gpc_pll.id = GK20A_GPC_PLL; 798 platform->g->clk.gpc_pll.id = GK20A_GPC_PLL;
diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c
index e5995bb8..1b84e2e2 100644
--- a/drivers/gpu/nvgpu/os/linux/sysfs.c
+++ b/drivers/gpu/nvgpu/os/linux/sysfs.c
@@ -305,16 +305,17 @@ static ssize_t railgate_enable_store(struct device *dev,
305 unsigned long railgate_enable = 0; 305 unsigned long railgate_enable = 0;
306 /* dev is guaranteed to be valid here. Ok to de-reference */ 306 /* dev is guaranteed to be valid here. Ok to de-reference */
307 struct gk20a *g = get_gk20a(dev); 307 struct gk20a *g = get_gk20a(dev);
308 bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE);
308 int err; 309 int err;
309 310
310 if (kstrtoul(buf, 10, &railgate_enable) < 0) 311 if (kstrtoul(buf, 10, &railgate_enable) < 0)
311 return -EINVAL; 312 return -EINVAL;
312 313
313 if (railgate_enable && !g->can_railgate) { 314 if (railgate_enable && !enabled) {
314 g->can_railgate = true; 315 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true);
315 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); 316 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay);
316 } else if (railgate_enable == 0 && g->can_railgate) { 317 } else if (railgate_enable == 0 && enabled) {
317 g->can_railgate = false; 318 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
318 pm_runtime_set_autosuspend_delay(dev, -1); 319 pm_runtime_set_autosuspend_delay(dev, -1);
319 } 320 }
320 /* wake-up system to make rail-gating setting effective */ 321 /* wake-up system to make rail-gating setting effective */
@@ -323,8 +324,9 @@ static ssize_t railgate_enable_store(struct device *dev,
323 return err; 324 return err;
324 gk20a_idle(g); 325 gk20a_idle(g);
325 326
326 nvgpu_info(g, "railgate is %s.", g->can_railgate ? 327 nvgpu_info(g, "railgate is %s.",
327 "enabled" : "disabled"); 328 nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ?
329 "enabled" : "disabled");
328 330
329 return count; 331 return count;
330} 332}
@@ -334,7 +336,8 @@ static ssize_t railgate_enable_read(struct device *dev,
334{ 336{
335 struct gk20a *g = get_gk20a(dev); 337 struct gk20a *g = get_gk20a(dev);
336 338
337 return snprintf(buf, PAGE_SIZE, "%d\n", g->can_railgate ? 1 : 0); 339 return snprintf(buf, PAGE_SIZE, "%d\n",
340 nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ? 1 : 0);
338} 341}
339 342
340static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, 343static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read,
@@ -349,7 +352,7 @@ static ssize_t railgate_delay_store(struct device *dev,
349 struct gk20a *g = get_gk20a(dev); 352 struct gk20a *g = get_gk20a(dev);
350 int err; 353 int err;
351 354
352 if (!g->can_railgate) { 355 if (!nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)) {
353 nvgpu_info(g, "does not support power-gating"); 356 nvgpu_info(g, "does not support power-gating");
354 return count; 357 return count;
355 } 358 }
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
index 25024e7d..83191316 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
@@ -84,7 +84,7 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
84 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; 84 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
85 g->has_syncpoints = platform->has_syncpoints; 85 g->has_syncpoints = platform->has_syncpoints;
86 g->ptimer_src_freq = platform->ptimer_src_freq; 86 g->ptimer_src_freq = platform->ptimer_src_freq;
87 g->can_railgate = platform->can_railgate_init; 87 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, platform->can_railgate_init);
88 g->railgate_delay = platform->railgate_delay_init; 88 g->railgate_delay = platform->railgate_delay_init;
89 89
90 __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES, 90 __nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES,