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 07/18] tests/intel/xe_oa: Convert test_oa_formats to take an OA unit argument
Date: Mon, 13 Oct 2025 13:30:30 -0700 [thread overview]
Message-ID: <20251013203042.925115-8-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20251013203042.925115-1-ashutosh.dixit@intel.com>
To enable OA IGT's to run on all OA units, OA unit tests are converted to
take a 'struct drm_xe_oa_unit *' argument (instead of hwe). This patch
converts the first unit test (test_oa_formats), so it introduces this new
infrastructure.
OA units are now identified via a name (corresponding to OA unit type) and
id. OA units are longer identified by hwe, because some OA units have no
associated hwe's.
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
tests/intel/xe_oa.c | 92 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 71 insertions(+), 21 deletions(-)
diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 8e73182700..22cc4e8b9b 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -327,8 +327,6 @@ static int pm_fd = -1;
static int stream_fd = -1;
static uint32_t devid;
-static struct drm_xe_engine_class_instance default_hwe;
-
static struct intel_xe_perf *intel_xe_perf;
static uint64_t oa_exponent_default;
static size_t default_oa_buffer_size;
@@ -340,6 +338,54 @@ static uint32_t min_oa_exponent;
static uint32_t buffer_fill_size;
static uint32_t num_buf_sizes;
+/* OA unit names */
+static const char *oa_unit_name[] = {
+ [DRM_XE_OA_UNIT_TYPE_OAG] = "oag",
+ [DRM_XE_OA_UNIT_TYPE_OAM] = "oam",
+ [DRM_XE_OA_UNIT_TYPE_OAM_SAG] = "sag",
+};
+
+static struct intel_xe_perf_metric_set *oa_unit_metric_set(struct drm_xe_oa_unit *oau)
+{
+ const char *test_set_name = NULL;
+ struct intel_xe_perf_metric_set *metric_set_iter;
+ struct intel_xe_perf_metric_set *test_set = NULL;
+
+ if (oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAG)
+ test_set_name = "TestOa";
+ else if (HAS_OAM(devid) &&
+ (oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAM ||
+ oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAM_SAG))
+ test_set_name = "MediaSet1";
+ else
+ igt_assert(!"reached");
+
+ igt_list_for_each_entry(metric_set_iter, &intel_xe_perf->metric_sets, link) {
+ if (strcmp(metric_set_iter->symbol_name, test_set_name) == 0) {
+ test_set = metric_set_iter;
+ break;
+ }
+ }
+
+ igt_assert(test_set);
+
+ /*
+ * configuration was loaded in init_sys_info() ->
+ * intel_xe_perf_load_perf_configs(), and test_set->perf_oa_metrics_set
+ * should point to metric id returned by the config add ioctl. 0 is
+ * invalid.
+ */
+ igt_assert_neq_u64(test_set->perf_oa_metrics_set, 0);
+
+ igt_debug("oa_unit %d:%d - %s metric set UUID = %s\n",
+ oau->oa_unit_id,
+ oau->oa_unit_type,
+ test_set->symbol_name,
+ test_set->hw_config_guid);
+
+ return test_set;
+}
+
static struct intel_xe_perf_metric_set *metric_set(const struct drm_xe_engine_class_instance *hwe)
{
const char *test_set_name = NULL;
@@ -381,7 +427,7 @@ static struct intel_xe_perf_metric_set *metric_set(const struct drm_xe_engine_cl
return test_set;
}
-#define default_test_set metric_set(&default_hwe)
+#define default_test_set oa_unit_metric_set(oa_unit_by_type(drm_fd, DRM_XE_OA_UNIT_TYPE_OAG))
static void set_fd_flags(int fd, int flags)
{
@@ -1558,11 +1604,11 @@ open_and_read_2_oa_reports(int format_id,
uint32_t *oa_report0,
uint32_t *oa_report1,
bool timer_only,
- const struct drm_xe_engine_class_instance *hwe)
+ 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,
/* Include OA reports in samples */
DRM_XE_OA_PROPERTY_SAMPLE_OA, true,
@@ -1682,32 +1728,28 @@ print_reports(uint32_t *oa_report0, uint32_t *oa_report1, int fmt)
}
static bool
-hwe_supports_oa_type(int oa_type, const struct drm_xe_engine_class_instance *hwe)
+oau_supports_oa_type(int oa_type, struct drm_xe_oa_unit *oau)
{
switch (oa_type) {
case DRM_XE_OA_FMT_TYPE_OAM:
case DRM_XE_OA_FMT_TYPE_OAM_MPEC:
- return hwe->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_DECODE ||
- hwe->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE;
+ return oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAM ||
+ oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAM_SAG;
case DRM_XE_OA_FMT_TYPE_OAG:
case DRM_XE_OA_FMT_TYPE_OAR:
- return hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER;
case DRM_XE_OA_FMT_TYPE_OAC:
- return hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE;
case DRM_XE_OA_FMT_TYPE_PEC:
- return hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER ||
- hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE;
+ return oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_OAG;
default:
return false;
}
-
}
/**
* SUBTEST: oa-formats
* Description: Test that supported OA formats work as expected
*/
-static void test_oa_formats(const struct drm_xe_engine_class_instance *hwe)
+static void test_oa_formats(struct drm_xe_oa_unit *oau)
{
for (int i = 0; i < XE_OA_FORMAT_MAX; i++) {
struct oa_format format = get_oa_format(i);
@@ -1717,7 +1759,7 @@ static void test_oa_formats(const struct drm_xe_engine_class_instance *hwe)
if (!format.name) /* sparse, indexed by ID */
continue;
- if (!hwe_supports_oa_type(format.oa_type, hwe))
+ if (!oau_supports_oa_type(format.oa_type, oau))
continue;
igt_debug("Checking OA format %s\n", format.name);
@@ -1727,13 +1769,13 @@ static void test_oa_formats(const struct drm_xe_engine_class_instance *hwe)
oa_report0,
oa_report1,
false, /* timer reports only */
- hwe);
+ oau);
print_reports(oa_report0, oa_report1, i);
sanity_check_reports(oa_report0, oa_report1, i);
- if (i == metric_set(hwe)->perf_oa_format)
- pec_sanity_check_reports(oa_report0, oa_report1, metric_set(hwe));
+ if (i == oa_unit_metric_set(oau)->perf_oa_format)
+ pec_sanity_check_reports(oa_report0, oa_report1, oa_unit_metric_set(oau));
}
}
@@ -4956,6 +4998,14 @@ static const char *xe_engine_class_name(uint32_t engine_class)
igt_require_f(hwe, "no render engine\n"); \
igt_dynamic_f("rcs-%d", hwe->engine_instance)
+#define __for_oa_unit_by_type(k) \
+ if ((oau = oa_unit_by_type(drm_fd, k))) \
+ igt_dynamic_f("%s-%d", oa_unit_name[oau->oa_unit_type], oau->oa_unit_id)
+
+#define __for_oa_unit_by_type_w_arg(k, str) \
+ if ((oau = oa_unit_by_type(drm_fd, k))) \
+ igt_dynamic_f("%s-%d-%s", oa_unit_name[oau->oa_unit_type], oau->oa_unit_id, str)
+
static int opt_handler(int opt, int opt_index, void *data)
{
uint32_t tmp;
@@ -5067,8 +5117,8 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
test_missing_sample_flags();
igt_subtest_with_dynamic("oa-formats")
- __for_one_hwe_in_oag(hwe)
- test_oa_formats(hwe);
+ __for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
+ test_oa_formats(oau);
igt_subtest("invalid-oa-exponent")
test_invalid_oa_exponent();
--
2.48.1
next prev 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 ` Ashutosh Dixit [this message]
2025-10-13 20:30 ` [PATCH i-g-t 08/18] tests/intel/xe_oa: Convert several more tests to take OA unit arguments Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 09/18] tests/intel/xe_oa: Convert test_non_zero_reason to take an OA unit argument 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 07/18] tests/intel/xe_oa: Convert test_oa_formats to take an OA unit argument Ashutosh Dixit
2025-10-10 22:22 ` 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-8-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox