Skip to contentSkip to conversation

etnaviv: perfmon: fix total and idle HI cyleces readout

PATCH Applied Christian Gmeiner 2 participants 2 messages Jul 31, 2019 – Aug 9, 2019

Subsystems (2)
lore
Share & tools
lore

Christian Gmeiner

author reviewer
#0 lore raw

PATCH 1/1 etnaviv: perfmon: fix total and idle HI cyleces readout

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

---
 drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 44 +++++++++++++++++------
 1 file changed, 33 insertions(+), 11 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +33 -11
index 06e6d3ee1c34..3c74b1273ea9 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2017 Zodiac Inflight Innovations
  */
 
+#include "common.xml.h"
 #include "etnaviv_gpu.h"
 #include "etnaviv_perfmon.h"
 #include "state_hi.xml.h"
@@ -35,13 +36,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)
@@ -75,6 +69,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",
@@ -84,13 +106,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",
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Applied
#1 lore raw

Am Mittwoch, den 31.07.2019, 23:30 +0200 schrieb Christian Gmeiner:

Quoted 4 lines

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

Thanks, applied.

Regards,
Lucas

Quoted 85 lines

---
 drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 44 +++++++++++++++++--
----

 1 file changed, 33 insertions(+), 11 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +0 -0
index 06e6d3ee1c34..3c74b1273ea9 100644
@@ -4,6 +4,7 @@
   * Copyright (C) 2017 Zodiac Inflight Innovations
   */


+#include "common.xml.h"
 #include "etnaviv_gpu.h"
 #include "etnaviv_perfmon.h"
 #include "state_hi.xml.h"

drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +0 -0
@@ -35,13 +36,6 @@ struct etnaviv_pm_domain_meta {
  	u32 nr_domains;
  };

drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +0 -7
-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)

drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +0 -0
@@ -75,6 +69,34 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu,
  	return value;
  }

drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +28 -0
+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",

drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +4 -4
@@ -84,13 +106,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
  			},
  			{
Quoted 1 line

  "AXI_CYCLES_READ_REQUEST_STALLED",

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel