summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/debug_pmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/debug_pmu.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_pmu.c7
1 files changed, 5 insertions, 2 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 }