Skip to content

Commit 6bcb180

Browse files
committed
drm/xe/oa: Store forcewake reference in stream structure
Calls to xe_force_wake_put() should generally pass the exact reference returned by xe_force_wake_get(). Since OA grabs and releases forcewake in different functions, xe_oa_stream_destroy() is currently calling put with a hardcoded ALL mask. Although this works for now, it's somewhat fragile in case OA moves to more precise power domain management in the future. Stash the original reference obtained during stream initialization inside the stream structure so that we can use it directly when the stream is destroyed. Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Link: https://patch.msgid.link/20251110232017.1475869-35-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
1 parent 9de2606 commit 6bcb180

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/gpu/drm/xe/xe_oa.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
870870

871871
xe_oa_free_oa_buffer(stream);
872872

873-
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
873+
xe_force_wake_put(gt_to_fw(gt), stream->fw_ref);
874874
xe_pm_runtime_put(stream->oa->xe);
875875

876876
/* Wa_1509372804:pvc: Unset the override of GUCRC mode to enable rc6 */
@@ -1717,7 +1717,6 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
17171717
struct xe_oa_open_param *param)
17181718
{
17191719
struct xe_gt *gt = param->hwe->gt;
1720-
unsigned int fw_ref;
17211720
int ret;
17221721

17231722
stream->exec_q = param->exec_q;
@@ -1772,8 +1771,8 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
17721771

17731772
/* Take runtime pm ref and forcewake to disable RC6 */
17741773
xe_pm_runtime_get(stream->oa->xe);
1775-
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
1776-
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
1774+
stream->fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
1775+
if (!xe_force_wake_ref_has_domain(stream->fw_ref, XE_FORCEWAKE_ALL)) {
17771776
ret = -ETIMEDOUT;
17781777
goto err_fw_put;
17791778
}
@@ -1818,7 +1817,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
18181817
err_free_oa_buf:
18191818
xe_oa_free_oa_buffer(stream);
18201819
err_fw_put:
1821-
xe_force_wake_put(gt_to_fw(gt), fw_ref);
1820+
xe_force_wake_put(gt_to_fw(gt), stream->fw_ref);
18221821
xe_pm_runtime_put(stream->oa->xe);
18231822
if (stream->override_gucrc)
18241823
xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(&gt->uc.guc.pc));

drivers/gpu/drm/xe/xe_oa_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,5 +264,8 @@ struct xe_oa_stream {
264264

265265
/** @syncs: syncs to wait on and to signal */
266266
struct xe_sync_entry *syncs;
267+
268+
/** @fw_ref: Forcewake reference */
269+
unsigned int fw_ref;
267270
};
268271
#endif

0 commit comments

Comments
 (0)