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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux