summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_mclk.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2016-10-07 19:25:04 -0400
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:56:52 -0500
commitc4bb19d46e1c9121a0948fa506098cbf2f64e2a6 (patch)
tree29647922e8374377c05ab976c7616410d85eda4d /drivers/gpu/nvgpu/clk/clk_mclk.c
parentbfc12d25a41c2b5a4d06f233f16331e43c489d8e (diff)
nvgpu: gpu: arbiter for vf switch management
JIRA DNVGPU-143 The arbiter is charged with selecting the proper frequencies when multiple applications submit simultaneously clock change requests On the current implementation, the arbiter guarantees that the selected frequency will be always higher or equal to the request, as long as the request is in range. The current code is not yet realtime friendly, as requests are not pre-allocated. Summary of changes: (1) pstate/vf switch no longer selects boot frequency (2) changed mclk code change to accept input freq (3) added arbiter (4) now a single session can submit concurrent requests the last request is the one that applies for that session (5) modified locking mechanism to reduce lock contention (6) Added callback to notify the arbiter that the VF table has changed and is no longer valid (PMU/Thermals must call this when VF table is invalid) (7) changed internal API to work with MHz (8) added debugfs for stats Change-Id: I6a7b05c9447761e8536f84ef86b5ab0793164d63 Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1239461 Reviewed-by: Thomas Fleury <tfleury@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1267120 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_mclk.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_mclk.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_mclk.c b/drivers/gpu/nvgpu/clk/clk_mclk.c
index 86f4ff6d..6ad6c054 100644
--- a/drivers/gpu/nvgpu/clk/clk_mclk.c
+++ b/drivers/gpu/nvgpu/clk/clk_mclk.c
@@ -2222,7 +2222,7 @@ int clk_mclkseq_init_mclk_gddr5(struct gk20a *g)
2222 return 0; 2222 return 0;
2223} 2223}
2224 2224
2225int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, enum gk20a_mclk_speed speed) 2225int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, u16 val)
2226{ 2226{
2227 struct clk_mclk_state *mclk; 2227 struct clk_mclk_state *mclk;
2228 struct pmu_payload payload = { {0} }; 2228 struct pmu_payload payload = { {0} };
@@ -2236,6 +2236,7 @@ int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, enum gk20a_mclk_speed speed)
2236#ifdef CONFIG_DEBUG_FS 2236#ifdef CONFIG_DEBUG_FS
2237 u64 t0, t1; 2237 u64 t0, t1;
2238#endif 2238#endif
2239 enum gk20a_mclk_speed speed;
2239 2240
2240 gk20a_dbg_info(""); 2241 gk20a_dbg_info("");
2241 2242
@@ -2246,6 +2247,13 @@ int clk_mclkseq_change_mclk_gddr5(struct gk20a *g, enum gk20a_mclk_speed speed)
2246 if (!mclk->init) 2247 if (!mclk->init)
2247 goto exit_status; 2248 goto exit_status;
2248 2249
2250 /* TODO thia should be done according to VBIOS tables */
2251
2252 speed = (val <= MCLK_LOW_SPEED_LIMIT) ? gk20a_mclk_low_speed :
2253 (val <= MCLK_MID_SPEED_LIMIT) ? gk20a_mclk_mid_speed :
2254 gk20a_mclk_high_speed;
2255
2256
2249 if (speed == mclk->speed) 2257 if (speed == mclk->speed)
2250 goto exit_status; 2258 goto exit_status;
2251 2259
@@ -2374,20 +2382,13 @@ exit_status:
2374#ifdef CONFIG_DEBUG_FS 2382#ifdef CONFIG_DEBUG_FS
2375static int mclk_debug_speed_set(void *data, u64 val) 2383static int mclk_debug_speed_set(void *data, u64 val)
2376{ 2384{
2377 enum gk20a_mclk_speed speed;
2378 struct gk20a *g = (struct gk20a *) data; 2385 struct gk20a *g = (struct gk20a *) data;
2379 struct clk_mclk_state *mclk; 2386 struct clk_mclk_state *mclk;
2380 2387
2381 mclk = &g->clk_pmu.clk_mclk; 2388 mclk = &g->clk_pmu.clk_mclk;
2382 2389
2383 /* TODO thia should be done according to VBIOS tables */
2384
2385 speed = (val <= MCLK_LOW_SPEED_LIMIT) ? gk20a_mclk_low_speed :
2386 (val <= MCLK_MID_SPEED_LIMIT) ? gk20a_mclk_mid_speed :
2387 gk20a_mclk_high_speed;
2388
2389 if (mclk->change) 2390 if (mclk->change)
2390 return mclk->change(g, speed); 2391 return mclk->change(g, (u16) val);
2391 return 0; 2392 return 0;
2392 2393
2393} 2394}