summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/pmu_gp106.c
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2017-02-14 02:22:20 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-15 22:33:28 -0500
commitd465504534b2ec7ab0be190fc98b24e1b77634e2 (patch)
tree3ee1a90cb49cb2a3df3b39c79b37bdbcddeffe97 /drivers/gpu/nvgpu/gp106/pmu_gp106.c
parent907adfd785e3a3582b2649c48bf4c32f41745e3f (diff)
gpu: nvgpu: Remove PMU gm204/gm206 support
-Created new methods for PMU gp106 whichever dependent on gm206. -Deleted pmu_gm206.c/h files & removed its involvement from dependent files. Change-Id: Ic578da53bff362efb3e142962275227787206233 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: http://git-master/r/1304492 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/pmu_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/pmu_gp106.c110
1 files changed, 106 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gp106/pmu_gp106.c b/drivers/gpu/nvgpu/gp106/pmu_gp106.c
index 9aac5328..5a9d5ba6 100644
--- a/drivers/gpu/nvgpu/gp106/pmu_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/pmu_gp106.c
@@ -17,7 +17,6 @@
17#include "gk20a/pmu_gk20a.h" 17#include "gk20a/pmu_gk20a.h"
18 18
19#include "gm20b/pmu_gm20b.h" 19#include "gm20b/pmu_gm20b.h"
20#include "gm206/pmu_gm206.h"
21#include "gp10b/pmu_gp10b.h" 20#include "gp10b/pmu_gp10b.h"
22#include "gp106/pmu_gp106.h" 21#include "gp106/pmu_gp106.h"
23#include "gp106/acr_gp106.h" 22#include "gp106/acr_gp106.h"
@@ -299,6 +298,109 @@ static bool gp106_pmu_is_lpwr_feature_supported(struct gk20a *g, u32 feature_id)
299 return is_feature_supported; 298 return is_feature_supported;
300} 299}
301 300
301static bool gp106_is_lazy_bootstrap(u32 falcon_id)
302{
303 bool enable_status = false;
304
305 switch (falcon_id) {
306 case LSF_FALCON_ID_FECS:
307 enable_status = true;
308 break;
309 case LSF_FALCON_ID_GPCCS:
310 enable_status = true;
311 break;
312 default:
313 break;
314 }
315
316 return enable_status;
317}
318
319static bool gp106_is_priv_load(u32 falcon_id)
320{
321 bool enable_status = false;
322
323 switch (falcon_id) {
324 case LSF_FALCON_ID_FECS:
325 enable_status = true;
326 break;
327 case LSF_FALCON_ID_GPCCS:
328 enable_status = true;
329 break;
330 default:
331 break;
332 }
333
334 return enable_status;
335}
336
337static void gp106_pmu_load_multiple_falcons(struct gk20a *g, u32 falconidmask,
338 u32 flags)
339{
340 struct pmu_gk20a *pmu = &g->pmu;
341 struct pmu_cmd cmd;
342 u32 seq;
343
344 gk20a_dbg_fn("");
345
346 gp106_dbg_pmu("wprinit status = %x\n", g->ops.pmu.lspmuwprinitdone);
347 if (g->ops.pmu.lspmuwprinitdone) {
348 /* send message to load FECS falcon */
349 memset(&cmd, 0, sizeof(struct pmu_cmd));
350 cmd.hdr.unit_id = PMU_UNIT_ACR;
351 cmd.hdr.size = PMU_CMD_HDR_SIZE +
352 sizeof(struct pmu_acr_cmd_bootstrap_multiple_falcons);
353 cmd.cmd.acr.boot_falcons.cmd_type =
354 PMU_ACR_CMD_ID_BOOTSTRAP_MULTIPLE_FALCONS;
355 cmd.cmd.acr.boot_falcons.flags = flags;
356 cmd.cmd.acr.boot_falcons.falconidmask =
357 falconidmask;
358 cmd.cmd.acr.boot_falcons.usevamask = 0;
359 cmd.cmd.acr.boot_falcons.wprvirtualbase.lo = 0;
360 cmd.cmd.acr.boot_falcons.wprvirtualbase.hi = 0;
361
362 gp106_dbg_pmu("PMU_ACR_CMD_ID_BOOTSTRAP_MULTIPLE_FALCONS:%x\n",
363 falconidmask);
364 gk20a_pmu_cmd_post(g, &cmd, NULL, NULL, PMU_COMMAND_QUEUE_HPQ,
365 pmu_handle_fecs_boot_acr_msg, pmu, &seq, ~0);
366 }
367
368 gk20a_dbg_fn("done");
369}
370
371static int gp106_load_falcon_ucode(struct gk20a *g, u32 falconidmask)
372{
373 u32 flags = PMU_ACR_CMD_BOOTSTRAP_FALCON_FLAGS_RESET_YES;
374
375 /* GM20B PMU supports loading FECS and GPCCS only */
376 if (falconidmask == 0)
377 return -EINVAL;
378 if (falconidmask & ~((1 << LSF_FALCON_ID_FECS) |
379 (1 << LSF_FALCON_ID_GPCCS)))
380 return -EINVAL;
381 g->ops.pmu.lsfloadedfalconid = 0;
382 /* check whether pmu is ready to bootstrap lsf if not wait for it */
383 if (!g->ops.pmu.lspmuwprinitdone) {
384 pmu_wait_message_cond(&g->pmu,
385 gk20a_get_gr_idle_timeout(g),
386 &g->ops.pmu.lspmuwprinitdone, 1);
387 /* check again if it still not ready indicate an error */
388 if (!g->ops.pmu.lspmuwprinitdone) {
389 gk20a_err(dev_from_gk20a(g),
390 "PMU not ready to load LSF");
391 return -ETIMEDOUT;
392 }
393 }
394 /* load falcon(s) */
395 gp106_pmu_load_multiple_falcons(g, falconidmask, flags);
396 pmu_wait_message_cond(&g->pmu,
397 gk20a_get_gr_idle_timeout(g),
398 &g->ops.pmu.lsfloadedfalconid, falconidmask);
399 if (g->ops.pmu.lsfloadedfalconid != falconidmask)
400 return -ETIMEDOUT;
401 return 0;
402}
403
302void gp106_init_pmu_ops(struct gpu_ops *gops) 404void gp106_init_pmu_ops(struct gpu_ops *gops)
303{ 405{
304 gk20a_dbg_fn(""); 406 gk20a_dbg_fn("");
@@ -306,9 +408,9 @@ void gp106_init_pmu_ops(struct gpu_ops *gops)
306 if (gops->privsecurity) { 408 if (gops->privsecurity) {
307 gp106_init_secure_pmu(gops); 409 gp106_init_secure_pmu(gops);
308 gops->pmu.init_wpr_region = gm20b_pmu_init_acr; 410 gops->pmu.init_wpr_region = gm20b_pmu_init_acr;
309 gops->pmu.load_lsfalcon_ucode = gm206_load_falcon_ucode; 411 gops->pmu.load_lsfalcon_ucode = gp106_load_falcon_ucode;
310 gops->pmu.is_lazy_bootstrap = gm206_is_lazy_bootstrap; 412 gops->pmu.is_lazy_bootstrap = gp106_is_lazy_bootstrap;
311 gops->pmu.is_priv_load = gm206_is_priv_load; 413 gops->pmu.is_priv_load = gp106_is_priv_load;
312 } else { 414 } else {
313 gk20a_init_pmu_ops(gops); 415 gk20a_init_pmu_ops(gops);
314 gops->pmu.pmu_setup_hw_and_bootstrap = 416 gops->pmu.pmu_setup_hw_and_bootstrap =