Skip to content

Commit 16b57c9

Browse files
committed
drm/xe: Convert mem_access_if_ongoing to direct xe_pm_runtime_get_if_active
Now that assert_mem_access is relying directly on the pm_runtime state instead of the counters, there's no reason why we cannot use the pm_runtime functions directly. Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent a382291 commit 16b57c9

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

drivers/gpu/drm/xe/xe_device.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -733,23 +733,6 @@ void xe_device_assert_mem_access(struct xe_device *xe)
733733
xe_assert(xe, !xe_pm_runtime_suspended(xe));
734734
}
735735

736-
bool xe_device_mem_access_get_if_ongoing(struct xe_device *xe)
737-
{
738-
bool active;
739-
740-
if (xe_pm_read_callback_task(xe) == current)
741-
return true;
742-
743-
active = xe_pm_runtime_get_if_active(xe);
744-
if (active) {
745-
int ref = atomic_inc_return(&xe->mem_access.ref);
746-
747-
xe_assert(xe, ref != S32_MAX);
748-
}
749-
750-
return active;
751-
}
752-
753736
void xe_device_mem_access_get(struct xe_device *xe)
754737
{
755738
int ref;

drivers/gpu/drm/xe/xe_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ static inline struct xe_force_wake *gt_to_fw(struct xe_gt *gt)
134134
}
135135

136136
void xe_device_mem_access_get(struct xe_device *xe);
137-
bool xe_device_mem_access_get_if_ongoing(struct xe_device *xe);
138137
void xe_device_mem_access_put(struct xe_device *xe);
139138

140139
void xe_device_assert_mem_access(struct xe_device *xe);

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ void xe_guc_ct_fast_path(struct xe_guc_ct *ct)
12101210
bool ongoing;
12111211
int len;
12121212

1213-
ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct));
1213+
ongoing = xe_pm_runtime_get_if_active(ct_to_xe(ct));
12141214
if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL)
12151215
return;
12161216

@@ -1223,7 +1223,7 @@ void xe_guc_ct_fast_path(struct xe_guc_ct *ct)
12231223
spin_unlock(&ct->fast_lock);
12241224

12251225
if (ongoing)
1226-
xe_device_mem_access_put(xe);
1226+
xe_pm_runtime_put(xe);
12271227
}
12281228

12291229
/* Returns less than zero on error, 0 on done, 1 on more available */
@@ -1281,7 +1281,7 @@ static void g2h_worker_func(struct work_struct *w)
12811281
* responses, if the worker here is blocked on those callbacks
12821282
* completing, creating a deadlock.
12831283
*/
1284-
ongoing = xe_device_mem_access_get_if_ongoing(ct_to_xe(ct));
1284+
ongoing = xe_pm_runtime_get_if_active(ct_to_xe(ct));
12851285
if (!ongoing && xe_pm_read_callback_task(ct_to_xe(ct)) == NULL)
12861286
return;
12871287

@@ -1299,7 +1299,7 @@ static void g2h_worker_func(struct work_struct *w)
12991299
} while (ret == 1);
13001300

13011301
if (ongoing)
1302-
xe_device_mem_access_put(ct_to_xe(ct));
1302+
xe_pm_runtime_put(ct_to_xe(ct));
13031303
}
13041304

13051305
static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb,

0 commit comments

Comments
 (0)