Skip to content

Commit 7b1e908

Browse files
hghimirarodrigovivi
authored andcommitted
drm/xe/query: Update handling of xe_force_wake_get return
With xe_force_wake_get() now returning the refcount-incremented domain mask, a non-zero return value in the case of XE_FORCEWAKE_ALL does not necessarily indicate success. Use xe_force_wake_ref_has_domain() to determine the status of the call. Modify the return handling of xe_force_wake_get() accordingly and pass the return value to xe_force_wake_put(). v3 - return xe_wakeref_t instead of int in xe_force_wake_get() - xe_force_wake_put() error doesn't need to be checked. It internally WARNS on domain ack failure. v5 - return unsigned int from xe_force_wake_get() v6 - Use helper Use xe_force_wake_ref_has_domain() Cc: Rodrigo Vivi <[email protected]> Cc: Lucas De Marchi <[email protected]> Signed-off-by: Himal Prasad Ghimiray <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Reviewed-by: Badal Nilawar <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 3bb5d1f commit 7b1e908

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/xe/xe_query.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ query_engine_cycles(struct xe_device *xe,
117117
__ktime_func_t cpu_clock;
118118
struct xe_hw_engine *hwe;
119119
struct xe_gt *gt;
120+
unsigned int fw_ref;
120121

121122
if (query->size == 0) {
122123
query->size = size;
@@ -149,13 +150,16 @@ query_engine_cycles(struct xe_device *xe,
149150
if (!hwe)
150151
return -EINVAL;
151152

152-
if (xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL))
153+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
154+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
155+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
153156
return -EIO;
157+
}
154158

155159
hwe_read_timestamp(hwe, &resp.engine_cycles, &resp.cpu_timestamp,
156160
&resp.cpu_delta, cpu_clock);
157161

158-
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
162+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
159163

160164
if (GRAPHICS_VER(xe) >= 20)
161165
resp.width = 64;

0 commit comments

Comments
 (0)