From e0dbf3a784f6cb1a6e1c41a23123b19ec73b8708 Mon Sep 17 00:00:00 2001 From: Deepak Goyal Date: Thu, 18 Jan 2018 11:44:47 +0530 Subject: gpu: nvgpu: gv11b: Enable perfmon. t19x PMU ucode uses RPC mechanism for PERFMON commands. - Declared "pmu_init_perfmon", "pmu_perfmon_start_sampling", "pmu_perfmon_stop_sampling" and "pmu_perfmon_get_samples" in pmu ops to differenciate for chips using RPC & legacy cmd/msg mechanism. - Defined and used PERFMON RPC commands for t19x - INIT - START - STOP - QUERY - Adds RPC handler for PERFMON RPC commands. - For guerying GPU utilization/load, we need to send PERFMON_QUERY RPC command for gv11b. - Enables perfmon for gv11b. Bug 2039013 Change-Id: Ic32326f81d48f11bc772afb8fee2dee6e427a699 Signed-off-by: Deepak Goyal Reviewed-on: https://git-master.nvidia.com/r/1614114 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu Tested-by: Seshendra Gadagottu Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/debug_pmu.c | 4 ++-- drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c | 1 + drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c | 3 +++ drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/debug_pmu.c b/drivers/gpu/nvgpu/common/linux/debug_pmu.c index ec997e28..a8a8870e 100644 --- a/drivers/gpu/nvgpu/common/linux/debug_pmu.c +++ b/drivers/gpu/nvgpu/common/linux/debug_pmu.c @@ -352,11 +352,11 @@ static ssize_t perfmon_events_enable_write(struct file *file, 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)); + g->ops.pmu.pmu_perfmon_start_sampling(&(g->pmu)); } 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)); + g->ops.pmu.pmu_perfmon_stop_sampling(&(g->pmu)); } gk20a_idle(g); } else { diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c index d972b88a..a452896f 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c @@ -208,6 +208,7 @@ struct gk20a_platform t19x_gpu_tegra_platform = { .can_slcg = false, .can_blcg = false, .can_elcg = false, + .enable_perfmon = true, /* power management callbacks */ .suspend = gv11b_tegra_suspend, diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c index d5fd5102..3f99eb9e 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c @@ -417,6 +417,9 @@ static const struct gpu_ops vgpu_gp10b_ops = { .pmu_mutex_release = gk20a_pmu_mutex_release, .write_dmatrfbase = gp10b_write_dmatrfbase, .pmu_elpg_statistics = gp10b_pmu_elpg_statistics, + .pmu_init_perfmon = nvgpu_pmu_init_perfmon, + .pmu_perfmon_start_sampling = nvgpu_pmu_perfmon_start_sampling, + .pmu_perfmon_stop_sampling = nvgpu_pmu_perfmon_stop_sampling, .pmu_pg_init_param = gp10b_pg_gr_init, .pmu_pg_supported_engines_list = gk20a_pmu_pg_engines_list, .pmu_pg_engines_feature_list = gk20a_pmu_pg_feature_list, diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c index 132ce6e5..c8752f91 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c @@ -461,6 +461,10 @@ static const struct gpu_ops vgpu_gv11b_ops = { .pmu_mutex_release = gk20a_pmu_mutex_release, .write_dmatrfbase = gp10b_write_dmatrfbase, .pmu_elpg_statistics = gp106_pmu_elpg_statistics, + .pmu_init_perfmon = nvgpu_pmu_init_perfmon_rpc, + .pmu_perfmon_start_sampling = nvgpu_pmu_perfmon_start_sampling_rpc, + .pmu_perfmon_stop_sampling = nvgpu_pmu_perfmon_stop_sampling_rpc, + .pmu_perfmon_get_samples_rpc = nvgpu_pmu_perfmon_get_samples_rpc, .pmu_pg_init_param = gv11b_pg_gr_init, .pmu_pg_supported_engines_list = gk20a_pmu_pg_engines_list, .pmu_pg_engines_feature_list = gk20a_pmu_pg_feature_list, -- cgit v1.2.2