]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/tests/mocs: Hold XE_FORCEWAKE_ALL for LNCF regs
authorTejas Upadhyay <tejas.upadhyay@intel.com>
Mon, 28 Apr 2025 08:23:57 +0000 (13:53 +0530)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 8 May 2025 19:44:34 +0000 (12:44 -0700)
LNCF registers report wrong values when XE_FORCEWAKE_GT
only is held. Holding XE_FORCEWAKE_ALL ensures correct
operations on LNCF regs.

V2(Himal):
 - Use xe_force_wake_ref_has_domain

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1999
Fixes: a6a4ea6d7d37 ("drm/xe: Add mocs kunit")
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250428082357.1730068-1-tejas.upadhyay@intel.com
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
(cherry picked from commit 70a2585e582058e94fe4381a337be42dec800337)
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/tests/xe_mocs.c

index ef1e5256c56a8a20ceb5f4bc7d2549a9c4c4fe39..0e502feaca81860213d3061c016cdaf0d033405f 100644 (file)
@@ -46,8 +46,11 @@ static void read_l3cc_table(struct xe_gt *gt,
        unsigned int fw_ref, i;
        u32 reg_val;
 
-       fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
-       KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");
+       fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
+       if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
+               xe_force_wake_put(gt_to_fw(gt), fw_ref);
+               KUNIT_ASSERT_TRUE_MSG(test, true, "Forcewake Failed.\n");
+       }
 
        for (i = 0; i < info->num_mocs_regs; i++) {
                if (!(i & 1)) {