diff options
| author | Matt Roper <matthew.d.roper@intel.com> | 2025-11-18 19:43:54 +0300 |
|---|---|---|
| committer | Matt Roper <matthew.d.roper@intel.com> | 2025-11-19 22:58:58 +0300 |
| commit | 062a6b83d56066f86c1bed170265ecfa98b83175 (patch) | |
| tree | 69342ab88f7b5bb4311388a6c87862cd53032341 /drivers/gpu | |
| parent | 1fe7ea3287ba35b92db7f8fecf773a6bc9273f51 (diff) | |
| download | linux-062a6b83d56066f86c1bed170265ecfa98b83175.tar.xz | |
drm/xe/drm_client: Use scope-based cleanup
Use scope-based cleanup for forcewake and runtime PM.
v2:
- Use xe_force_wake_release_only rather than a custom one-off class for
"any engine" forcewake. (Gustavo)
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-44-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/xe/xe_drm_client.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c index 78551832723b..2787bbb36141 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -321,7 +321,6 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file) struct xe_hw_engine *hwe; struct xe_exec_queue *q; u64 gpu_timestamp; - struct xe_force_wake_ref fw_ref; /* * RING_TIMESTAMP registers are inaccessible in VF mode. @@ -338,30 +337,26 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file) wait_var_event(&xef->exec_queue.pending_removal, !atomic_read(&xef->exec_queue.pending_removal)); - xe_pm_runtime_get(xe); - fw_ref = force_wake_get_any_engine(xe, &hwe); - if (!hwe) { - xe_pm_runtime_put(xe); - return; - } - - /* Accumulate all the exec queues from this client */ - mutex_lock(&xef->exec_queue.lock); - xa_for_each(&xef->exec_queue.xa, i, q) { - xe_exec_queue_get(q); - mutex_unlock(&xef->exec_queue.lock); - - xe_exec_queue_update_run_ticks(q); + scoped_guard(xe_pm_runtime, xe) { + CLASS(xe_force_wake_release_only, fw_ref)(force_wake_get_any_engine(xe, &hwe)); + if (!hwe) + return; + /* Accumulate all the exec queues from this client */ mutex_lock(&xef->exec_queue.lock); - xe_exec_queue_put(q); - } - mutex_unlock(&xef->exec_queue.lock); + xa_for_each(&xef->exec_queue.xa, i, q) { + xe_exec_queue_get(q); + mutex_unlock(&xef->exec_queue.lock); - gpu_timestamp = xe_hw_engine_read_timestamp(hwe); + xe_exec_queue_update_run_ticks(q); - xe_force_wake_put(gt_to_fw(hwe->gt), fw_ref.domains); - xe_pm_runtime_put(xe); + mutex_lock(&xef->exec_queue.lock); + xe_exec_queue_put(q); + } + mutex_unlock(&xef->exec_queue.lock); + + gpu_timestamp = xe_hw_engine_read_timestamp(hwe); + } for (class = 0; class < XE_ENGINE_CLASS_MAX; class++) { const char *class_name; |
