From: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v3 07/23] drm/xe/xe_gt_idle: Update handling of xe_force_wake_get return
Date: Tue, 17 Sep 2024 17:51:10 +0530 [thread overview]
Message-ID: <20240917122126.438448-8-himal.prasad.ghimiray@intel.com> (raw)
In-Reply-To: <20240917122126.438448-1-himal.prasad.ghimiray@intel.com>
With xe_force_wake_get() now returning the refcount-incremented domain
mask, a return value of 0 indicates failure for single domains
(excluding XE_FORCEWAKE_ALL).
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.
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
drivers/gpu/drm/xe/xe_gt_idle.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_idle.c b/drivers/gpu/drm/xe/xe_gt_idle.c
index 531924b6c0a1..3f0999ef2a36 100644
--- a/drivers/gpu/drm/xe/xe_gt_idle.c
+++ b/drivers/gpu/drm/xe/xe_gt_idle.c
@@ -106,7 +106,7 @@ void xe_gt_idle_enable_pg(struct xe_gt *gt)
struct xe_gt_idle *gtidle = >->gtidle;
struct xe_mmio *mmio = >->mmio;
u32 vcs_mask, vecs_mask;
- int i, j;
+ xe_wakeref_t fw_ref, i, j;
if (IS_SRIOV_VF(xe))
return;
@@ -132,7 +132,8 @@ void xe_gt_idle_enable_pg(struct xe_gt *gt)
VDN_MFXVDENC_POWERGATE_ENABLE(j));
}
- XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GT));
+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+ XE_WARN_ON(!fw_ref);
if (xe->info.skip_guc_pc) {
/*
* GuC sets the hysteresis value when GuC PC is enabled
@@ -143,12 +144,13 @@ void xe_gt_idle_enable_pg(struct xe_gt *gt)
}
xe_mmio_write32(mmio, POWERGATE_ENABLE, gtidle->powergate_enable);
- XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
+ xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
void xe_gt_idle_disable_pg(struct xe_gt *gt)
{
struct xe_gt_idle *gtidle = >->gtidle;
+ xe_wakeref_t fw_ref;
if (IS_SRIOV_VF(gt_to_xe(gt)))
return;
@@ -156,9 +158,10 @@ void xe_gt_idle_disable_pg(struct xe_gt *gt)
xe_device_assert_mem_access(gt_to_xe(gt));
gtidle->powergate_enable = 0;
- XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GT));
+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+ XE_WARN_ON(!fw_ref);
xe_mmio_write32(>->mmio, POWERGATE_ENABLE, gtidle->powergate_enable);
- XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
+ xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
/**
@@ -177,7 +180,7 @@ int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p)
enum xe_gt_idle_state state;
u32 pg_enabled, pg_status = 0;
u32 vcs_mask, vecs_mask;
- int err, n;
+ xe_wakeref_t fw_ref, n;
/*
* Media Slices
*
@@ -213,14 +216,14 @@ int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p)
/* Do not wake the GT to read powergating status */
if (state != GT_IDLE_C6) {
- err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
- if (err)
- return err;
+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+ if (!fw_ref)
+ return -ETIMEDOUT;
pg_enabled = xe_mmio_read32(>->mmio, POWERGATE_ENABLE);
pg_status = xe_mmio_read32(>->mmio, POWERGATE_DOMAIN_STATUS);
- XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FW_GT));
+ xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
if (gt->info.engine_mask & XE_HW_ENGINE_RCS_MASK) {
@@ -303,13 +306,15 @@ static void gt_idle_fini(void *arg)
{
struct kobject *kobj = arg;
struct xe_gt *gt = kobj_to_gt(kobj->parent);
+ xe_wakeref_t fw_ref;
xe_gt_idle_disable_pg(gt);
if (gt_to_xe(gt)->info.skip_guc_pc) {
- XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FW_GT));
+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
+ XE_WARN_ON(!fw_ref);
xe_gt_idle_disable_c6(gt);
- xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
+ xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
sysfs_remove_files(kobj, gt_idle_attrs);
--
2.34.1
next prev parent reply other threads:[~2024-09-17 12:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 12:21 [PATCH v3 00/23] Fix xe_force_wake_get() failure handling Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 01/23] drm/xe: Error handling in xe_force_wake_get() Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 02/23] drm/xe: Modify xe_force_wake_put to handle _get returned mask Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 03/23] drm/xe/device: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 04/23] drm/xe/hdcp: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 05/23] drm/xe/gsc: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 06/23] drm/xe/gt: " Himal Prasad Ghimiray
2024-09-17 12:21 ` Himal Prasad Ghimiray [this message]
2024-09-17 12:21 ` [PATCH v3 08/23] drm/xe/devcoredump: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 09/23] drm/xe/tests/mocs: Update xe_force_wake_get() return handling Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 10/23] drm/xe/mocs: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 11/23] drm/xe/xe_drm_client: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 12/23] drm/xe/xe_gt_debugfs: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 13/23] drm/xe/guc: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 14/23] drm/xe/huc: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 15/23] drm/xe/oa: Handle force_wake_get failure in xe_oa_stream_init() Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 16/23] drm/xe/pat: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 17/23] drm/xe/gt_tlb_invalidation_ggtt: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 18/23] drm/xe/xe_reg_sr: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 19/23] drm/xe/query: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 20/23] drm/xe/vram: " Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 21/23] drm/xe: forcewake debugfs open fails on xe_forcewake_get failure Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 22/23] drm/xe: Ensure __must_check for xe_force_wake_get() return Himal Prasad Ghimiray
2024-09-17 12:21 ` [PATCH v3 23/23] drm/xe: Change return type to void for xe_force_wake_put Himal Prasad Ghimiray
2024-09-17 13:18 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev3) Patchwork
2024-09-17 13:18 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-17 13:20 ` ✓ CI.KUnit: success " Patchwork
2024-09-17 13:35 ` ✓ CI.Build: " Patchwork
2024-09-17 13:37 ` ✓ CI.Hooks: " Patchwork
2024-09-17 13:39 ` ✓ CI.checksparse: " Patchwork
2024-09-17 14:05 ` ✗ CI.BAT: failure " Patchwork
2024-09-17 17:53 ` Ghimiray, Himal Prasad
2024-09-17 16:55 ` ✗ CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240917122126.438448-8-himal.prasad.ghimiray@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox