Skip to contentSkip to conversation

drm/v3d: Fix perfmon build error/warning

PATCH Applied Tvrtko Ursulin 5 participants 6 messages Jun 4, 2024 – Jun 7, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/v3d: Fix perfmon build error/warning

From: Tvrtko Ursulin <[email protected]>

Move static const array into the source file to fix the "defined but not used" errors.

The fix is perhaps not the prettiest due hand crafting the array sizes in v3d_performance_counters.h, but I did add some build time asserts to validate the counts look sensible, so hopefully it is good enough for a quick fix.

Fixes 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions for V3D 4.2 and 7.1")
Cc Iago Toral Quiroga <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ashutosh Dixit <[email protected]>
---
 drivers/gpu/drm/v3d/v3d_drv.c                 |   4 +-
 drivers/gpu/drm/v3d/v3d_drv.h                 |   3 -
 drivers/gpu/drm/v3d/v3d_perfmon.c             | 204 +++++++++++++++++-
 .../gpu/drm/v3d/v3d_performance_counters.h    | 189 +---------------
 4 files changed, 205 insertions(+), 195 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +2 -2
index f7477488b1cc..a47f00b443d3 100644
@@ -299,9 +299,9 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
 
 	if (v3d->ver >= 71)
-		v3d->max_counters = ARRAY_SIZE(v3d_v71_performance_counters);
+		v3d->max_counters = V3D_V71_NUM_PERFCOUNTERS;
 	else if (v3d->ver >= 42)
-		v3d->max_counters = ARRAY_SIZE(v3d_v42_performance_counters);
+		v3d->max_counters = V3D_V42_NUM_PERFCOUNTERS;
 	else
 		v3d->max_counters = 0;
 
drivers/gpu/drm/v3d/v3d_drv.h +0 -3
index 556cbb400ba0..099b962bdfde 100644
@@ -351,9 +351,6 @@ struct v3d_timestamp_query {
 	struct drm_syncobj *syncobj;
 };
 
-/* Maximum number of performance counters supported by any version of V3D */
-#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
-
 /* Number of perfmons required to handle all supported performance counters */
 #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
 				      DRM_V3D_MAX_PERF_COUNTERS)
drivers/gpu/drm/v3d/v3d_perfmon.c +198 -6

219 lines not on this page · raw message

drivers/gpu/drm/v3d/v3d_performance_counters.h +5 -184

195 lines not on this page · raw message

Signature · 1 line
2.44.0
Reviewed-by on v1 1/1
#1 lore raw

Thanks for looking at ixing this Tvrtko.

Quoted 6 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Move static const array into the source file to fix the "defined but not
used" errors.

Quoted 8 lines

The fix is perhaps not the prettiest due hand crafting the array sizes
in v3d_performance_counters.h, but I did add some build time asserts to
validate the counts look sensible, so hopefully it is good enough for a
quick fix.

If we need this to go in ASAP I am fine with this patch as-is, so:

With that said, if we are still in time for a bit of iteration may I suggest that instead of hard-coding the counters we instead add helper functions in drivers/gpu/drm/v3d/v3d_perfmon.c that call ARRAY_SIZE on the corresponding array based on v3d->ver? It is fine if we prefer to merge this as-is and do this change later as a follow-up patch.

Iago

Quoted 775 lines
Fixes 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions

for V3D 4.2 and 7.1")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/Cc
: Maíra Canal <[email protected]>
Cc: Iago Toral Quiroga <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Ashutosh Dixit <[email protected]>
---
 drivers/gpu/drm/v3d/v3d_drv.c                 |   4 +- drivers/gpu/drm/v3d/v3d_drv.h                 |   3 - drivers/gpu/drm/v3d/v3d_perfmon.c             | 204
+++++++++++++++++-
 .../gpu/drm/v3d/v3d_performance_counters.h    | 189 +---------------

 4 files changed, 205 insertions(+), 195 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +0 -0
index f7477488b1cc..a47f00b443d3 100644
@@ -299,9 +299,9 @@ static int v3d_platform_drm_probe(struct
 platform_device *pdev)

  WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
  if (v3d->ver >= 71)

drivers/gpu/drm/v3d/v3d_drv.c +0 -1
-		v3d->max_counters =

ARRAY_SIZE(v3d_v71_performance_counters);

drivers/gpu/drm/v3d/v3d_drv.c +1 -0
+		v3d->max_counters = V3D_V71_NUM_PERFCOUNTERS;

  else if (v3d->ver >= 42)

drivers/gpu/drm/v3d/v3d_drv.c +0 -1
-		v3d->max_counters =

ARRAY_SIZE(v3d_v42_performance_counters);

drivers/gpu/drm/v3d/v3d_drv.c +1 -0
+		v3d->max_counters = V3D_V42_NUM_PERFCOUNTERS;

  else
  v3d->max_counters = 0;

drivers/gpu/drm/v3d/v3d_drv.h +0 -0
index 556cbb400ba0..099b962bdfde 100644
@@ -351,9 +351,6 @@ struct v3d_timestamp_query {
  	struct drm_syncobj *syncobj;
  };


-/* Maximum number of performance counters supported by any version of V3D */

drivers/gpu/drm/v3d/v3d_drv.h +0 -2
-#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
-

 /* Number of perfmons required to handle all supported performance counters */
 #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
        DRM_V3D_MAX_PERF_COUNTERS)

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -0
index 73e2bb8bdb7f..b7d0b02e1a95 100644
@@ -9,6 +9,192 @@
  #define V3D_PERFMONID_MIN	1
  #define V3D_PERFMONID_MAX	U32_MAX


+static const struct v3d_perf_counter_desc
v3d_v42_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with

all pixels having zero coverage"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads

with any pixels having non-zero coverage"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock

cycles for all QPUs"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading",

"[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU]

Total clock cycles for all QPUs executing valid instructions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total

clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU]

Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU]

Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture

cache misses (number of fetches from memory/L2cache)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total

clock cycles VDW is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total

clock cycles VCD is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading",

"[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-config-access", "[TMU] Total config

accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
+	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue

full stall"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
+	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
+	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
+	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read

accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +8 -0
+	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
+	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
+	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
+	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
+	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
+	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
+	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_perfmon.c +10 -0
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
+	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+};
+
+static const struct v3d_perf_counter_desc

v3d_v71_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"CORE", "core-active", "[CORE] Bin/Render/Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total

texture cache x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +6 -0
+	{"L2T", "L2T-local", "[L2T] Local mode access"},
+	{"L2T", "L2T-writeback", "[L2T] Writeback"},
+	{"L2T", "L2T-zero", "[L2T] Zero"},
+	{"L2T", "L2T-merge", "[L2T] Merge"},
+	{"L2T", "L2T-fill", "[L2T] Fill"},
+	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID

available"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID

available"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because

internal queue full"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because

writeback in flight"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill

pending for victim cache-line"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
+	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue

because hit queue is full"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because

waiting for data from SDRAM"},

drivers/gpu/drm/v3d/v3d_perfmon.c +5 -0
+	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all

slices)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all

slices)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_perfmon.c +9 -0
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
+	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
+	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum

outstanding read transactions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum

outstanding write transactions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles

due all threads waiting"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in

qcycles due instruction-cache miss"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing

shader instruction"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for

TMU"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for

TLB"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for

VPM"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles

waiting for uniforms"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for

SFU"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting

for any other reason (vary/W/Z)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+};
+

 void v3d_perfmon_get(struct v3d_perfmon *perfmon) {
  if (perfmon)

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -0
@@ -234,15 +420,21 @@ int v3d_perfmon_get_counter_ioctl(struct
 drm_device *dev, void *data,
  	if (req->counter >= v3d->max_counters)
  		return -EINVAL;

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -2
-	if (v3d->ver >= 71) {
-		WARN_ON(v3d->max_counters !=

ARRAY_SIZE(v3d_v71_performance_counters));

drivers/gpu/drm/v3d/v3d_perfmon.c +7 -0
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v42_performance_counters) !=
+		     V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v71_performance_counters) !=
+		     V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON((V3D_MAX_COUNTERS != V3D_V42_NUM_PERFCOUNTERS)

&&

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+		     (V3D_MAX_COUNTERS !=

V3D_V71_NUM_PERFCOUNTERS));

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+
+	if (v3d->ver >= 71)

  counter = &v3d_v71_performance_counters[req-

Quoted 1 line

counter];

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -2
-	} else if (v3d->ver >= 42) {
-		WARN_ON(v3d->max_counters !=

ARRAY_SIZE(v3d_v42_performance_counters));

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	else if (v3d->ver >= 42)

  counter = &v3d_v42_performance_counters[req-

Quoted 1 line

counter];

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -1
-	} else {
+	else

  return -EOPNOTSUPP;

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -1
-	}


  strscpy(req->name, counter->name, sizeof(req->name)); strscpy(req->category, counter->category, sizeof(req-

Quoted 1 line

category));

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -0
index 72822205ebdc..131b2909522a 100644
@@ -19,190 +19,11 @@ struct v3d_perf_counter_desc {
  	char description[256];
  };


-static const struct v3d_perf_counter_desc
v3d_v71_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"CORE", "core-active", "[CORE] Bin/Render/Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -3
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total

texture cache x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -6
-	{"L2T", "L2T-local", "[L2T] Local mode access"},
-	{"L2T", "L2T-writeback", "[L2T] Writeback"},
-	{"L2T", "L2T-zero", "[L2T] Zero"},
-	{"L2T", "L2T-merge", "[L2T] Merge"},
-	{"L2T", "L2T-fill", "[L2T] Fill"},
-	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID

available"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID

available"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because

internal queue full"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because

writeback in flight"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill

pending for victim cache-line"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
-	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue

because hit queue is full"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because

waiting for data from SDRAM"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -5
-	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all

slices)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all

slices)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -9
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -3
-	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
-	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
-	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum

outstanding read transactions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum

outstanding write transactions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles

due all threads waiting"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in

qcycles due instruction-cache miss"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing

shader instruction"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for

TMU"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for

TLB"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for

VPM"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles

waiting for uniforms"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for

SFU"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting

for any other reason (vary/W/Z)"},
-};

-static const struct v3d_perf_counter_desc
v3d_v42_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with

all pixels having zero coverage"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads

with any pixels having non-zero coverage"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock

cycles for all QPUs"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading",

"[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU]

Total clock cycles for all QPUs executing valid instructions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total

clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU]

Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU]

Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture

cache misses (number of fetches from memory/L2cache)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total

clock cycles VDW is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total

clock cycles VCD is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading",

"[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-config-access", "[TMU] Total config

accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
-	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue

full stall"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
-	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
-	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
-	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read

accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -8
-	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
-	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
-	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
-	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
-	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
-	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
-	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -10
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
-	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +4 -1
-};
+#define V3D_V42_NUM_PERFCOUNTERS (87)
+#define V3D_V71_NUM_PERFCOUNTERS (93)
+
+/* Maximum number of performance counters supported by any version

of V3D */
+#define V3D_MAX_COUNTERS (93)

 #endif

#2 lore raw

Hi,

Quoted 20 lines · Iago Toral

Thanks for looking at ixing this Tvrtko.

Quoted 6 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Move static const array into the source file to fix the "defined but not
used" errors.

Quoted 8 lines

The fix is perhaps not the prettiest due hand crafting the array sizes
in v3d_performance_counters.h, but I did add some build time asserts to
validate the counts look sensible, so hopefully it is good enough for a
quick fix.

If we need this to go in ASAP I am fine with this patch as-is, so:

Quoted 7 lines

With that said, if we are still in time for a bit of iteration may I suggest that instead of hard-coding the counters we instead add helper functions in drivers/gpu/drm/v3d/v3d_perfmon.c that call ARRAY_SIZE on the corresponding array based on v3d->ver? It is fine if we prefer to merge this as-is and do this change later as a follow-up patch.

This is blocking the merge from drm-misc-next into drm/next at the moment, so I'm going to merge this patch as is so I can send the PR tomorrow.

Your comment looks fine to me too, so feel free to send a follow-up patch to refine what's done here :)

Thanks!
Maxime

#3 lore raw
In reply to Iago Toral
Quoted 19 lines · Iago Toral

Thanks for looking at ixing this Tvrtko.

