summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-08-01 20:10:42 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-21 16:06:07 -0400
commit5f010177de985c901c33c914efe70a8498a5974f (patch)
tree1b1a2ac1ab71608a0754a7eb64222f5d198e793c /drivers/gpu/nvgpu/gp10b/pmu_gp10b.c
parentb50b379c192714d0d08c3f2d33e90c95cf795253 (diff)
gpu: nvgpu: Reorg pmu HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the pmu sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I8839ac99e87153637005e23b3013237f57275c54 Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1530982 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/pmu_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/pmu_gp10b.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c
index f45490db..81568122 100644
--- a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c
@@ -252,7 +252,7 @@ int gp10b_pg_gr_init(struct gk20a *g, u32 pg_engine_id)
252 return 0; 252 return 0;
253} 253}
254 254
255static void gp10b_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id, 255void gp10b_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id,
256 struct pmu_pg_stats_data *pg_stat_data) 256 struct pmu_pg_stats_data *pg_stat_data)
257{ 257{
258 struct nvgpu_pmu *pmu = &g->pmu; 258 struct nvgpu_pmu *pmu = &g->pmu;
@@ -269,7 +269,7 @@ static void gp10b_pmu_elpg_statistics(struct gk20a *g, u32 pg_engine_id,
269 pg_stat_data->avg_exit_latency_us = stats.exitlatency_avgus; 269 pg_stat_data->avg_exit_latency_us = stats.exitlatency_avgus;
270} 270}
271 271
272static int gp10b_pmu_setup_elpg(struct gk20a *g) 272int gp10b_pmu_setup_elpg(struct gk20a *g)
273{ 273{
274 int ret = 0; 274 int ret = 0;
275 u32 reg_writes; 275 u32 reg_writes;
@@ -299,7 +299,7 @@ void gp10b_write_dmatrfbase(struct gk20a *g, u32 addr)
299 0x0); 299 0x0);
300} 300}
301 301
302static int gp10b_init_pmu_setup_hw1(struct gk20a *g) 302int gp10b_init_pmu_setup_hw1(struct gk20a *g)
303{ 303{
304 struct nvgpu_pmu *pmu = &g->pmu; 304 struct nvgpu_pmu *pmu = &g->pmu;
305 int err; 305 int err;
@@ -337,7 +337,7 @@ static int gp10b_init_pmu_setup_hw1(struct gk20a *g)
337 337
338} 338}
339 339
340static bool gp10b_is_lazy_bootstrap(u32 falcon_id) 340bool gp10b_is_lazy_bootstrap(u32 falcon_id)
341{ 341{
342 bool enable_status = false; 342 bool enable_status = false;
343 343
@@ -355,7 +355,7 @@ static bool gp10b_is_lazy_bootstrap(u32 falcon_id)
355 return enable_status; 355 return enable_status;
356} 356}
357 357
358static bool gp10b_is_priv_load(u32 falcon_id) 358bool gp10b_is_priv_load(u32 falcon_id)
359{ 359{
360 bool enable_status = false; 360 bool enable_status = false;
361 361
@@ -374,7 +374,7 @@ static bool gp10b_is_priv_load(u32 falcon_id)
374} 374}
375 375
376/*Dump Security related fuses*/ 376/*Dump Security related fuses*/
377static void pmu_dump_security_fuses_gp10b(struct gk20a *g) 377void pmu_dump_security_fuses_gp10b(struct gk20a *g)
378{ 378{
379 u32 val; 379 u32 val;
380 380
@@ -386,50 +386,7 @@ static void pmu_dump_security_fuses_gp10b(struct gk20a *g)
386 nvgpu_err(g, "FUSE_GCPLEX_CONFIG_FUSE_0: 0x%x", val); 386 nvgpu_err(g, "FUSE_GCPLEX_CONFIG_FUSE_0: 0x%x", val);
387} 387}
388 388
389static bool gp10b_is_pmu_supported(struct gk20a *g) 389bool gp10b_is_pmu_supported(struct gk20a *g)
390{ 390{
391 return true; 391 return true;
392} 392}
393
394void gp10b_init_pmu_ops(struct gk20a *g)
395{
396 struct gpu_ops *gops = &g->ops;
397 gops->pmu.is_pmu_supported = gp10b_is_pmu_supported;
398 if (nvgpu_is_enabled(g, NVGPU_SEC_PRIVSECURITY)) {
399 gm20b_init_secure_pmu(gops);
400 gops->pmu.init_wpr_region = gm20b_pmu_init_acr;
401 gops->pmu.load_lsfalcon_ucode = gp10b_load_falcon_ucode;
402 gops->pmu.is_lazy_bootstrap = gp10b_is_lazy_bootstrap;
403 gops->pmu.is_priv_load = gp10b_is_priv_load;
404 } else {
405 gk20a_init_pmu_ops(gops);
406 gops->pmu.load_lsfalcon_ucode = NULL;
407 gops->pmu.init_wpr_region = NULL;
408 gops->pmu.pmu_setup_hw_and_bootstrap = gp10b_init_pmu_setup_hw1;
409 }
410 gops->pmu.pmu_setup_elpg = gp10b_pmu_setup_elpg;
411 gops->pmu.pmu_get_queue_head = pwr_pmu_queue_head_r;
412 gops->pmu.pmu_get_queue_head_size = pwr_pmu_queue_head__size_1_v;
413 gops->pmu.pmu_get_queue_tail = pwr_pmu_queue_tail_r;
414 gops->pmu.pmu_get_queue_tail_size = pwr_pmu_queue_tail__size_1_v;
415 gops->pmu.pmu_queue_head = gk20a_pmu_queue_head;
416 gops->pmu.pmu_queue_tail = gk20a_pmu_queue_tail;
417 gops->pmu.pmu_msgq_tail = gk20a_pmu_msgq_tail;
418 gops->pmu.pmu_mutex_size = pwr_pmu_mutex__size_1_v;
419 gops->pmu.pmu_mutex_acquire = gk20a_pmu_mutex_acquire;
420 gops->pmu.pmu_mutex_release = gk20a_pmu_mutex_release;
421 g->pmu_lsf_pmu_wpr_init_done = false;
422 __nvgpu_set_enabled(g, NVGPU_PMU_FECS_BOOTSTRAP_DONE, false);
423 gops->pmu.write_dmatrfbase = gp10b_write_dmatrfbase;
424 gops->pmu.pmu_elpg_statistics = gp10b_pmu_elpg_statistics;
425 gops->pmu.pmu_pg_init_param = gp10b_pg_gr_init;
426 gops->pmu.pmu_pg_supported_engines_list = gk20a_pmu_pg_engines_list;
427 gops->pmu.pmu_pg_engines_feature_list = gk20a_pmu_pg_feature_list;
428 gops->pmu.pmu_is_lpwr_feature_supported = NULL;
429 gops->pmu.pmu_lpwr_enable_pg = NULL;
430 gops->pmu.pmu_lpwr_disable_pg = NULL;
431 gops->pmu.pmu_pg_param_post_init = NULL;
432 gops->pmu.dump_secure_fuses = pmu_dump_security_fuses_gp10b;
433 gops->pmu.reset_engine = gk20a_pmu_engine_reset;
434 gops->pmu.is_engine_in_reset = gk20a_pmu_is_engine_in_reset;
435}