Skip to content

Commit 7fe17fa

Browse files
hghimirarodrigovivi
authored andcommitted
drm/xe/xe_drm_client: Update handling of xe_force_wake_get return
xe_force_wake_get() now returns the reference count-incremented domain mask. If it fails for individual domains, the return value will always be 0. However, for XE_FORCEWAKE_ALL, it may return a non-zero value even in the event of failure. Use helper xe_force_wake_ref_has_domain to verify all domains are initialized or not. Update the return handling of xe_force_wake_get() to reflect this behavior, and ensure that the return value is passed as input 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 xe_force_wake_ref_has_domain() v7 - Fix commit message 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 a4c48a3 commit 7fe17fa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/xe/xe_drm_client.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
278278
struct xe_hw_engine *hwe;
279279
struct xe_exec_queue *q;
280280
u64 gpu_timestamp;
281+
unsigned int fw_ref;
281282

282283
xe_pm_runtime_get(xe);
283284

@@ -303,13 +304,16 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
303304
continue;
304305

305306
fw = xe_hw_engine_to_fw_domain(hwe);
306-
if (xe_force_wake_get(gt_to_fw(gt), fw)) {
307+
308+
fw_ref = xe_force_wake_get(gt_to_fw(gt), fw);
309+
if (!xe_force_wake_ref_has_domain(fw_ref, fw)) {
307310
hwe = NULL;
311+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
308312
break;
309313
}
310314

311315
gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
312-
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), fw));
316+
xe_force_wake_put(gt_to_fw(gt), fw_ref);
313317
break;
314318
}
315319

0 commit comments

Comments
 (0)