All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: [PATCH i-g-t 08/18] tests/intel/xe_oa: Convert several more tests to take OA unit arguments
Date: Mon, 13 Oct 2025 13:30:31 -0700	[thread overview]
Message-ID: <20251013203042.925115-9-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20251013203042.925115-1-ashutosh.dixit@intel.com>

Convert the following tests to take 'struct drm_xe_oa_unit *'
arguments (instead of hwe), to enable these to be run on all OA units:

- test_oa_exponents
- test_buffer_fill
- test_enable_disable
- test_oa_tlb_invalidate
- test_stress_open_close
- test_tail_address_wrap

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 tests/intel/xe_oa.c | 60 ++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 22cc4e8b9b..7c87dfc5f4 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -1906,9 +1906,9 @@ static bool expected_report_timing_delta(uint32_t delta, uint32_t expected_delta
  * SUBTEST: oa-exponents
  * Description: Test that oa exponent values behave as expected
  */
-static void test_oa_exponents(const struct drm_xe_engine_class_instance *hwe)
+static void test_oa_exponents(struct drm_xe_oa_unit *oau)
 {
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 	uint64_t fmt = test_set->perf_oa_format;
 
 	load_helper_init();
@@ -1920,7 +1920,7 @@ static void test_oa_exponents(const struct drm_xe_engine_class_instance *hwe)
 	 */
 	for (int exponent = min_oa_exponent; exponent < max_oa_exponent; exponent++) {
 		uint64_t properties[] = {
-			DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+			DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 
 			/* Include OA reports in samples */
 			DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
@@ -2536,11 +2536,11 @@ num_valid_reports_captured(struct intel_xe_oa_open_prop *param,
  * Description: Open OA stream twice to verify OA TLB invalidation
  */
 static void
-test_oa_tlb_invalidate(const struct drm_xe_engine_class_instance *hwe)
+test_oa_tlb_invalidate(struct drm_xe_oa_unit *oau)
 {
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 	uint64_t properties[] = {
-		DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+		DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 		DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
 
 		DRM_XE_OA_PROPERTY_OA_METRIC_SET, test_set->perf_oa_metrics_set,
@@ -2594,15 +2594,15 @@ wait_for_oa_buffer_overflow(int fd, int poll_period_us)
  * Description: Test filling and overflow of OA buffer
  */
 static void
-test_buffer_fill(const struct drm_xe_engine_class_instance *hwe)
+test_buffer_fill(struct drm_xe_oa_unit *oau)
 {
 	/* ~5 micro second period */
 	int oa_exponent = max_oa_exponent_for_period_lte(5000);
 	uint64_t oa_period = oa_exponent_to_ns(oa_exponent);
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 	uint64_t fmt = test_set->perf_oa_format;
 	uint64_t properties[] = {
-		DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+		DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 
 		/* Include OA reports in samples */
 		DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
@@ -2734,13 +2734,13 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_b
  * Description: Test that OA stream enable/disable works as expected
  */
 static void
-test_enable_disable(const struct drm_xe_engine_class_instance *hwe)
+test_enable_disable(struct drm_xe_oa_unit *oau)
 {
 	uint32_t num_reports = 5;
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 	uint64_t fmt = test_set->perf_oa_format;
 	uint64_t properties[] = {
-		DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+		DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 		DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
 		DRM_XE_OA_PROPERTY_OA_METRIC_SET, test_set->perf_oa_metrics_set,
 		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(fmt),
@@ -3515,16 +3515,16 @@ test_rc6_disable(void)
  * Description: Open/close OA streams in a tight loop
  */
 static void
-test_stress_open_close(const struct drm_xe_engine_class_instance *hwe)
+test_stress_open_close(struct drm_xe_oa_unit *oau)
 {
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 
 	load_helper_init();
 	load_helper_run(HIGH);
 
 	igt_until_timeout(2) {
 		uint64_t properties[] = {
-			DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+			DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 
 			/* XXX: even without periodic sampling we have to
 			 * specify at least one sample layout property...
@@ -4623,14 +4623,14 @@ static void closed_fd_and_unmapped_access(const struct drm_xe_engine_class_insta
  * has zeroes in it.
  */
 static void
-test_tail_address_wrap(const struct drm_xe_engine_class_instance *hwe, size_t oa_buffer_size)
+test_tail_address_wrap(struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
 {
-	struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
+	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
 	u64 exponent = max_oa_exponent_for_period_lte(20000);
 	u64 buffer_size = oa_buffer_size ?: buffer_fill_size;
 	u64 fmt = test_set->perf_oa_format;
 	u64 properties[] = {
-		DRM_XE_OA_PROPERTY_OA_UNIT_ID, 0,
+		DRM_XE_OA_PROPERTY_OA_UNIT_ID, oau->oa_unit_id,
 		DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
 		DRM_XE_OA_PROPERTY_OA_METRIC_SET, test_set->perf_oa_metrics_set,
 		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(fmt),
@@ -5124,13 +5124,13 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
 		test_invalid_oa_exponent();
 
 	igt_subtest_with_dynamic("oa-exponents")
-		__for_one_hwe_in_oag(hwe)
-			test_oa_exponents(hwe);
+		__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+			test_oa_exponents(oau);
 
 	igt_subtest_with_dynamic("buffer-fill") {
 		igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
-		__for_one_hwe_in_oag(hwe)
-			test_buffer_fill(hwe);
+		__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+			test_buffer_fill(oau);
 	}
 
 	/**
@@ -5158,8 +5158,8 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
 		test_non_sampling_read_error();
 
 	igt_subtest_with_dynamic("enable-disable")
-		__for_one_hwe_in_oag(hwe)
-			test_enable_disable(hwe);
+		__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+			test_enable_disable(oau);
 
 	igt_subtest_with_dynamic("blocking") {
 		igt_require(!igt_run_in_simulation());
@@ -5193,8 +5193,8 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
 		igt_subtest_with_dynamic("oa-tlb-invalidate") {
 			igt_require(intel_graphics_ver(devid) <= IP_VER(12, 70) &&
 				    intel_graphics_ver(devid) != IP_VER(12, 60));
-			__for_one_hwe_in_oag(hwe)
-				test_oa_tlb_invalidate(hwe);
+			__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+				test_oa_tlb_invalidate(oau);
 		}
 
 		igt_subtest_with_dynamic("unprivileged-single-ctx-counters") {
@@ -5223,8 +5223,8 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
 	}
 
 	igt_subtest_with_dynamic("stress-open-close") {
-		__for_one_hwe_in_oag(hwe)
-			test_stress_open_close(hwe);
+		__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+			test_stress_open_close(oau);
 	}
 
 	igt_subtest("invalid-create-userspace-config")
@@ -5269,8 +5269,8 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
 		long k = random() % num_buf_sizes;
 
 		igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
-		__for_one_hwe_in_oag_w_arg(hwe, buf_sizes[k].name)
-			test_tail_address_wrap(hwe, buf_sizes[k].size);
+		__for_oa_unit_by_type_w_arg(DRM_XE_OA_UNIT_TYPE_OAG, buf_sizes[k].name)
+			test_tail_address_wrap(oau, buf_sizes[k].size);
 	}
 
 	igt_subtest_group {
-- 
2.48.1


  parent reply	other threads:[~2025-10-13 20:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 20:30 [PATCH i-g-t v2 00/18] Change OA IGT's to run on all OA units Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 01/18] tests/intel/xe_oa: Add OAM formats to lnl_oa_formats Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 02/18] tests/intel/xe_oa: Get rid of unnecessary DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t v2 03/18] tests/intel/xe_oa: Rename nth_oa_unit to oa_unit_by_id Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 04/18] tests/intel/xe_oa: Change oa_unit_engine to take an oa_unit argument Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 05/18] tests/intel/xe_oa: Add oa_unit_by_type Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t v2 06/18] tests/intel/xe_oa: Add for_each_oa_unit Ashutosh Dixit
2025-10-14 20:40   ` Umesh Nerlige Ramappa
2025-10-14 21:59     ` Dixit, Ashutosh
2025-10-13 20:30 ` [PATCH i-g-t 07/18] tests/intel/xe_oa: Convert test_oa_formats to take an OA unit argument Ashutosh Dixit
2025-10-13 20:30 ` Ashutosh Dixit [this message]
2025-10-13 20:30 ` [PATCH i-g-t 09/18] tests/intel/xe_oa: Convert test_non_zero_reason " Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 10/18] tests/intel/xe_oa: Convert blocking/polling tests to take OA unit arguments Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 11/18] tests/intel/xe_oa: Convert test_mi_rpc to take an OA unit argument Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 12/18] tests/intel/xe_oa: Convert test_single_ctx_render_target_writes_a_counter Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 13/18] tests/intel/xe_oa: Convert OA buffer mmap tests to take OA unit arguments Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 14/18] tests/intel/xe_oa: Convert MMIO trigger " Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 15/18] tests/intel/xe_oa: Convert sync " Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 16/18] tests/intel/xe_oa: Run test_oa_unit_exclusive_stream on multiple OA units Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 17/18] tests/intel/xe_oa: Add new non-zero-reason-all test Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 18/18] tests/intel/xe_oa: Constify arguments to various functions Ashutosh Dixit
2025-10-13 23:54 ` ✓ Xe.CI.BAT: success for Change OA IGT's to run on all OA units (rev2) Patchwork
2025-10-14  0:13 ` ✗ i915.CI.BAT: failure " Patchwork
2025-10-14  7:32 ` ✗ Xe.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-10-08 21:17 [PATCH i-g-t 00/18] Change OA IGT's to run on all OA units Ashutosh Dixit
2025-10-08 21:17 ` [PATCH i-g-t 08/18] tests/intel/xe_oa: Convert several more tests to take OA unit arguments Ashutosh Dixit
2025-10-10 22:24   ` Umesh Nerlige Ramappa

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=20251013203042.925115-9-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=umesh.nerlige.ramappa@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 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.