[Intel-gfx] [PATCH i-g-t] tests/perf: fix userspace configs issues on HSW

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Aug 7 17:20:27 UTC 2017


We don't have flex eu counters on HSW, so don't try to program for
thoses.

Reported-by: CI \o/
Fixes: 609cb5e30b4 ("tests/perf: add tests to verify create/destroy userspace configs")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 tests/perf.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/tests/perf.c b/tests/perf.c
index 95d898ee..89f69b4b 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -4197,12 +4197,17 @@ test_create_destroy_userspace_config(void)
 
 	config.n_mux_regs = 1;
 	config.mux_regs_ptr = to_user_pointer(mux_regs);
-	for (i = 0; i < ARRAY_SIZE(flex_regs) / 2; i++) {
-		flex_regs[i * 2] = 0xe458; /* EU_PERF_CNTL0 */
-		flex_regs[i * 2 + 1] = 0x0;
+
+	/* Flex EU counters are only available on gen8+ */
+	if (intel_gen(devid) >= 8) {
+		for (i = 0; i < ARRAY_SIZE(flex_regs) / 2; i++) {
+			flex_regs[i * 2] = 0xe458; /* EU_PERF_CNTL0 */
+			flex_regs[i * 2 + 1] = 0x0;
+		}
+		config.flex_regs_ptr = to_user_pointer(flex_regs);
+		config.n_flex_regs = ARRAY_SIZE(flex_regs) / 2;
 	}
-	config.flex_regs_ptr = to_user_pointer(flex_regs);
-	config.n_flex_regs = ARRAY_SIZE(flex_regs) / 2;
+
 	config.n_boolean_regs = 0;
 
 	/* Creating configs without permissions shouldn't work. */
@@ -4283,13 +4288,15 @@ test_whitelisted_registers_userspace_config(void)
 	}
 	config.boolean_regs_ptr = (uintptr_t) b_counters_regs;
 
-	/* Flex EU registers */
-	for (i = 0; i < ARRAY_SIZE(flex); i++) {
-		flex_regs[config.n_flex_regs * 2] = flex[i];
-		flex_regs[config.n_flex_regs * 2 + 1] = 0;
-		config.n_flex_regs++;
+	if (intel_gen(devid) >= 8) {
+		/* Flex EU registers, only from Gen8+. */
+		for (i = 0; i < ARRAY_SIZE(flex); i++) {
+			flex_regs[config.n_flex_regs * 2] = flex[i];
+			flex_regs[config.n_flex_regs * 2 + 1] = 0;
+			config.n_flex_regs++;
+		}
+		config.flex_regs_ptr = (uintptr_t) flex_regs;
 	}
-	config.flex_regs_ptr = (uintptr_t) flex_regs;
 
 	/* Mux registers (too many of them, just checking bounds) */
 	i = 0;
-- 
2.13.3



More information about the Intel-gfx mailing list