Skip to content

Commit e2359f6

Browse files
hghimiraSasha Levin
authored andcommitted
drm/xe/tests/mocs: Update xe_force_wake_get() return handling
[ Upstream commit 6a966d6 ] With xe_force_wake_get() now returning the refcount-incremented domain mask, a return value of 0 indicates failure for single domains. Change assert condition to incorporate this change in return and pass the return value to xe_force_wake_put() v3 - return xe_wakeref_t instead of int in xe_force_wake_get() v5 - return unsigned int for xe_force_wake_get() Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241014075601.2324382-13-himal.prasad.ghimiray@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Stable-dep-of: 51c0ee8 ("drm/xe/tests/mocs: Hold XE_FORCEWAKE_ALL for LNCF regs") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8093d66 commit e2359f6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/gpu/drm/xe/tests/xe_mocs.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ static void read_l3cc_table(struct xe_gt *gt,
4343
{
4444
struct kunit *test = kunit_get_current_test();
4545
u32 l3cc, l3cc_expected;
46-
unsigned int i;
46+
unsigned int fw_ref, i;
4747
u32 reg_val;
48-
u32 ret;
4948

50-
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
51-
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
49+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
50+
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");
5251

5352
for (i = 0; i < info->num_mocs_regs; i++) {
5453
if (!(i & 1)) {
@@ -72,23 +71,22 @@ static void read_l3cc_table(struct xe_gt *gt,
7271
KUNIT_EXPECT_EQ_MSG(test, l3cc_expected, l3cc,
7372
"l3cc idx=%u has incorrect val.\n", i);
7473
}
75-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
74+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
7675
}
7776

7877
static void read_mocs_table(struct xe_gt *gt,
7978
const struct xe_mocs_info *info)
8079
{
8180
struct kunit *test = kunit_get_current_test();
8281
u32 mocs, mocs_expected;
83-
unsigned int i;
82+
unsigned int fw_ref, i;
8483
u32 reg_val;
85-
u32 ret;
8684

8785
KUNIT_EXPECT_TRUE_MSG(test, info->unused_entries_index,
8886
"Unused entries index should have been defined\n");
8987

90-
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
91-
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
88+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
89+
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");
9290

9391
for (i = 0; i < info->num_mocs_regs; i++) {
9492
if (regs_are_mcr(gt))
@@ -106,7 +104,7 @@ static void read_mocs_table(struct xe_gt *gt,
106104
"mocs reg 0x%x has incorrect val.\n", i);
107105
}
108106

109-
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
107+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
110108
}
111109

112110
static int mocs_kernel_test_run_device(struct xe_device *xe)

0 commit comments

Comments
 (0)