mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
drm/xe: Convert kunit tests from mem_access to xe_pm_runtime
Let's convert the kunit tests that are currently relying on
xe_device_mem_access_{get,put} towards the direct xe_pm_runtime_{get,put}.
While doing this we need to move the get/put calls towards the outer
bounds of the tests to ensure consistency with the other usages of
pm_runtime on the regular paths.
v2: include xe_pm.h in tests/xe_mocs.c and sort the include block
while at it.
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240222163937.138342-4-rodrigo.vivi@intel.com
This commit is contained in:
parent
23cf006bea
commit
6a0784e600
|
|
@ -163,7 +163,7 @@ static int ccs_test_run_device(struct xe_device *xe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
xe_device_mem_access_get(xe);
|
||||
xe_pm_runtime_get(xe);
|
||||
|
||||
for_each_tile(tile, xe, id) {
|
||||
/* For igfx run only for primary tile */
|
||||
|
|
@ -172,7 +172,7 @@ static int ccs_test_run_device(struct xe_device *xe)
|
|||
ccs_test_run_tile(xe, tile, test);
|
||||
}
|
||||
|
||||
xe_device_mem_access_put(xe);
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -335,12 +335,12 @@ static int evict_test_run_device(struct xe_device *xe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
xe_device_mem_access_get(xe);
|
||||
xe_pm_runtime_get(xe);
|
||||
|
||||
for_each_tile(tile, xe, id)
|
||||
evict_test_run_tile(xe, tile, test);
|
||||
|
||||
xe_device_mem_access_put(xe);
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "tests/xe_pci_test.h"
|
||||
|
||||
#include "xe_pci.h"
|
||||
#include "xe_pm.h"
|
||||
|
||||
static bool sanity_fence_failed(struct xe_device *xe, struct dma_fence *fence,
|
||||
const char *str, struct kunit *test)
|
||||
|
|
@ -423,17 +424,19 @@ static int migrate_test_run_device(struct xe_device *xe)
|
|||
struct xe_tile *tile;
|
||||
int id;
|
||||
|
||||
xe_pm_runtime_get(xe);
|
||||
|
||||
for_each_tile(tile, xe, id) {
|
||||
struct xe_migrate *m = tile->migrate;
|
||||
|
||||
kunit_info(test, "Testing tile id %d.\n", id);
|
||||
xe_vm_lock(m->q->vm, true);
|
||||
xe_device_mem_access_get(xe);
|
||||
xe_migrate_sanity_test(m, test);
|
||||
xe_device_mem_access_put(xe);
|
||||
xe_vm_unlock(m->q->vm);
|
||||
}
|
||||
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
#include "tests/xe_pci_test.h"
|
||||
#include "tests/xe_test.h"
|
||||
|
||||
#include "xe_pci.h"
|
||||
#include "xe_device.h"
|
||||
#include "xe_gt.h"
|
||||
#include "xe_mocs.h"
|
||||
#include "xe_device.h"
|
||||
#include "xe_pci.h"
|
||||
#include "xe_pm.h"
|
||||
|
||||
struct live_mocs {
|
||||
struct xe_mocs_info table;
|
||||
|
|
@ -45,7 +46,6 @@ static void read_l3cc_table(struct xe_gt *gt,
|
|||
|
||||
struct kunit *test = xe_cur_kunit();
|
||||
|
||||
xe_device_mem_access_get(gt_to_xe(gt));
|
||||
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
|
||||
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
|
||||
mocs_dbg(>_to_xe(gt)->drm, "L3CC entries:%d\n", info->n_entries);
|
||||
|
|
@ -65,7 +65,6 @@ static void read_l3cc_table(struct xe_gt *gt,
|
|||
XELP_LNCFCMOCS(i).addr);
|
||||
}
|
||||
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
|
||||
xe_device_mem_access_put(gt_to_xe(gt));
|
||||
}
|
||||
|
||||
static void read_mocs_table(struct xe_gt *gt,
|
||||
|
|
@ -80,7 +79,6 @@ static void read_mocs_table(struct xe_gt *gt,
|
|||
|
||||
struct kunit *test = xe_cur_kunit();
|
||||
|
||||
xe_device_mem_access_get(gt_to_xe(gt));
|
||||
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
|
||||
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
|
||||
mocs_dbg(>_to_xe(gt)->drm, "Global MOCS entries:%d\n", info->n_entries);
|
||||
|
|
@ -100,7 +98,6 @@ static void read_mocs_table(struct xe_gt *gt,
|
|||
XELP_GLOBAL_MOCS(i).addr);
|
||||
}
|
||||
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
|
||||
xe_device_mem_access_put(gt_to_xe(gt));
|
||||
}
|
||||
|
||||
static int mocs_kernel_test_run_device(struct xe_device *xe)
|
||||
|
|
@ -113,6 +110,8 @@ static int mocs_kernel_test_run_device(struct xe_device *xe)
|
|||
unsigned int flags;
|
||||
int id;
|
||||
|
||||
xe_pm_runtime_get(xe);
|
||||
|
||||
for_each_gt(gt, xe, id) {
|
||||
flags = live_mocs_init(&mocs, gt);
|
||||
if (flags & HAS_GLOBAL_MOCS)
|
||||
|
|
@ -120,6 +119,9 @@ static int mocs_kernel_test_run_device(struct xe_device *xe)
|
|||
if (flags & HAS_LNCF_MOCS)
|
||||
read_l3cc_table(gt, &mocs.table);
|
||||
}
|
||||
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -139,6 +141,8 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
|
|||
int id;
|
||||
struct kunit *test = xe_cur_kunit();
|
||||
|
||||
xe_pm_runtime_get(xe);
|
||||
|
||||
for_each_gt(gt, xe, id) {
|
||||
flags = live_mocs_init(&mocs, gt);
|
||||
kunit_info(test, "mocs_reset_test before reset\n");
|
||||
|
|
@ -156,6 +160,9 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
|
|||
if (flags & HAS_LNCF_MOCS)
|
||||
read_l3cc_table(gt, &mocs.table);
|
||||
}
|
||||
|
||||
xe_pm_runtime_put(xe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user