All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [i-g-t, V2] tests/i915/gem_exec_balancer: bonding support check in invalid-balancer
@ 2021-12-14 12:51 Tejas Upadhyay
  0 siblings, 0 replies; only message in thread
From: Tejas Upadhyay @ 2021-12-14 12:51 UTC (permalink / raw)
  To: igt-dev

Bonding is disabled on GEN12+ platforms, except ones already
supported by the i915 - TGL, RKL, and ADL-S.

Currently few tests are failing for same reason, with this
change they should rightly skip with proper message.

Reference: https://cgit.freedesktop.org/drm-tip/commit/?id=ce7e75c7ef1bf8ea3d947da8c674d2f40fd7d734

Changes since V1 :
	- use function to check bonding capability so that
	  we dont skip whole test in case bonding not supported.

Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
---
 tests/i915/gem_exec_balancer.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c
index d58734ab..ab095899 100644
--- a/tests/i915/gem_exec_balancer.c
+++ b/tests/i915/gem_exec_balancer.c
@@ -180,6 +180,33 @@ __set_param_fresh_context(int i915, struct drm_i915_gem_context_param param)
 	return err;
 }
 
+static bool has_bonding(int i915)
+{
+        I915_DEFINE_CONTEXT_ENGINES_BOND(bonds[16], 1);
+        I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1);
+        struct drm_i915_gem_context_param p = {
+                .param = I915_CONTEXT_PARAM_ENGINES,
+                .value = to_user_pointer(&engines),
+                .size = sizeof(engines),
+        };
+        int ret;
+
+	memset(&engines, 0, sizeof(engines));
+	igt_assert_eq(__set_param_fresh_context(i915, p), 0);
+
+	memset(bonds, 0, sizeof(bonds));
+        for (int n = 0; n < ARRAY_SIZE(bonds); n++) {
+                bonds[n].base.name = I915_CONTEXT_ENGINES_EXT_BOND;
+                bonds[n].base.next_extension =
+                        n ? to_user_pointer(&bonds[n - 1]) : 0;
+                bonds[n].num_bonds = 1;
+        }
+        engines.extensions = to_user_pointer(&bonds);
+        ret = __set_param_fresh_context(i915, p);
+
+	return ret == -ENODEV ? false : true;
+}
+
 static void invalid_balancer(int i915)
 {
 	I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(balancer, 64);
@@ -191,6 +218,7 @@ static void invalid_balancer(int i915)
 	};
 	uint32_t handle;
 	void *ptr;
+	bool bonding = false;
 
 	/*
 	 * Assume that I915_CONTEXT_PARAM_ENGINE validates the array
@@ -198,6 +226,7 @@ static void invalid_balancer(int i915)
 	 * extension explodes.
 	 */
 
+	bonding = has_bonding(i915);
 	for (int class = 0; class < 32; class++) {
 		struct i915_engine_class_instance *ci;
 		unsigned int count;
@@ -299,7 +328,7 @@ static void invalid_balancer(int i915)
 
 		munmap(ptr + 4096, 4096);
 
-		if (count >= 2) {
+		if (count >= 2 && bonding) {
 			/* You can't bond to a balanced engine */
 			memset(&bond, 0, sizeof(bond));
 			bond.base.name = I915_CONTEXT_ENGINES_EXT_BOND;
-- 
2.31.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-14 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 12:51 [igt-dev] [i-g-t, V2] tests/i915/gem_exec_balancer: bonding support check in invalid-balancer Tejas Upadhyay

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.