Quoted 6 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Move static const array into the source file to fix the "defined but not
used" errors.

Quoted 8 lines

The fix is perhaps not the prettiest due hand crafting the array sizes
in v3d_performance_counters.h, but I did add some build time asserts to
validate the counts look sensible, so hopefully it is good enough for a
quick fix.

If we need this to go in ASAP I am fine with this patch as-is, so:

Quoted 7 lines

With that said, if we are still in time for a bit of iteration may I suggest that instead of hard-coding the counters we instead add helper functions in drivers/gpu/drm/v3d/v3d_perfmon.c that call ARRAY_SIZE on the corresponding array based on v3d->ver? It is fine if we prefer to merge this as-is and do this change later as a follow-up patch.

I agree it isn't pretty and I was (and am) planning to see if things can be improved. The reason I gave up on a prettier solution in the original attempt is the the fact one array is statically sized (at build time) based on the max number of counters:

/* Number of perfmons required to handle all supported performance counters */ #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
                      DRM_V3D_MAX_PERF_COUNTERS)

struct v3d_performance_query {
    /* Performance monitor IDs for this query */
    u32 kperfmon_ids[V3D_MAX_PERFMONS];

So need to see how to untangle that and then perhaps even go a step further than the getters but move the whole perfmon init into v3d_perfmon.c.

Regards,

Tvrtko

Quoted 778 lines

Iago

Quoted 775 lines
Fixes 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions

for V3D 4.2 and 7.1")

Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/Cc
: Maíra Canal <[email protected]>
Cc: Iago Toral Quiroga <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Ashutosh Dixit <[email protected]>

---
  drivers/gpu/drm/v3d/v3d_drv.c                 |   4 +-
  drivers/gpu/drm/v3d/v3d_drv.h                 |   3 -
  drivers/gpu/drm/v3d/v3d_perfmon.c             | 204
+++++++++++++++++-
  .../gpu/drm/v3d/v3d_performance_counters.h    | 189 +---------------
  4 files changed, 205 insertions(+), 195 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +2 -2
index f7477488b1cc..a47f00b443d3 100644
@@ -299,9 +299,9 @@ static int v3d_platform_drm_probe(struct
 platform_device *pdev)
  	WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
 
  	if (v3d->ver >= 71)
-		v3d->max_counters =
 ARRAY_SIZE(v3d_v71_performance_counters);
+		v3d->max_counters = V3D_V71_NUM_PERFCOUNTERS;
  	else if (v3d->ver >= 42)
-		v3d->max_counters =
 ARRAY_SIZE(v3d_v42_performance_counters);
+		v3d->max_counters = V3D_V42_NUM_PERFCOUNTERS;

  else
  v3d->max_counters = 0;

drivers/gpu/drm/v3d/v3d_drv.h +0 -1
index 556cbb400ba0..099b962bdfde 100644
@@ -351,9 +351,6 @@ struct v3d_timestamp_query {
  	struct drm_syncobj *syncobj;
  };
 
-/* Maximum number of performance counters supported by any version

of V3D */

drivers/gpu/drm/v3d/v3d_drv.h +0 -2
-#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
-
  /* Number of perfmons required to handle all supported performance

counters */
 #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
        DRM_V3D_MAX_PERF_COUNTERS)

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
index 73e2bb8bdb7f..b7d0b02e1a95 100644
@@ -9,6 +9,192 @@
  #define V3D_PERFMONID_MIN	1
  #define V3D_PERFMONID_MAX	U32_MAX
 
+static const struct v3d_perf_counter_desc
 v3d_v42_performance_counters[] = {
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with

all pixels having zero coverage"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads

with any pixels having non-zero coverage"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock

cycles for all QPUs"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading",

"[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU]

Total clock cycles for all QPUs executing valid instructions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total

clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU]

Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU]

Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture

cache misses (number of fetches from memory/L2cache)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total

clock cycles VDW is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total

clock cycles VCD is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading",

"[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-config-access", "[TMU] Total config

accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
+	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue

full stall"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
+	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
+	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
+	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read

accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +8 -0
+	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
+	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
+	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
+	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +4 -0
+	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
+	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
+	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
+	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_perfmon.c +10 -0
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
+	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+};
+
+static const struct v3d_perf_counter_desc

v3d_v71_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"CORE", "core-active", "[CORE] Bin/Render/Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total

texture cache x4 access"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_perfmon.c +6 -0
+	{"L2T", "L2T-local", "[L2T] Local mode access"},
+	{"L2T", "L2T-writeback", "[L2T] Writeback"},
+	{"L2T", "L2T-zero", "[L2T] Zero"},
+	{"L2T", "L2T-merge", "[L2T] Merge"},
+	{"L2T", "L2T-fill", "[L2T] Fill"},
+	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID

available"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID

available"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because

internal queue full"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because

writeback in flight"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill

pending for victim cache-line"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
+	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue

because hit queue is full"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because

waiting for data from SDRAM"},

drivers/gpu/drm/v3d/v3d_perfmon.c +5 -0
+	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all

slices)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all

slices)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_perfmon.c +9 -0
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_perfmon.c +3 -0
+	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
+	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
+	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait

cycles"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum

outstanding read transactions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum

outstanding write transactions"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles

due all threads waiting"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in

qcycles due instruction-cache miss"},

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing

shader instruction"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for

TMU"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for

TLB"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for

VPM"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles

waiting for uniforms"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for

SFU"},

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting

for any other reason (vary/W/Z)"},

drivers/gpu/drm/v3d/v3d_perfmon.c +9 -2
+};
+
  void v3d_perfmon_get(struct v3d_perfmon *perfmon)
  {
  	if (perfmon)
@@ -234,15 +420,21 @@ int v3d_perfmon_get_counter_ioctl(struct
 drm_device *dev, void *data,
  	if (req->counter >= v3d->max_counters)
  		return -EINVAL;
 
-	if (v3d->ver >= 71) {
-		WARN_ON(v3d->max_counters !=
 ARRAY_SIZE(v3d_v71_performance_counters));
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v42_performance_counters) !=
+		     V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v71_performance_counters) !=
+		     V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON((V3D_MAX_COUNTERS != V3D_V42_NUM_PERFCOUNTERS)

&&

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+		     (V3D_MAX_COUNTERS !=

V3D_V71_NUM_PERFCOUNTERS));

drivers/gpu/drm/v3d/v3d_perfmon.c +2 -0
+
+	if (v3d->ver >= 71)
  		counter = &v3d_v71_performance_counters[req-
Quoted 1 line

counter];

drivers/gpu/drm/v3d/v3d_perfmon.c +0 -2
-	} else if (v3d->ver >= 42) {
-		WARN_ON(v3d->max_counters !=

ARRAY_SIZE(v3d_v42_performance_counters));

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -0
+	else if (v3d->ver >= 42)
  		counter = &v3d_v42_performance_counters[req-
Quoted 1 line

counter];

drivers/gpu/drm/v3d/v3d_perfmon.c +1 -2
-	} else {
+	else
  		return -EOPNOTSUPP;
-	}
 
  	strscpy(req->name, counter->name, sizeof(req->name));
  	strscpy(req->category, counter->category, sizeof(req-
Quoted 1 line

category));

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -7
index 72822205ebdc..131b2909522a 100644
@@ -19,190 +19,11 @@ struct v3d_perf_counter_desc {
  	char description[256];
  };
 
-static const struct v3d_perf_counter_desc
 v3d_v71_performance_counters[] = {
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"CORE", "core-active", "[CORE] Bin/Render/Compute active
 cycles"},
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread
 active cycles"},
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render
 thread active cycles"},
-	{"CORE", "compute-active-cycles", "[CORE] Compute active
 cycles"},
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -3
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled

cycles for x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total

texture cache x4 access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -6
-	{"L2T", "L2T-local", "[L2T] Local mode access"},
-	{"L2T", "L2T-writeback", "[L2T] Writeback"},
-	{"L2T", "L2T-zero", "[L2T] Zero"},
-	{"L2T", "L2T-merge", "[L2T] Merge"},
-	{"L2T", "L2T-fill", "[L2T] Fill"},
-	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID

available"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID

available"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because

internal queue full"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because

writeback in flight"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill

pending for victim cache-line"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
-	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue

because hit queue is full"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because

waiting for data from SDRAM"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -5
-	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all

slices)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all

slices)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -9
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -3
-	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
-	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
-	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum

outstanding read transactions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum

outstanding write transactions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles

due all threads waiting"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in

qcycles due instruction-cache miss"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing

shader instruction"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for

TMU"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for

TLB"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for

VPM"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles

waiting for uniforms"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for

SFU"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting

for any other reason (vary/W/Z)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-};
 
-static const struct v3d_perf_counter_desc

v3d_v42_performance_counters[] = {

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP]

Valid primitives that result in no rendered pixels, for all rendered tiles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid

primitives for all rendered tiles (primitives may be counted in more than one tile)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped

quads"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads

with no pixels passing the stencil test"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB]

Quads with no pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads

with any pixels passing the Z and stencil tests"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with

all pixels having zero coverage"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads

with any pixels having non-zero coverage"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads

with valid pixels written to colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB]

Primitives discarded by being outside the viewport"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives

that need clipping"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB]

Primitives that are discarded because they are reversed"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock

cycles for all QPUs"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading",

"[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading",

"[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU]

Total clock cycles for all QPUs executing valid instructions"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total

clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU]

Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU]

Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total

instruction cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total

instruction cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms

cache hits for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total

uniforms cache misses for all slices"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture

cache accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture

cache misses (number of fetches from memory/L2cache)"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total

clock cycles VDW is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total

clock cycles VCD is stalled waiting for VPM access"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread

active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache

hits"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading",

"[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading",

"[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives

binned"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by

watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch

0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write

stalls seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls

seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes

written seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes

read seen by watch 0"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by

watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch

1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write

stalls seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls

seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes

written seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes

read seen by watch 1"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB]

Partial quads written to the colour buffer"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TMU", "TMU-total-config-access", "[TMU] Total config

accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
-	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue

full stall"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render

thread active cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
-	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
-	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
-	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read

accesses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -8
-	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
-	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
-	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
-	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read

