diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 68 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | 17 |
3 files changed, 12 insertions, 78 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 78e33a49..96711c0c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -609,8 +609,9 @@ static void gk20a_remove_support(struct platform_device *dev) | |||
609 | { | 609 | { |
610 | struct gk20a *g = get_gk20a(dev); | 610 | struct gk20a *g = get_gk20a(dev); |
611 | 611 | ||
612 | /* pmu support should already be removed when driver turns off | 612 | if (g->pmu.remove_support) |
613 | gpu power rail in prepapre_poweroff */ | 613 | g->pmu.remove_support(&g->pmu); |
614 | |||
614 | if (g->gk20a_cdev.gk20a_cooling_dev) | 615 | if (g->gk20a_cdev.gk20a_cooling_dev) |
615 | thermal_cooling_device_unregister(g->gk20a_cdev.gk20a_cooling_dev); | 616 | thermal_cooling_device_unregister(g->gk20a_cdev.gk20a_cooling_dev); |
616 | 617 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index bd7546b3..9b8602c5 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -1493,61 +1493,11 @@ static int pmu_queue_close(struct pmu_gk20a *pmu, | |||
1493 | return 0; | 1493 | return 0; |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | static void gk20a_save_pmu_sw_state(struct pmu_gk20a *pmu, | ||
1497 | struct gk20a_pmu_save_state *save) | ||
1498 | { | ||
1499 | save->seq = pmu->seq; | ||
1500 | save->next_seq_desc = pmu->next_seq_desc; | ||
1501 | save->mutex = pmu->mutex; | ||
1502 | save->mutex_cnt = pmu->mutex_cnt; | ||
1503 | save->desc = pmu->desc; | ||
1504 | save->ucode = pmu->ucode; | ||
1505 | save->elpg_enable = pmu->elpg_enable; | ||
1506 | save->pg_wq = pmu->pg_wq; | ||
1507 | save->seq_buf = pmu->seq_buf; | ||
1508 | save->pg_buf = pmu->pg_buf; | ||
1509 | save->sw_ready = pmu->sw_ready; | ||
1510 | save->pg_init = pmu->pg_init; | ||
1511 | save->perfmon_events_cnt = pmu->perfmon_events_cnt; | ||
1512 | save->perfmon_sampling_enabled = pmu->perfmon_sampling_enabled; | ||
1513 | } | ||
1514 | |||
1515 | static void gk20a_restore_pmu_sw_state(struct pmu_gk20a *pmu, | ||
1516 | struct gk20a_pmu_save_state *save) | ||
1517 | { | ||
1518 | pmu->seq = save->seq; | ||
1519 | pmu->next_seq_desc = save->next_seq_desc; | ||
1520 | pmu->mutex = save->mutex; | ||
1521 | pmu->mutex_cnt = save->mutex_cnt; | ||
1522 | pmu->desc = save->desc; | ||
1523 | pmu->ucode = save->ucode; | ||
1524 | pmu->elpg_enable = save->elpg_enable; | ||
1525 | pmu->pg_wq = save->pg_wq; | ||
1526 | pmu->seq_buf = save->seq_buf; | ||
1527 | pmu->pg_buf = save->pg_buf; | ||
1528 | pmu->sw_ready = save->sw_ready; | ||
1529 | pmu->pg_init = save->pg_init; | ||
1530 | pmu->perfmon_events_cnt = save->perfmon_events_cnt; | ||
1531 | pmu->perfmon_sampling_enabled = save->perfmon_sampling_enabled; | ||
1532 | } | ||
1533 | |||
1534 | void gk20a_remove_pmu_support(struct pmu_gk20a *pmu) | 1496 | void gk20a_remove_pmu_support(struct pmu_gk20a *pmu) |
1535 | { | 1497 | { |
1536 | struct gk20a_pmu_save_state save; | ||
1537 | |||
1538 | gk20a_dbg_fn(""); | 1498 | gk20a_dbg_fn(""); |
1539 | 1499 | ||
1540 | gk20a_allocator_destroy(&pmu->dmem); | 1500 | gk20a_allocator_destroy(&pmu->dmem); |
1541 | |||
1542 | /* Save the stuff you don't want to lose */ | ||
1543 | gk20a_save_pmu_sw_state(pmu, &save); | ||
1544 | |||
1545 | /* this function is also called by pmu_destory outside gk20a deinit that | ||
1546 | releases gk20a struct so fill up with zeros here. */ | ||
1547 | memset(pmu, 0, sizeof(struct pmu_gk20a)); | ||
1548 | |||
1549 | /* Restore stuff you want to keep */ | ||
1550 | gk20a_restore_pmu_sw_state(pmu, &save); | ||
1551 | } | 1501 | } |
1552 | 1502 | ||
1553 | int gk20a_init_pmu_reset_enable_hw(struct gk20a *g) | 1503 | int gk20a_init_pmu_reset_enable_hw(struct gk20a *g) |
@@ -2356,10 +2306,11 @@ static int pmu_process_init_msg(struct pmu_gk20a *pmu, | |||
2356 | for (i = 0; i < PMU_QUEUE_COUNT; i++) | 2306 | for (i = 0; i < PMU_QUEUE_COUNT; i++) |
2357 | pmu_queue_init(pmu, i, init); | 2307 | pmu_queue_init(pmu, i, init); |
2358 | 2308 | ||
2359 | gk20a_allocator_init(&pmu->dmem, "gk20a_pmu_dmem", | 2309 | if (!pmu->dmem.alloc) |
2360 | pv->get_pmu_init_msg_pmu_sw_mg_off(init), | 2310 | gk20a_allocator_init(&pmu->dmem, "gk20a_pmu_dmem", |
2361 | pv->get_pmu_init_msg_pmu_sw_mg_size(init), | 2311 | pv->get_pmu_init_msg_pmu_sw_mg_off(init), |
2362 | PMU_DMEM_ALLOC_ALIGNMENT); | 2312 | pv->get_pmu_init_msg_pmu_sw_mg_size(init), |
2313 | PMU_DMEM_ALLOC_ALIGNMENT); | ||
2363 | 2314 | ||
2364 | pmu->pmu_ready = true; | 2315 | pmu->pmu_ready = true; |
2365 | 2316 | ||
@@ -3438,11 +3389,10 @@ int gk20a_pmu_destroy(struct gk20a *g) | |||
3438 | g->pg_gating_cnt += gating_cnt; | 3389 | g->pg_gating_cnt += gating_cnt; |
3439 | 3390 | ||
3440 | pmu_enable(pmu, false); | 3391 | pmu_enable(pmu, false); |
3441 | 3392 | pmu->pmu_ready = false; | |
3442 | if (pmu->remove_support) { | 3393 | pmu->perfmon_ready = false; |
3443 | pmu->remove_support(pmu); | 3394 | pmu->zbc_ready = false; |
3444 | pmu->remove_support = NULL; | 3395 | pmu->elpg_ready = false; |
3445 | } | ||
3446 | 3396 | ||
3447 | gk20a_dbg_fn("done"); | 3397 | gk20a_dbg_fn("done"); |
3448 | return 0; | 3398 | return 0; |
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h index 488558fe..e7a839d4 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | |||
@@ -1053,23 +1053,6 @@ struct pmu_gk20a { | |||
1053 | bool perfmon_sampling_enabled; | 1053 | bool perfmon_sampling_enabled; |
1054 | }; | 1054 | }; |
1055 | 1055 | ||
1056 | struct gk20a_pmu_save_state { | ||
1057 | struct pmu_sequence *seq; | ||
1058 | u32 next_seq_desc; | ||
1059 | struct pmu_mutex *mutex; | ||
1060 | u32 mutex_cnt; | ||
1061 | struct pmu_ucode_desc *desc; | ||
1062 | struct pmu_mem_desc ucode; | ||
1063 | struct pmu_mem_desc seq_buf; | ||
1064 | struct pmu_mem_desc pg_buf; | ||
1065 | struct delayed_work elpg_enable; | ||
1066 | wait_queue_head_t pg_wq; | ||
1067 | bool sw_ready; | ||
1068 | struct work_struct pg_init; | ||
1069 | unsigned long perfmon_events_cnt; | ||
1070 | bool perfmon_sampling_enabled; | ||
1071 | }; | ||
1072 | |||
1073 | int gk20a_init_pmu_support(struct gk20a *g); | 1056 | int gk20a_init_pmu_support(struct gk20a *g); |
1074 | int gk20a_init_pmu_setup_hw2(struct gk20a *g); | 1057 | int gk20a_init_pmu_setup_hw2(struct gk20a *g); |
1075 | 1058 | ||