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>
This commit is contained in:
Konsta Holtta
2018-06-26 17:18:17 +03:00
committed by mobile promotions
parent 145eb3321f
commit f403800dce
9 changed files with 22 additions and 18 deletions

View File

@@ -368,7 +368,8 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
need_job_tracking = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) ||
(flags & NVGPU_SUBMIT_FLAGS_FENCE_GET) ||
c->timeout.enabled ||
(g->can_railgate && !c->deterministic) ||
(nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)
&& !c->deterministic) ||
!skip_buffer_refcounting;
if (need_job_tracking) {
@@ -405,7 +406,7 @@ static int nvgpu_submit_channel_gpfifo(struct channel_gk20a *c,
need_deferred_cleanup = !c->deterministic ||
need_sync_framework ||
c->timeout.enabled ||
(g->can_railgate &&
(nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) &&
!c->deterministic) ||
!skip_buffer_refcounting;

View File

@@ -1401,7 +1401,6 @@ struct gk20a {
u32 ptimer_src_freq;
bool can_railgate;
int railgate_delay;
u8 ldiv_slowdown_factor;
unsigned int aggressive_sync_destroy_thresh;

View File

@@ -35,6 +35,7 @@ struct gk20a;
#define NVGPU_DRIVER_IS_DYING 2
#define NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP 3
#define NVGPU_FECS_TRACE_VA 4
#define NVGPU_CAN_RAILGATE 5
/*
* ECC flags

View File

@@ -167,7 +167,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
#endif
g->ptimer_src_freq = platform->ptimer_src_freq;
g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g));
g->can_railgate = platform->can_railgate_init;
__nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, platform->can_railgate_init);
g->ldiv_slowdown_factor = platform->ldiv_slowdown_factor_init;
/* if default delay is not set, set default delay to 500msec */
if (platform->railgate_delay_init)

View File

@@ -458,7 +458,7 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset)
* If User disables rail gating, we take one more
* extra refcount
*/
if (g->can_railgate)
if (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE))
target_ref_cnt = 1;
else
target_ref_cnt = 2;
@@ -485,7 +485,7 @@ int __gk20a_do_idle(struct gk20a *g, bool force_reset)
nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
NVGPU_TIMER_CPU_TIMER);
if (g->can_railgate && !force_reset) {
if (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) && !force_reset) {
/*
* Case 1 : GPU railgate is supported
*
@@ -1047,7 +1047,7 @@ static int gk20a_pm_init(struct device *dev)
* case, set autosuspend delay to negative which
* will suspend runtime pm
*/
if (g->railgate_delay && g->can_railgate)
if (g->railgate_delay && nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE))
pm_runtime_set_autosuspend_delay(dev,
g->railgate_delay);
else

View File

@@ -605,7 +605,7 @@ static int nvgpu_pci_pm_init(struct device *dev)
#ifdef CONFIG_PM
struct gk20a *g = get_gk20a(dev);
if (!g->can_railgate) {
if (!nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)) {
pm_runtime_disable(dev);
} else {
if (g->railgate_delay)

View File

@@ -792,7 +792,7 @@ static int gk20a_tegra_probe(struct device *dev)
if (joint_xpu_rail) {
nvgpu_log_info(g, "XPU rails are joint\n");
platform->g->can_railgate = false;
__nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
}
platform->g->clk.gpc_pll.id = GK20A_GPC_PLL;

View File

@@ -305,16 +305,17 @@ static ssize_t railgate_enable_store(struct device *dev,
unsigned long railgate_enable = 0;
/* dev is guaranteed to be valid here. Ok to de-reference */
struct gk20a *g = get_gk20a(dev);
bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE);
int err;
if (kstrtoul(buf, 10, &railgate_enable) < 0)
return -EINVAL;
if (railgate_enable && !g->can_railgate) {
g->can_railgate = true;
if (railgate_enable && !enabled) {
__nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true);
pm_runtime_set_autosuspend_delay(dev, g->railgate_delay);
} else if (railgate_enable == 0 && g->can_railgate) {
g->can_railgate = false;
} else if (railgate_enable == 0 && enabled) {
__nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
pm_runtime_set_autosuspend_delay(dev, -1);
}
/* wake-up system to make rail-gating setting effective */
@@ -323,7 +324,8 @@ static ssize_t railgate_enable_store(struct device *dev,
return err;
gk20a_idle(g);
nvgpu_info(g, "railgate is %s.", g->can_railgate ?
nvgpu_info(g, "railgate is %s.",
nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ?
"enabled" : "disabled");
return count;
@@ -334,7 +336,8 @@ static ssize_t railgate_enable_read(struct device *dev,
{
struct gk20a *g = get_gk20a(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", g->can_railgate ? 1 : 0);
return snprintf(buf, PAGE_SIZE, "%d\n",
nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ? 1 : 0);
}
static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read,
@@ -349,7 +352,7 @@ static ssize_t railgate_delay_store(struct device *dev,
struct gk20a *g = get_gk20a(dev);
int err;
if (!g->can_railgate) {
if (!nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE)) {
nvgpu_info(g, "does not support power-gating");
return count;
}

View File

@@ -84,7 +84,7 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
g->has_syncpoints = platform->has_syncpoints;
g->ptimer_src_freq = platform->ptimer_src_freq;
g->can_railgate = platform->can_railgate_init;
__nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, platform->can_railgate_init);
g->railgate_delay = platform->railgate_delay_init;
__nvgpu_set_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES,