]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
etnaviv: perfmon: fix total and idle HI cyleces readout
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 31 Jul 2019 21:30:34 +0000 (23:30 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 29 Apr 2020 12:56:15 +0000 (14:56 +0200)
BugLink: https://bugs.launchpad.net/bugs/1874502
[ Upstream commit 15ff4a7b584163b12b118a2c381529f05ff3a94d ]

As seen at CodeAurora's linux-imx git repo in imx_4.19.35_1.0.0 branch.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c

index e16b4db58a668bc60167f050710275e4a3da739c..57010aabf97b5fdbcdcfb3016a0f9a5d479c6ae7 100644 (file)
@@ -48,13 +48,6 @@ struct etnaviv_pm_domain_meta {
        u32 nr_domains;
 };
 
-static u32 simple_reg_read(struct etnaviv_gpu *gpu,
-       const struct etnaviv_pm_domain *domain,
-       const struct etnaviv_pm_signal *signal)
-{
-       return gpu_read(gpu, signal->data);
-}
-
 static u32 perf_reg_read(struct etnaviv_gpu *gpu,
        const struct etnaviv_pm_domain *domain,
        const struct etnaviv_pm_signal *signal)
@@ -88,6 +81,34 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu,
        return value;
 }
 
+static u32 hi_total_cycle_read(struct etnaviv_gpu *gpu,
+       const struct etnaviv_pm_domain *domain,
+       const struct etnaviv_pm_signal *signal)
+{
+       u32 reg = VIVS_HI_PROFILE_TOTAL_CYCLES;
+
+       if (gpu->identity.model == chipModel_GC880 ||
+               gpu->identity.model == chipModel_GC2000 ||
+               gpu->identity.model == chipModel_GC2100)
+               reg = VIVS_MC_PROFILE_CYCLE_COUNTER;
+
+       return gpu_read(gpu, reg);
+}
+
+static u32 hi_total_idle_cycle_read(struct etnaviv_gpu *gpu,
+       const struct etnaviv_pm_domain *domain,
+       const struct etnaviv_pm_signal *signal)
+{
+       u32 reg = VIVS_HI_PROFILE_IDLE_CYCLES;
+
+       if (gpu->identity.model == chipModel_GC880 ||
+               gpu->identity.model == chipModel_GC2000 ||
+               gpu->identity.model == chipModel_GC2100)
+               reg = VIVS_HI_PROFILE_TOTAL_CYCLES;
+
+       return gpu_read(gpu, reg);
+}
+
 static const struct etnaviv_pm_domain doms_3d[] = {
        {
                .name = "HI",
@@ -97,13 +118,13 @@ static const struct etnaviv_pm_domain doms_3d[] = {
                .signal = (const struct etnaviv_pm_signal[]) {
                        {
                                "TOTAL_CYCLES",
-                               VIVS_HI_PROFILE_TOTAL_CYCLES,
-                               &simple_reg_read
+                               0,
+                               &hi_total_cycle_read
                        },
                        {
                                "IDLE_CYCLES",
-                               VIVS_HI_PROFILE_IDLE_CYCLES,
-                               &simple_reg_read
+                               0,
+                               &hi_total_idle_cycle_read
                        },
                        {
                                "AXI_CYCLES_READ_REQUEST_STALLED",