[PATCH i-g-t v2 1/1] tests/intel/xe_oa: Extend non-zero-reason test
Sai Teja Pottumuttu
sai.teja.pottumuttu at intel.com
Thu Jan 16 13:54:56 UTC 2025
Extend non-zero-reason test to use configurable OA buffer sizes and
execute the test for three different sizes 8,16 and 32MB.
Signed-off-by: Sai Teja Pottumuttu <sai.teja.pottumuttu at intel.com>
---
tests/intel/xe_oa.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 492a6b5d6..f28156a66 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, ¶m, true /* prevent_pm */);
set_fd_flags(stream_fd, O_CLOEXEC);
@@ -4867,8 +4871,28 @@ igt_main
test_buffer_fill(hwe);
igt_subtest_with_dynamic("non-zero-reason") {
- __for_one_hwe_in_oag(hwe)
- test_non_zero_reason(hwe);
+ 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];
+
+ if (oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE) {
+ hwe = oa_unit_engine(drm_fd, 0);
+ if (hwe) {
+ igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class),
+ hwe->engine_instance, "8MB")
+ test_non_zero_reason(hwe, SZ_8M);
+
+ igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class),
+ hwe->engine_instance, "16MB")
+ test_non_zero_reason(hwe, SZ_16M);
+
+ igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class),
+ hwe->engine_instance, "32MB")
+ test_non_zero_reason(hwe, SZ_32M);
+ }
+ } else {
+ __for_one_hwe_in_oag(hwe)
+ test_non_zero_reason(hwe, 0);
+ }
}
igt_subtest("disabled-read-error")
--
2.34.1
More information about the igt-dev
mailing list