From 75d7d6826dea130d5eb5ac86f1ca54bd9b05fbe1 Mon Sep 17 00:00:00 2001 From: Deepak Goyal Date: Sun, 2 Jul 2017 08:19:29 +0530 Subject: 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 Reviewed-on: https://git-master/r/1510036 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/pmu_ipc.c | 4 +++- drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/pmu') 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 @@ * more details. */ +#include #include #include #include @@ -844,7 +845,8 @@ int nvgpu_pmu_process_message(struct nvgpu_pmu *pmu) nvgpu_pmu_process_init_msg(pmu, &msg); if (g->ops.pmu.init_wpr_region != NULL) g->ops.pmu.init_wpr_region(g); - nvgpu_pmu_init_perfmon(pmu); + if (nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) + nvgpu_pmu_init_perfmon(pmu); return 0; } 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 @@ * more details. */ +#include #include #include #include @@ -60,6 +61,9 @@ int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu) struct pmu_payload payload; u32 seq; + if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) + return 0; + nvgpu_log_fn(g, " "); pmu->perfmon_ready = 0; @@ -126,6 +130,9 @@ int nvgpu_pmu_perfmon_start_sampling(struct nvgpu_pmu *pmu) struct pmu_payload payload; u32 seq; + if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) + return 0; + /* PERFMON Start */ memset(&cmd, 0, sizeof(struct pmu_cmd)); cmd.hdr.unit_id = get_perfmon_id(pmu); @@ -172,6 +179,9 @@ int nvgpu_pmu_perfmon_stop_sampling(struct nvgpu_pmu *pmu) struct pmu_cmd cmd; u32 seq; + if (!nvgpu_is_enabled(g, NVGPU_PMU_PERFMON)) + return 0; + /* PERFMON Stop */ memset(&cmd, 0, sizeof(struct pmu_cmd)); cmd.hdr.unit_id = get_perfmon_id(pmu); -- cgit v1.2.2