]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/query: Use scope-based forcewake
authorMatt Roper <matthew.d.roper@intel.com>
Tue, 18 Nov 2025 16:43:57 +0000 (08:43 -0800)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 19 Nov 2025 19:58:58 +0000 (11:58 -0800)
Use scope-based forcewake handling for consistency with other parts of
the driver.

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-47-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_query.c

index 1c0915e2cc16ed8bdb035d0aac23f74474b51e06..a7bf1fd6dd6ac527d9e8d561f2828955899e09b7 100644 (file)
@@ -122,7 +122,6 @@ query_engine_cycles(struct xe_device *xe,
        __ktime_func_t cpu_clock;
        struct xe_hw_engine *hwe;
        struct xe_gt *gt;
-       unsigned int fw_ref;
 
        if (IS_SRIOV_VF(xe))
                return -EOPNOTSUPP;
@@ -158,16 +157,13 @@ query_engine_cycles(struct xe_device *xe,
        if (!hwe)
                return -EINVAL;
 
-       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);
-               return -EIO;
-       }
-
-       hwe_read_timestamp(hwe, &resp.engine_cycles, &resp.cpu_timestamp,
-                          &resp.cpu_delta, cpu_clock);
+       xe_with_force_wake(fw_ref, gt_to_fw(gt), XE_FORCEWAKE_ALL) {
+               if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FORCEWAKE_ALL))
+                       return -EIO;
 
-       xe_force_wake_put(gt_to_fw(gt), fw_ref);
+               hwe_read_timestamp(hwe, &resp.engine_cycles, &resp.cpu_timestamp,
+                                  &resp.cpu_delta, cpu_clock);
+       }
 
        if (GRAPHICS_VER(xe) >= 20)
                resp.width = 64;