Commit e17eedf5 authored by Michal Wajdeczko's avatar Michal Wajdeczko

drm/xe/tests: Convert xe_bo live tests

Convert xe_bo live tests to parameterized style.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: default avatarJonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240720142528.530-4-michal.wajdeczko@intel.com
parent 8bfab7cd
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <kunit/test.h> #include <kunit/test.h>
#include <kunit/visibility.h> #include <kunit/visibility.h>
#include "tests/xe_kunit_helpers.h"
#include "tests/xe_pci_test.h" #include "tests/xe_pci_test.h"
#include "tests/xe_test.h" #include "tests/xe_test.h"
...@@ -158,13 +159,13 @@ static int ccs_test_run_device(struct xe_device *xe) ...@@ -158,13 +159,13 @@ static int ccs_test_run_device(struct xe_device *xe)
int id; int id;
if (!xe_device_has_flat_ccs(xe)) { if (!xe_device_has_flat_ccs(xe)) {
kunit_info(test, "Skipping non-flat-ccs device.\n"); kunit_skip(test, "non-flat-ccs device\n");
return 0; return 0;
} }
/* For xe2+ dgfx, we don't handle ccs metadata */ /* For xe2+ dgfx, we don't handle ccs metadata */
if (GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe)) { if (GRAPHICS_VER(xe) >= 20 && IS_DGFX(xe)) {
kunit_info(test, "Skipping on xe2+ dgfx device.\n"); kunit_skip(test, "xe2+ dgfx device\n");
return 0; return 0;
} }
...@@ -184,7 +185,9 @@ static int ccs_test_run_device(struct xe_device *xe) ...@@ -184,7 +185,9 @@ static int ccs_test_run_device(struct xe_device *xe)
static void xe_ccs_migrate_kunit(struct kunit *test) static void xe_ccs_migrate_kunit(struct kunit *test)
{ {
xe_call_for_each_device(ccs_test_run_device); struct xe_device *xe = test->priv;
ccs_test_run_device(xe);
} }
static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test) static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struct kunit *test)
...@@ -334,8 +337,7 @@ static int evict_test_run_device(struct xe_device *xe) ...@@ -334,8 +337,7 @@ static int evict_test_run_device(struct xe_device *xe)
int id; int id;
if (!IS_DGFX(xe)) { if (!IS_DGFX(xe)) {
kunit_info(test, "Skipping non-discrete device %s.\n", kunit_skip(test, "non-discrete device\n");
dev_name(xe->drm.dev));
return 0; return 0;
} }
...@@ -351,12 +353,14 @@ static int evict_test_run_device(struct xe_device *xe) ...@@ -351,12 +353,14 @@ static int evict_test_run_device(struct xe_device *xe)
static void xe_bo_evict_kunit(struct kunit *test) static void xe_bo_evict_kunit(struct kunit *test)
{ {
xe_call_for_each_device(evict_test_run_device); struct xe_device *xe = test->priv;
evict_test_run_device(xe);
} }
static struct kunit_case xe_bo_tests[] = { static struct kunit_case xe_bo_tests[] = {
KUNIT_CASE(xe_ccs_migrate_kunit), KUNIT_CASE_PARAM(xe_ccs_migrate_kunit, xe_pci_live_device_gen_param),
KUNIT_CASE(xe_bo_evict_kunit), KUNIT_CASE_PARAM(xe_bo_evict_kunit, xe_pci_live_device_gen_param),
{} {}
}; };
...@@ -364,5 +368,6 @@ VISIBLE_IF_KUNIT ...@@ -364,5 +368,6 @@ VISIBLE_IF_KUNIT
struct kunit_suite xe_bo_test_suite = { struct kunit_suite xe_bo_test_suite = {
.name = "xe_bo", .name = "xe_bo",
.test_cases = xe_bo_tests, .test_cases = xe_bo_tests,
.init = xe_kunit_helper_xe_device_live_test_init,
}; };
EXPORT_SYMBOL_IF_KUNIT(xe_bo_test_suite); EXPORT_SYMBOL_IF_KUNIT(xe_bo_test_suite);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment