summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorDeepak Goyal <dgoyal@nvidia.com>2017-07-01 22:49:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-06 08:44:32 -0400
commit75d7d6826dea130d5eb5ac86f1ca54bd9b05fbe1 (patch)
tree3a309b2d70caca4f73b78c73ad380d07c5d11ac2 /drivers/gpu/nvgpu/common
parent4166fc2f87ca4254b5e0c1433c810a83676d029a (diff)
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>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_pmu.c7
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c1
-rw-r--r--drivers/gpu/nvgpu/common/pmu/pmu_ipc.c4
-rw-r--r--drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c10
6 files changed, 21 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/debug_pmu.c b/drivers/gpu/nvgpu/common/linux/debug_pmu.c
index 0d364fe7..8c3607b5 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_pmu.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_pmu.c
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14 14
15#include <nvgpu/enabled.h>
15#include "debug_pmu.h" 16#include "debug_pmu.h"
16#include "gk20a/platform_gk20a.h" 17#include "gk20a/platform_gk20a.h"
17 18
@@ -348,10 +349,12 @@ static ssize_t perfmon_events_enable_write(struct file *file,
348 if (err) 349 if (err)
349 return err; 350 return err;
350 351
351 if (val && !g->pmu.perfmon_sampling_enabled) { 352 if (val && !g->pmu.perfmon_sampling_enabled &&
353 nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) {
352 g->pmu.perfmon_sampling_enabled = true; 354 g->pmu.perfmon_sampling_enabled = true;
353 nvgpu_pmu_perfmon_start_sampling(&(g->pmu)); 355 nvgpu_pmu_perfmon_start_sampling(&(g->pmu));
354 } else if (!val && g->pmu.perfmon_sampling_enabled) { 356 } else if (!val && g->pmu.perfmon_sampling_enabled &&
357 nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) {
355 g->pmu.perfmon_sampling_enabled = false; 358 g->pmu.perfmon_sampling_enabled = false;
356 nvgpu_pmu_perfmon_stop_sampling(&(g->pmu)); 359 nvgpu_pmu_perfmon_stop_sampling(&(g->pmu));
357 } 360 }
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index b12917d6..4e2cb2b4 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -124,6 +124,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
124 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); 124 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g));
125 g->can_railgate = platform->can_railgate_init; 125 g->can_railgate = platform->can_railgate_init;
126 g->railgate_delay = platform->railgate_delay_init; 126 g->railgate_delay = platform->railgate_delay_init;
127 __nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, platform->enable_perfmon);
127 128
128 /* set default values to aelpg parameters */ 129 /* set default values to aelpg parameters */
129 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US; 130 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
index 2c1709ea..000e9eee 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
@@ -920,6 +920,7 @@ struct gk20a_platform gm20b_tegra_platform = {
920 .enable_elcg = true, 920 .enable_elcg = true,
921 .enable_elpg = true, 921 .enable_elpg = true,
922 .enable_aelpg = true, 922 .enable_aelpg = true,
923 .enable_perfmon = true,
923 .ptimer_src_freq = 19200000, 924 .ptimer_src_freq = 19200000,
924 925
925 .force_reset_in_do_idle = false, 926 .force_reset_in_do_idle = false,
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index 61b8053f..83d3634c 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -377,6 +377,7 @@ struct gk20a_platform gp10b_tegra_platform = {
377 .enable_slcg = true, 377 .enable_slcg = true,
378 .enable_elcg = true, 378 .enable_elcg = true,
379 .enable_aelpg = true, 379 .enable_aelpg = true,
380 .enable_perfmon = true,
380 381
381 /* ptimer src frequency in hz*/ 382 /* ptimer src frequency in hz*/
382 .ptimer_src_freq = 31250000, 383 .ptimer_src_freq = 31250000,
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
index 352e525f..0dbc2df3 100644
--- a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
+++ b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
@@ -11,6 +11,7 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/enabled.h>
14#include <nvgpu/pmu.h> 15#include <nvgpu/pmu.h>
15#include <nvgpu/log.h> 16#include <nvgpu/log.h>
16#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h> 17#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
@@ -844,7 +845,8 @@ int nvgpu_pmu_process_message(struct nvgpu_pmu *pmu)
844 nvgpu_pmu_process_init_msg(pmu, &msg); 845 nvgpu_pmu_process_init_msg(pmu, &msg);
845 if (g->ops.pmu.init_wpr_region != NULL) 846 if (g->ops.pmu.init_wpr_region != NULL)
846 g->ops.pmu.init_wpr_region(g); 847 g->ops.pmu.init_wpr_region(g);
847 nvgpu_pmu_init_perfmon(pmu); 848 if (nvgpu_is_enabled(g, NVGPU_PMU_PERFMON))
849 nvgpu_pmu_init_perfmon(pmu);
848 850
849 return 0; 851 return 0;
850 } 852 }
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c
index f87bd175..34678e34 100644
--- a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c
+++ b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c
@@ -11,6 +11,7 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/enabled.h>
14#include <nvgpu/pmu.h> 15#include <nvgpu/pmu.h>
15#include <nvgpu/log.h> 16#include <nvgpu/log.h>
16#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h> 17#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
@@ -60,6 +61,9 @@ int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu)
60 struct pmu_payload payload; 61 struct pmu_payload payload;
61 u32 seq; 62 u32 seq;
62 63
64 if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON))
65 return 0;
66
63 nvgpu_log_fn(g, " "); 67 nvgpu_log_fn(g, " ");
64 68
65 pmu->perfmon_ready = 0; 69 pmu->perfmon_ready = 0;
@@ -126,6 +130,9 @@ int nvgpu_pmu_perfmon_start_sampling(struct nvgpu_pmu *pmu)
126 struct pmu_payload payload; 130 struct pmu_payload payload;
127 u32 seq; 131 u32 seq;
128 132
133 if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON))
134 return 0;
135
129 /* PERFMON Start */ 136 /* PERFMON Start */
130 memset(&cmd, 0, sizeof(struct pmu_cmd)); 137 memset(&cmd, 0, sizeof(struct pmu_cmd));
131 cmd.hdr.unit_id = get_perfmon_id(pmu); 138 cmd.hdr.unit_id = get_perfmon_id(pmu);
@@ -172,6 +179,9 @@ int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu)
172 struct pmu_cmd cmd; 179 struct pmu_cmd cmd;
173 u32 seq; 180 u32 seq;
174 181
182 if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON))
183 return 0;
184
175 /* PERFMON Stop */ 185 /* PERFMON Stop */
176 memset(&cmd, 0, sizeof(struct pmu_cmd)); 186 memset(&cmd, 0, sizeof(struct pmu_cmd));
177 cmd.hdr.unit_id = get_perfmon_id(pmu); 187 cmd.hdr.unit_id = get_perfmon_id(pmu);