gpu: nvgpu: pmu: check before initializing perfmon

We should check if perfmon is enabled before sending
perfmon init command. This is needed for debug purposes.

Change-Id: Ia95a590a76074c469b5d87a5820cd5b2e50d13be
Signed-off-by: Deepak Goyal <dgoyal@nvidia.com>
Reviewed-on: https://git-master/r/1510036
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Goyal
2017-07-02 08:19:29 +05:30
committed by mobile promotions
parent 4166fc2f87
commit 75d7d6826d
8 changed files with 30 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
*
*/
#include <nvgpu/enabled.h>
#include "debug_pmu.h"
#include "gk20a/platform_gk20a.h"
@@ -348,10 +349,12 @@ static ssize_t perfmon_events_enable_write(struct file *file,
if (err)
return err;
if (val && !g->pmu.perfmon_sampling_enabled) {
if (val && !g->pmu.perfmon_sampling_enabled &&
nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) {
g->pmu.perfmon_sampling_enabled = true;
nvgpu_pmu_perfmon_start_sampling(&(g->pmu));
} else if (!val && g->pmu.perfmon_sampling_enabled) {
} else if (!val && g->pmu.perfmon_sampling_enabled &&
nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) {
g->pmu.perfmon_sampling_enabled = false;
nvgpu_pmu_perfmon_stop_sampling(&(g->pmu));
}

View File

@@ -124,6 +124,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g));
g->can_railgate = platform->can_railgate_init;
g->railgate_delay = platform->railgate_delay_init;
__nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, platform->enable_perfmon);
/* set default values to aelpg parameters */
g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;

View File

@@ -920,6 +920,7 @@ struct gk20a_platform gm20b_tegra_platform = {
.enable_elcg = true,
.enable_elpg = true,
.enable_aelpg = true,
.enable_perfmon = true,
.ptimer_src_freq = 19200000,
.force_reset_in_do_idle = false,

View File

@@ -377,6 +377,7 @@ struct gk20a_platform gp10b_tegra_platform = {
.enable_slcg = true,
.enable_elcg = true,
.enable_aelpg = true,
.enable_perfmon = true,
/* ptimer src frequency in hz*/
.ptimer_src_freq = 31250000,