summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2017-12-30 19:51:52 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-19 14:39:54 -0500
commit968d8cd3e543b951714d9a86373bd721d08c8482 (patch)
tree01c4a759468421c33aa121991957331ed86546db
parentf50c2af8a7d147855e5537531078bb03740abb67 (diff)
gpu: nvgpu: gv11b: enable devfreq
Enable devfreq for gv11b by enabling ""nvhost_podgov" governor in platform data. Reuse scaling functions from gp10b/gk20a. Remove emc floor on railgate for power saving and make max emc frequency as floor in rail-ungate for faster gpu boot. Bug 2039013 Bug 200377508 Change-Id: I65ee7735202e3decbe3451157f7fc1f1f273c3ff Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1639752 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c14
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c30
-rw-r--r--drivers/gpu/nvgpu/gp10b/platform_gp10b.h9
3 files changed, 43 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index 8a964caf..b6593d7a 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B Tegra Platform Interface 2 * GP10B Tegra Platform Interface
3 * 3 *
4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, 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,
@@ -150,7 +150,7 @@ static int gp10b_tegra_probe(struct device *dev)
150 return 0; 150 return 0;
151} 151}
152 152
153static int gp10b_tegra_late_probe(struct device *dev) 153int gp10b_tegra_late_probe(struct device *dev)
154{ 154{
155 /* Cause early VPR resize */ 155 /* Cause early VPR resize */
156 gk20a_tegra_secure_page_alloc(dev); 156 gk20a_tegra_secure_page_alloc(dev);
@@ -262,7 +262,7 @@ int gp10b_tegra_reset_deassert(struct device *dev)
262 return ret; 262 return ret;
263} 263}
264 264
265static void gp10b_tegra_prescale(struct device *dev) 265void gp10b_tegra_prescale(struct device *dev)
266{ 266{
267 struct gk20a *g = get_gk20a(dev); 267 struct gk20a *g = get_gk20a(dev);
268 u32 avg = 0; 268 u32 avg = 0;
@@ -274,7 +274,7 @@ static void gp10b_tegra_prescale(struct device *dev)
274 gk20a_dbg_fn("done"); 274 gk20a_dbg_fn("done");
275} 275}
276 276
277static void gp10b_tegra_postscale(struct device *pdev, 277void gp10b_tegra_postscale(struct device *pdev,
278 unsigned long freq) 278 unsigned long freq)
279{ 279{
280 struct gk20a_platform *platform = gk20a_get_platform(pdev); 280 struct gk20a_platform *platform = gk20a_get_platform(pdev);
@@ -283,7 +283,7 @@ static void gp10b_tegra_postscale(struct device *pdev,
283 unsigned long emc_rate; 283 unsigned long emc_rate;
284 284
285 gk20a_dbg_fn(""); 285 gk20a_dbg_fn("");
286 if (profile && !gp10b_tegra_is_railgated(pdev)) { 286 if (profile && !platform->is_railgated(pdev)) {
287 unsigned long emc_scale; 287 unsigned long emc_scale;
288 288
289 if (freq <= gp10b_freq_table[0]) 289 if (freq <= gp10b_freq_table[0])
@@ -303,7 +303,7 @@ static void gp10b_tegra_postscale(struct device *pdev,
303 gk20a_dbg_fn("done"); 303 gk20a_dbg_fn("done");
304} 304}
305 305
306static long gp10b_round_clk_rate(struct device *dev, unsigned long rate) 306long gp10b_round_clk_rate(struct device *dev, unsigned long rate)
307{ 307{
308 struct gk20a *g = get_gk20a(dev); 308 struct gk20a *g = get_gk20a(dev);
309 struct gk20a_scale_profile *profile = g->scale_profile; 309 struct gk20a_scale_profile *profile = g->scale_profile;
@@ -318,7 +318,7 @@ static long gp10b_round_clk_rate(struct device *dev, unsigned long rate)
318 return freq_table[max_states - 1]; 318 return freq_table[max_states - 1];
319} 319}
320 320
321static int gp10b_clk_get_freqs(struct device *dev, 321int gp10b_clk_get_freqs(struct device *dev,
322 unsigned long **freqs, int *num_freqs) 322 unsigned long **freqs, int *num_freqs)
323{ 323{
324 struct gk20a_platform *platform = gk20a_get_platform(dev); 324 struct gk20a_platform *platform = gk20a_get_platform(dev);
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
index a452896f..81b6204d 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GV11B Tegra Platform Interface 2 * GV11B Tegra Platform Interface
3 * 3 *
4 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2016-2018, 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,
@@ -23,6 +23,7 @@
23#include <linux/reset.h> 23#include <linux/reset.h>
24#include <linux/hashtable.h> 24#include <linux/hashtable.h>
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/platform/tegra/emc_bwmgr.h>
26 27
27#include <nvgpu/nvhost.h> 28#include <nvgpu/nvhost.h>
28#include <nvgpu/nvhost_t19x.h> 29#include <nvgpu/nvhost_t19x.h>
@@ -35,6 +36,7 @@
35#include "gk20a/gk20a.h" 36#include "gk20a/gk20a.h"
36#include "platform_gk20a.h" 37#include "platform_gk20a.h"
37#include "clk.h" 38#include "clk.h"
39#include "scale.h"
38 40
39#include "gp10b/platform_gp10b.h" 41#include "gp10b/platform_gp10b.h"
40#include "platform_gp10b_tegra.h" 42#include "platform_gp10b_tegra.h"
@@ -130,9 +132,16 @@ static int gv11b_tegra_railgate(struct device *dev)
130{ 132{
131#ifdef TEGRA194_POWER_DOMAIN_GPU 133#ifdef TEGRA194_POWER_DOMAIN_GPU
132 struct gk20a_platform *platform = gk20a_get_platform(dev); 134 struct gk20a_platform *platform = gk20a_get_platform(dev);
135 struct gk20a_scale_profile *profile = platform->g->scale_profile;
133 struct gk20a *g = get_gk20a(dev); 136 struct gk20a *g = get_gk20a(dev);
134 int i; 137 int i;
135 138
139 /* remove emc frequency floor */
140 if (profile)
141 tegra_bwmgr_set_emc(
142 (struct tegra_bwmgr_client *)profile->private_data,
143 0, TEGRA_BWMGR_SET_EMC_FLOOR);
144
136 if (tegra_bpmp_running()) { 145 if (tegra_bpmp_running()) {
137 nvgpu_log(g, gpu_dbg_info, "bpmp running"); 146 nvgpu_log(g, gpu_dbg_info, "bpmp running");
138 if (!tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU)) { 147 if (!tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU)) {
@@ -159,6 +168,7 @@ static int gv11b_tegra_unrailgate(struct device *dev)
159#ifdef TEGRA194_POWER_DOMAIN_GPU 168#ifdef TEGRA194_POWER_DOMAIN_GPU
160 struct gk20a_platform *platform = gk20a_get_platform(dev); 169 struct gk20a_platform *platform = gk20a_get_platform(dev);
161 struct gk20a *g = get_gk20a(dev); 170 struct gk20a *g = get_gk20a(dev);
171 struct gk20a_scale_profile *profile = platform->g->scale_profile;
162 int i; 172 int i;
163 173
164 if (tegra_bpmp_running()) { 174 if (tegra_bpmp_running()) {
@@ -177,6 +187,13 @@ static int gv11b_tegra_unrailgate(struct device *dev)
177 } else { 187 } else {
178 nvgpu_log(g, gpu_dbg_info, "bpmp not running"); 188 nvgpu_log(g, gpu_dbg_info, "bpmp not running");
179 } 189 }
190
191 /* to start with set emc frequency floor to max rate*/
192 if (profile)
193 tegra_bwmgr_set_emc(
194 (struct tegra_bwmgr_client *)profile->private_data,
195 tegra_bwmgr_get_max_emc_rate(),
196 TEGRA_BWMGR_SET_EMC_FLOOR);
180#endif 197#endif
181 return ret; 198 return ret;
182} 199}
@@ -200,6 +217,7 @@ struct gk20a_platform t19x_gpu_tegra_platform = {
200 .ch_wdt_timeout_ms = 5000, 217 .ch_wdt_timeout_ms = 5000,
201 218
202 .probe = gv11b_tegra_probe, 219 .probe = gv11b_tegra_probe,
220 .late_probe = gp10b_tegra_late_probe,
203 .remove = gv11b_tegra_remove, 221 .remove = gv11b_tegra_remove,
204 222
205 .enable_slcg = false, 223 .enable_slcg = false,
@@ -219,6 +237,16 @@ struct gk20a_platform t19x_gpu_tegra_platform = {
219 .busy = gk20a_tegra_busy, 237 .busy = gk20a_tegra_busy,
220 .idle = gk20a_tegra_idle, 238 .idle = gk20a_tegra_idle,
221 239
240 .clk_round_rate = gp10b_round_clk_rate,
241 .get_clk_freqs = gp10b_clk_get_freqs,
242
243 /* frequency scaling configuration */
244 .prescale = gp10b_tegra_prescale,
245 .postscale = gp10b_tegra_postscale,
246 .devfreq_governor = "nvhost_podgov",
247
248 .qos_notify = gk20a_scale_qos_notify,
249
222 .dump_platform_dependencies = gk20a_tegra_debug_dump, 250 .dump_platform_dependencies = gk20a_tegra_debug_dump,
223 251
224 .soc_name = "tegra19x", 252 .soc_name = "tegra19x",
diff --git a/drivers/gpu/nvgpu/gp10b/platform_gp10b.h b/drivers/gpu/nvgpu/gp10b/platform_gp10b.h
index 0791c2fe..35fb5bb5 100644
--- a/drivers/gpu/nvgpu/gp10b/platform_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/platform_gp10b.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GP10B Platform (SoC) Interface 2 * GP10B Platform (SoC) Interface
3 * 3 *
4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
@@ -30,5 +30,10 @@ struct device;
30int gp10b_tegra_get_clocks(struct device *dev); 30int gp10b_tegra_get_clocks(struct device *dev);
31int gp10b_tegra_reset_assert(struct device *dev); 31int gp10b_tegra_reset_assert(struct device *dev);
32int gp10b_tegra_reset_deassert(struct device *dev); 32int gp10b_tegra_reset_deassert(struct device *dev);
33 33long gp10b_round_clk_rate(struct device *dev, unsigned long rate);
34int gp10b_clk_get_freqs(struct device *dev,
35 unsigned long **freqs, int *num_freqs);
36void gp10b_tegra_prescale(struct device *dev);
37void gp10b_tegra_postscale(struct device *pdev, unsigned long freq);
38int gp10b_tegra_late_probe(struct device *dev);
34#endif 39#endif