misses"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -4
-	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
-	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
-	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
-	{"CORE", "core-memory-writes", "[CORE] Total memory

writes"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -10
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words

written"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -1
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words

read"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +0 -2
-	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
-	{"CORE", "compute-active-cycles", "[CORE] Compute active

cycles"},

drivers/gpu/drm/v3d/v3d_performance_counters.h +4 -1
-};
+#define V3D_V42_NUM_PERFCOUNTERS (87)
+#define V3D_V71_NUM_PERFCOUNTERS (93)
+
+/* Maximum number of performance counters supported by any version

of V3D */
+#define V3D_MAX_COUNTERS (93)

 #endif

maintainer Applied
#4 lore raw

Re: (subset) [PATCH] drm/v3d: Fix perfmon build error/warning

In reply to Tvrtko Ursulin
Quoted 9 lines · Tvrtko Ursulin

Move static const array into the source file to fix the "defined but not used" errors.

The fix is perhaps not the prettiest due hand crafting the array sizes in v3d_performance_counters.h, but I did add some build time asserts to validate the counts look sensible, so hopefully it is good enough for a quick fix.

[...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

#5 lore raw
In reply to Tvrtko Ursulin
Quoted 10 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Move static const array into the source file to fix the "defined but not used" errors.

The fix is perhaps not the prettiest due hand crafting the array sizes in v3d_performance_counters.h, but I did add some build time asserts to validate the counts look sensible, so hopefully it is good enough for a quick fix.

Quoted 4 lines
Fixes 3cbcbe016c31 ("drm/v3d: Add Performance Counters descriptions for V3D 4.2 and 7.1")

I guess it's too late now, but \n missing before Cc: there.

BR,
Jani.

Quoted 465 lines
Cc Iago Toral Quiroga <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ashutosh Dixit <[email protected]>
---
 drivers/gpu/drm/v3d/v3d_drv.c                 |   4 +-
 drivers/gpu/drm/v3d/v3d_drv.h                 |   3 -
 drivers/gpu/drm/v3d/v3d_perfmon.c             | 204 +++++++++++++++++-
 .../gpu/drm/v3d/v3d_performance_counters.h    | 189 +---------------
 4 files changed, 205 insertions(+), 195 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +2 -2
index f7477488b1cc..a47f00b443d3 100644
@@ -299,9 +299,9 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
 	WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
 
 	if (v3d->ver >= 71)
-		v3d->max_counters = ARRAY_SIZE(v3d_v71_performance_counters);
+		v3d->max_counters = V3D_V71_NUM_PERFCOUNTERS;
 	else if (v3d->ver >= 42)
-		v3d->max_counters = ARRAY_SIZE(v3d_v42_performance_counters);
+		v3d->max_counters = V3D_V42_NUM_PERFCOUNTERS;
 	else
 		v3d->max_counters = 0;
 
drivers/gpu/drm/v3d/v3d_drv.h +0 -3
index 556cbb400ba0..099b962bdfde 100644
@@ -351,9 +351,6 @@ struct v3d_timestamp_query {
 	struct drm_syncobj *syncobj;
 };
 
-/* Maximum number of performance counters supported by any version of V3D */
-#define V3D_MAX_COUNTERS ARRAY_SIZE(v3d_v71_performance_counters)
-
 /* Number of perfmons required to handle all supported performance counters */
 #define V3D_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_COUNTERS, \
 				      DRM_V3D_MAX_PERF_COUNTERS)
drivers/gpu/drm/v3d/v3d_perfmon.c +198 -6
index 73e2bb8bdb7f..b7d0b02e1a95 100644
@@ -9,6 +9,192 @@
 #define V3D_PERFMONID_MIN	1
 #define V3D_PERFMONID_MAX	U32_MAX
 
+static const struct v3d_perf_counter_desc v3d_v42_performance_counters[] = {
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP] Valid primitives that result in no rendered pixels, for all rendered tiles"},
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid primitives for all rendered tiles (primitives may be counted in more than one tile)"},
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped quads"},
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads with no pixels passing the stencil test"},
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB] Quads with no pixels passing the Z and stencil tests"},
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads with any pixels passing the Z and stencil tests"},
+	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with all pixels having zero coverage"},
+	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads with any pixels having non-zero coverage"},
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads with valid pixels written to colour buffer"},
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB] Primitives discarded by being outside the viewport"},
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives that need clipping"},
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB] Primitives that are discarded because they are reversed"},
+	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock cycles for all QPUs"},
+	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading", "[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading", "[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},
+	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU] Total clock cycles for all QPUs executing valid instructions"},
+	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},
+	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU] Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},
+	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU] Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total instruction cache hits for all slices"},
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total instruction cache misses for all slices"},
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms cache hits for all slices"},
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total uniforms cache misses for all slices"},
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture cache accesses"},
+	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture cache misses (number of fetches from memory/L2cache)"},
+	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total clock cycles VDW is stalled waiting for VPM access"},
+	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total clock cycles VCD is stalled waiting for VPM access"},
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread active cycles"},
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render thread active cycles"},
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache hits"},
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache misses"},
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading", "[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading", "[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives binned"},
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by watch 0"},
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch 0"},
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write stalls seen by watch 0"},
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls seen by watch 0"},
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes written seen by watch 0"},
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes read seen by watch 0"},
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by watch 1"},
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch 1"},
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write stalls seen by watch 1"},
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls seen by watch 1"},
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes written seen by watch 1"},
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes read seen by watch 1"},
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB] Partial quads written to the colour buffer"},
+	{"TMU", "TMU-total-config-access", "[TMU] Total config accesses"},
+	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
+	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue full stall"},
+	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render thread active cycles"},
+	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
+	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
+	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
+	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read accesses"},
+	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
+	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
+	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
+	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read misses"},
+	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
+	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
+	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
+	{"CORE", "core-memory-writes", "[CORE] Total memory writes"},
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words written"},
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words written"},
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words read"},
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words read"},
+	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
+	{"CORE", "compute-active-cycles", "[CORE] Compute active cycles"},
+};
+
+static const struct v3d_perf_counter_desc v3d_v71_performance_counters[] = {
+	{"CORE", "cycle-count", "[CORE] Cycle counter"},
+	{"CORE", "core-active", "[CORE] Bin/Render/Compute active cycles"},
+	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread active cycles"},
+	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render thread active cycles"},
+	{"CORE", "compute-active-cycles", "[CORE] Compute active cycles"},
+	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP] Valid primitives that result in no rendered pixels, for all rendered tiles"},
+	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid primitives for all rendered tiles (primitives may be counted in more than one tile)"},
+	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped quads"},
+	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
+	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads with no pixels passing the stencil test"},
+	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB] Quads with no pixels passing the Z and stencil tests"},
+	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads with any pixels passing the Z and stencil tests"},
+	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads with valid pixels written to colour buffer"},
+	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB] Partial quads written to the colour buffer"},
+	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives that need clipping"},
+	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB] Primitives discarded by being outside the viewport"},
+	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives binned"},
+	{"PTB", "PTB-primitives-discarded-reversed", "[PTB] Primitives that are discarded because they are reversed"},
+	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total instruction cache hits for all slices"},
+	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total instruction cache misses for all slices"},
+	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms cache hits for all slices"},
+	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total uniforms cache misses for all slices"},
+	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
+	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
+	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture cache accesses"},
+	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active cycles for x4 access"},
+	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled cycles for x4 access"},
+	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total texture cache x4 access"},
+	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache hits"},
+	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache misses"},
+	{"L2T", "L2T-local", "[L2T] Local mode access"},
+	{"L2T", "L2T-writeback", "[L2T] Writeback"},
+	{"L2T", "L2T-zero", "[L2T] Zero"},
+	{"L2T", "L2T-merge", "[L2T] Merge"},
+	{"L2T", "L2T-fill", "[L2T] Fill"},
+	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID available"},
+	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID available"},
+	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because internal queue full"},
+	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because writeback in flight"},
+	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks read"},
+	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill pending for victim cache-line"},
+	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
+	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue because hit queue is full"},
+	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because waiting for data from SDRAM"},
+	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
+	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
+	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
+	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
+	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all slices)"},
+	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all slices)"},
+	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by watch 0"},
+	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch 0"},
+	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write stalls seen by watch 0"},
+	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls seen by watch 0"},
+	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes written seen by watch 0"},
+	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes read seen by watch 0"},
+	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by watch 1"},
+	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch 1"},
+	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write stalls seen by watch 1"},
+	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls seen by watch 1"},
+	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes written seen by watch 1"},
+	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes read seen by watch 1"},
+	{"CORE", "core-memory-writes", "[CORE] Total memory writes"},
+	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
+	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
+	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
+	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
+	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
+	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
+	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
+	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
+	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words written"},
+	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words written"},
+	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words read"},
+	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words read"},
+	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
+	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
+	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait cycles"},
+	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait cycles"},
+	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum outstanding read transactions"},
+	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum outstanding write transactions"},
+	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles due all threads waiting"},
+	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in qcycles due instruction-cache miss"},
+	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
+	{"QPU", "QPU-total-active-clk-cycles-fragment-shading", "[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},
+	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing shader instruction"},
+	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading", "[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},
+	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for TMU"},
+	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for TLB"},
+	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for VPM"},
+	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles waiting for uniforms"},
+	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for SFU"},
+	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting for any other reason (vary/W/Z)"},
+};
+
 void v3d_perfmon_get(struct v3d_perfmon *perfmon)
 {
 	if (perfmon)
@@ -234,15 +420,21 @@ int v3d_perfmon_get_counter_ioctl(struct drm_device *dev, void *data,
 	if (req->counter >= v3d->max_counters)
 		return -EINVAL;
 
-	if (v3d->ver >= 71) {
-		WARN_ON(v3d->max_counters != ARRAY_SIZE(v3d_v71_performance_counters));
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v42_performance_counters) !=
+		     V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(ARRAY_SIZE(v3d_v71_performance_counters) !=
+		     V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V42_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON(V3D_MAX_COUNTERS < V3D_V71_NUM_PERFCOUNTERS);
+	BUILD_BUG_ON((V3D_MAX_COUNTERS != V3D_V42_NUM_PERFCOUNTERS) &&
+		     (V3D_MAX_COUNTERS != V3D_V71_NUM_PERFCOUNTERS));
+
+	if (v3d->ver >= 71)
 		counter = &v3d_v71_performance_counters[req->counter];
-	} else if (v3d->ver >= 42) {
-		WARN_ON(v3d->max_counters != ARRAY_SIZE(v3d_v42_performance_counters));
+	else if (v3d->ver >= 42)
 		counter = &v3d_v42_performance_counters[req->counter];
-	} else {
+	else
 		return -EOPNOTSUPP;
-	}
 
 	strscpy(req->name, counter->name, sizeof(req->name));
 	strscpy(req->category, counter->category, sizeof(req->category));
drivers/gpu/drm/v3d/v3d_performance_counters.h +5 -184
index 72822205ebdc..131b2909522a 100644
@@ -19,190 +19,11 @@ struct v3d_perf_counter_desc {
 	char description[256];
 };
 
-static const struct v3d_perf_counter_desc v3d_v71_performance_counters[] = {
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"CORE", "core-active", "[CORE] Bin/Render/Compute active cycles"},
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread active cycles"},
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render thread active cycles"},
-	{"CORE", "compute-active-cycles", "[CORE] Compute active cycles"},
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP] Valid primitives that result in no rendered pixels, for all rendered tiles"},
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid primitives for all rendered tiles (primitives may be counted in more than one tile)"},
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped quads"},
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads with no pixels passing the stencil test"},
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB] Quads with no pixels passing the Z and stencil tests"},
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads with any pixels passing the Z and stencil tests"},
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads with valid pixels written to colour buffer"},
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB] Partial quads written to the colour buffer"},
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives that need clipping"},
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB] Primitives discarded by being outside the viewport"},
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives binned"},
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB] Primitives that are discarded because they are reversed"},
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total instruction cache hits for all slices"},
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total instruction cache misses for all slices"},
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms cache hits for all slices"},
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total uniforms cache misses for all slices"},
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture cache accesses"},
-	{"TMU", "TMU-cache-x4-active-cycles", "[TMU] Cache active cycles for x4 access"},
-	{"TMU", "TMU-cache-x4-stalled-cycles", "[TMU] Cache stalled cycles for x4 access"},
-	{"TMU", "TMU-total-text-quads-x4-access", "[TMU] Total texture cache x4 access"},
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache hits"},
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache misses"},
-	{"L2T", "L2T-local", "[L2T] Local mode access"},
-	{"L2T", "L2T-writeback", "[L2T] Writeback"},
-	{"L2T", "L2T-zero", "[L2T] Zero"},
-	{"L2T", "L2T-merge", "[L2T] Merge"},
-	{"L2T", "L2T-fill", "[L2T] Fill"},
-	{"L2T", "L2T-stalls-no-wid", "[L2T] Stalls because no WID available"},
-	{"L2T", "L2T-stalls-no-rid", "[L2T] Stalls because no RID available"},
-	{"L2T", "L2T-stalls-queue-full", "[L2T] Stalls because internal queue full"},
-	{"L2T", "L2T-stalls-wrightback", "[L2T] Stalls because writeback in flight"},
-	{"L2T", "L2T-stalls-mem", "[L2T] Stalls because AXI blocks read"},
-	{"L2T", "L2T-stalls-fill", "[L2T] Stalls because fill pending for victim cache-line"},
-	{"L2T", "L2T-hitq", "[L2T] Sent request via hit queue"},
-	{"L2T", "L2T-hitq-full", "[L2T] Sent request via main queue because hit queue is full"},
-	{"L2T", "L2T-stalls-read-data", "[L2T] Stalls because waiting for data from SDRAM"},
-	{"L2T", "L2T-TMU-read-hits", "[L2T] TMU read hits"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-VCD-read-hits", "[L2T] VCD read hits"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-SLC-read-hits", "[L2T] SLC read hits (all slices)"},
-	{"L2T", "L2T-SLC-read-miss", "[L2T] SLC read misses (all slices)"},
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by watch 0"},
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch 0"},
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write stalls seen by watch 0"},
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls seen by watch 0"},
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes written seen by watch 0"},
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes read seen by watch 0"},
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by watch 1"},
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch 1"},
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write stalls seen by watch 1"},
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls seen by watch 1"},
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes written seen by watch 1"},
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes read seen by watch 1"},
-	{"CORE", "core-memory-writes", "[CORE] Total memory writes"},
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words written"},
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words written"},
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words read"},
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words read"},
-	{"AXI", "AXI-read-trans", "[AXI] Read transaction count"},
-	{"AXI", "AXI-write-trans", "[AXI] Write transaction count"},
-	{"AXI", "AXI-read-wait-cycles", "[AXI] Read total wait cycles"},
-	{"AXI", "AXI-write-wait-cycles", "[AXI] Write total wait cycles"},
-	{"AXI", "AXI-max-outstanding-reads", "[AXI] Maximum outstanding read transactions"},
-	{"AXI", "AXI-max-outstanding-writes", "[AXI] Maximum outstanding write transactions"},
-	{"QPU", "QPU-wait-bubble", "[QPU] Pipeline bubble in qcycles due all threads waiting"},
-	{"QPU", "QPU-ic-miss-bubble", "[QPU] Pipeline bubble in qcycles due instruction-cache miss"},
-	{"QPU", "QPU-active", "[QPU] Executed shader instruction"},
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading", "[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},
-	{"QPU", "QPU-stalls", "[QPU] Stalled qcycles executing shader instruction"},
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading", "[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},
-	{"QPU", "QPU-stalls-TMU", "[QPU] Stalled qcycles waiting for TMU"},
-	{"QPU", "QPU-stalls-TLB", "[QPU] Stalled qcycles waiting for TLB"},
-	{"QPU", "QPU-stalls-VPM", "[QPU] Stalled qcycles waiting for VPM"},
-	{"QPU", "QPU-stalls-uniforms", "[QPU] Stalled qcycles waiting for uniforms"},
-	{"QPU", "QPU-stalls-SFU", "[QPU] Stalled qcycles waiting for SFU"},
-	{"QPU", "QPU-stalls-other", "[QPU] Stalled qcycles waiting for any other reason (vary/W/Z)"},
-};
 
-static const struct v3d_perf_counter_desc v3d_v42_performance_counters[] = {
-	{"FEP", "FEP-valid-primitives-no-rendered-pixels", "[FEP] Valid primitives that result in no rendered pixels, for all rendered tiles"},
-	{"FEP", "FEP-valid-primitives-rendered-pixels", "[FEP] Valid primitives for all rendered tiles (primitives may be counted in more than one tile)"},
-	{"FEP", "FEP-clipped-quads", "[FEP] Early-Z/Near/Far clipped quads"},
-	{"FEP", "FEP-valid-quads", "[FEP] Valid quads"},
-	{"TLB", "TLB-quads-not-passing-stencil-test", "[TLB] Quads with no pixels passing the stencil test"},
-	{"TLB", "TLB-quads-not-passing-z-and-stencil-test", "[TLB] Quads with no pixels passing the Z and stencil tests"},
-	{"TLB", "TLB-quads-passing-z-and-stencil-test", "[TLB] Quads with any pixels passing the Z and stencil tests"},
-	{"TLB", "TLB-quads-with-zero-coverage", "[TLB] Quads with all pixels having zero coverage"},
-	{"TLB", "TLB-quads-with-non-zero-coverage", "[TLB] Quads with any pixels having non-zero coverage"},
-	{"TLB", "TLB-quads-written-to-color-buffer", "[TLB] Quads with valid pixels written to colour buffer"},
-	{"PTB", "PTB-primitives-discarded-outside-viewport", "[PTB] Primitives discarded by being outside the viewport"},
-	{"PTB", "PTB-primitives-need-clipping", "[PTB] Primitives that need clipping"},
-	{"PTB", "PTB-primitives-discarded-reversed", "[PTB] Primitives that are discarded because they are reversed"},
-	{"QPU", "QPU-total-idle-clk-cycles", "[QPU] Total idle clock cycles for all QPUs"},
-	{"QPU", "QPU-total-active-clk-cycles-vertex-coord-shading", "[QPU] Total active clock cycles for all QPUs doing vertex/coordinate/user shading (counts only when QPU is not stalled)"},
-	{"QPU", "QPU-total-active-clk-cycles-fragment-shading", "[QPU] Total active clock cycles for all QPUs doing fragment shading (counts only when QPU is not stalled)"},
-	{"QPU", "QPU-total-clk-cycles-executing-valid-instr", "[QPU] Total clock cycles for all QPUs executing valid instructions"},
-	{"QPU", "QPU-total-clk-cycles-waiting-TMU", "[QPU] Total clock cycles for all QPUs stalled waiting for TMUs only (counter won't increment if QPU also stalling for another reason)"},
-	{"QPU", "QPU-total-clk-cycles-waiting-scoreboard", "[QPU] Total clock cycles for all QPUs stalled waiting for Scoreboard only (counter won't increment if QPU also stalling for another reason)"},
-	{"QPU", "QPU-total-clk-cycles-waiting-varyings", "[QPU] Total clock cycles for all QPUs stalled waiting for Varyings only (counter won't increment if QPU also stalling for another reason)"},
-	{"QPU", "QPU-total-instr-cache-hit", "[QPU] Total instruction cache hits for all slices"},
-	{"QPU", "QPU-total-instr-cache-miss", "[QPU] Total instruction cache misses for all slices"},
-	{"QPU", "QPU-total-uniform-cache-hit", "[QPU] Total uniforms cache hits for all slices"},
-	{"QPU", "QPU-total-uniform-cache-miss", "[QPU] Total uniforms cache misses for all slices"},
-	{"TMU", "TMU-total-text-quads-access", "[TMU] Total texture cache accesses"},
-	{"TMU", "TMU-total-text-cache-miss", "[TMU] Total texture cache misses (number of fetches from memory/L2cache)"},
-	{"VPM", "VPM-total-clk-cycles-VDW-stalled", "[VPM] Total clock cycles VDW is stalled waiting for VPM access"},
-	{"VPM", "VPM-total-clk-cycles-VCD-stalled", "[VPM] Total clock cycles VCD is stalled waiting for VPM access"},
-	{"CLE", "CLE-bin-thread-active-cycles", "[CLE] Bin thread active cycles"},
-	{"CLE", "CLE-render-thread-active-cycles", "[CLE] Render thread active cycles"},
-	{"L2T", "L2T-total-cache-hit", "[L2T] Total Level 2 cache hits"},
-	{"L2T", "L2T-total-cache-miss", "[L2T] Total Level 2 cache misses"},
-	{"CORE", "cycle-count", "[CORE] Cycle counter"},
-	{"QPU", "QPU-total-clk-cycles-waiting-vertex-coord-shading", "[QPU] Total stalled clock cycles for all QPUs doing vertex/coordinate/user shading"},
-	{"QPU", "QPU-total-clk-cycles-waiting-fragment-shading", "[QPU] Total stalled clock cycles for all QPUs doing fragment shading"},
-	{"PTB", "PTB-primitives-binned", "[PTB] Total primitives binned"},
-	{"AXI", "AXI-writes-seen-watch-0", "[AXI] Writes seen by watch 0"},
-	{"AXI", "AXI-reads-seen-watch-0", "[AXI] Reads seen by watch 0"},
-	{"AXI", "AXI-writes-stalled-seen-watch-0", "[AXI] Write stalls seen by watch 0"},
-	{"AXI", "AXI-reads-stalled-seen-watch-0", "[AXI] Read stalls seen by watch 0"},
-	{"AXI", "AXI-write-bytes-seen-watch-0", "[AXI] Total bytes written seen by watch 0"},
-	{"AXI", "AXI-read-bytes-seen-watch-0", "[AXI] Total bytes read seen by watch 0"},
-	{"AXI", "AXI-writes-seen-watch-1", "[AXI] Writes seen by watch 1"},
-	{"AXI", "AXI-reads-seen-watch-1", "[AXI] Reads seen by watch 1"},
-	{"AXI", "AXI-writes-stalled-seen-watch-1", "[AXI] Write stalls seen by watch 1"},
-	{"AXI", "AXI-reads-stalled-seen-watch-1", "[AXI] Read stalls seen by watch 1"},
-	{"AXI", "AXI-write-bytes-seen-watch-1", "[AXI] Total bytes written seen by watch 1"},
-	{"AXI", "AXI-read-bytes-seen-watch-1", "[AXI] Total bytes read seen by watch 1"},
-	{"TLB", "TLB-partial-quads-written-to-color-buffer", "[TLB] Partial quads written to the colour buffer"},
-	{"TMU", "TMU-total-config-access", "[TMU] Total config accesses"},
-	{"L2T", "L2T-no-id-stalled", "[L2T] No ID stall"},
-	{"L2T", "L2T-command-queue-stalled", "[L2T] Command queue full stall"},
-	{"L2T", "L2T-TMU-writes", "[L2T] TMU write accesses"},
-	{"TMU", "TMU-active-cycles", "[TMU] Active cycles"},
-	{"TMU", "TMU-stalled-cycles", "[TMU] Stalled cycles"},
-	{"CLE", "CLE-thread-active-cycles", "[CLE] Bin or render thread active cycles"},
-	{"L2T", "L2T-TMU-reads", "[L2T] TMU read accesses"},
-	{"L2T", "L2T-CLE-reads", "[L2T] CLE read accesses"},
-	{"L2T", "L2T-VCD-reads", "[L2T] VCD read accesses"},
-	{"L2T", "L2T-TMU-config-reads", "[L2T] TMU CFG read accesses"},
-	{"L2T", "L2T-SLC0-reads", "[L2T] SLC0 read accesses"},
-	{"L2T", "L2T-SLC1-reads", "[L2T] SLC1 read accesses"},
-	{"L2T", "L2T-SLC2-reads", "[L2T] SLC2 read accesses"},
-	{"L2T", "L2T-TMU-write-miss", "[L2T] TMU write misses"},
-	{"L2T", "L2T-TMU-read-miss", "[L2T] TMU read misses"},
-	{"L2T", "L2T-CLE-read-miss", "[L2T] CLE read misses"},
-	{"L2T", "L2T-VCD-read-miss", "[L2T] VCD read misses"},
-	{"L2T", "L2T-TMU-config-read-miss", "[L2T] TMU CFG read misses"},
-	{"L2T", "L2T-SLC0-read-miss", "[L2T] SLC0 read misses"},
-	{"L2T", "L2T-SLC1-read-miss", "[L2T] SLC1 read misses"},
-	{"L2T", "L2T-SLC2-read-miss", "[L2T] SLC2 read misses"},
-	{"CORE", "core-memory-writes", "[CORE] Total memory writes"},
-	{"L2T", "L2T-memory-writes", "[L2T] Total memory writes"},
-	{"PTB", "PTB-memory-writes", "[PTB] Total memory writes"},
-	{"TLB", "TLB-memory-writes", "[TLB] Total memory writes"},
-	{"CORE", "core-memory-reads", "[CORE] Total memory reads"},
-	{"L2T", "L2T-memory-reads", "[L2T] Total memory reads"},
-	{"PTB", "PTB-memory-reads", "[PTB] Total memory reads"},
-	{"PSE", "PSE-memory-reads", "[PSE] Total memory reads"},
-	{"TLB", "TLB-memory-reads", "[TLB] Total memory reads"},
-	{"GMP", "GMP-memory-reads", "[GMP] Total memory reads"},
-	{"PTB", "PTB-memory-words-writes", "[PTB] Total memory words written"},
-	{"TLB", "TLB-memory-words-writes", "[TLB] Total memory words written"},
-	{"PSE", "PSE-memory-words-reads", "[PSE] Total memory words read"},
-	{"TLB", "TLB-memory-words-reads", "[TLB] Total memory words read"},
-	{"TMU", "TMU-MRU-hits", "[TMU] Total MRU hits"},
-	{"CORE", "compute-active-cycles", "[CORE] Compute active cycles"},
-};
+#define V3D_V42_NUM_PERFCOUNTERS (87)
+#define V3D_V71_NUM_PERFCOUNTERS (93)
+
+/* Maximum number of performance counters supported by any version of V3D */
+#define V3D_MAX_COUNTERS (93)
 
 #endif
Signature · 1 line
Jani Nikula, Intel