Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
Subject: [PATCH v2 i-g-t] tests/intel/xe_oa: Extend non-zero-reason test
Date: Thu, 16 Jan 2025 16:54:24 -0800	[thread overview]
Message-ID: <20250117005424.3038122-1-ashutosh.dixit@intel.com> (raw)

From: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>

Extend non-zero-reason test to use configurable OA buffer sizes and
execute the test for three different sizes 8,16 and 32MB.

v2 (Ashutosh):
  - Define and use __for_one_hwe_in_oag_w_arg
  - Introduce and use 'oau' variable at igt_main scope for parsing
    capabilities

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
---
 tests/intel/xe_oa.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 492a6b5d64..8d2ebcdcaa 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -2504,7 +2504,7 @@ again_1:
  * Description: Test reason field is non-zero. Can also check OA buffer wraparound issues
  */
 static void
-test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe)
+test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_buffer_size)
 {
 	/* ~20 micro second period */
 	int oa_exponent = max_oa_exponent_for_period_lte(20000);
@@ -2522,6 +2522,7 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe)
 		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(fmt),
 		DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT, oa_exponent,
 		DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, hwe->engine_instance,
+		DRM_XE_OA_PROPERTY_OA_BUFFER_SIZE, oa_buffer_size,
 	};
 	struct intel_xe_oa_open_prop param = {
 		.num_properties = ARRAY_SIZE(properties) / 2,
@@ -2541,6 +2542,9 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe)
 	load_helper_init();
 	load_helper_run(HIGH);
 
+	if (!oa_buffer_size)
+		param.num_properties = param.num_properties - 1;
+
 	stream_fd = __perf_open(drm_fd, &param, true /* prevent_pm */);
         set_fd_flags(stream_fd, O_CLOEXEC);
 
@@ -4762,6 +4766,11 @@ static const char *xe_engine_class_name(uint32_t engine_class)
 		igt_dynamic_f("%s-%d", xe_engine_class_name(hwe->engine_class), \
 			      hwe->engine_instance)
 
+#define __for_one_hwe_in_oag_w_arg(hwe, str) \
+	if ((hwe = oa_unit_engine(drm_fd, 0))) \
+		igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class), \
+			      hwe->engine_instance, str)
+
 #define __for_one_render_engine_0(hwe) \
 	xe_for_each_engine(drm_fd, hwe) \
 		if (hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER) \
@@ -4796,6 +4805,7 @@ igt_main
 		{ NULL },
 	};
 	struct drm_xe_engine_class_instance *hwe = NULL;
+	struct drm_xe_oa_unit *oau;
 	struct xe_device *xe_dev;
 
 	igt_fixture {
@@ -4825,6 +4835,7 @@ igt_main
 
 		/* See xe_query_oa_units_new() */
 		igt_require(xe_dev->oa_units);
+		oau = nth_oa_unit(drm_fd, 0);
 
 		devid = intel_get_drm_devid(drm_fd);
 		sysfs = igt_sysfs_open(drm_fd);
@@ -4867,8 +4878,19 @@ igt_main
 			test_buffer_fill(hwe);
 
 	igt_subtest_with_dynamic("non-zero-reason") {
-		__for_one_hwe_in_oag(hwe)
-			test_non_zero_reason(hwe);
+		if (oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE) {
+			__for_one_hwe_in_oag_w_arg(hwe, "8M")
+				test_non_zero_reason(hwe, SZ_8M);
+
+			__for_one_hwe_in_oag_w_arg(hwe, "16M")
+				test_non_zero_reason(hwe, SZ_16M);
+
+			__for_one_hwe_in_oag_w_arg(hwe, "32M")
+				test_non_zero_reason(hwe, SZ_32M);
+		} else {
+			__for_one_hwe_in_oag_w_arg(hwe, "default")
+				test_non_zero_reason(hwe, 0);
+		}
 	}
 
 	igt_subtest("disabled-read-error")
@@ -4999,9 +5021,6 @@ igt_main
 
 	igt_subtest_group {
 		igt_fixture {
-			struct drm_xe_query_oa_units *qoa = xe_oa_units(drm_fd);
-			struct drm_xe_oa_unit *oau = (struct drm_xe_oa_unit *)&qoa->oa_units[0];
-
 			igt_require(oau->capabilities & DRM_XE_OA_CAPS_SYNCS);
 		}
 
-- 
2.47.1


             reply	other threads:[~2025-01-17  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17  0:54 Ashutosh Dixit [this message]
2025-01-17  7:47 ` ✓ i915.CI.BAT: success for tests/intel/xe_oa: Extend non-zero-reason test Patchwork
2025-01-17  8:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-17 14:24 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-18 13:46 ` ✗ i915.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250117005424.3038122-1-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=sai.teja.pottumuttu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox