[PATCH v2 1/2] drm/xe/debugfs: add local forcewake_get/put funcs

Dafna Hirschfeld dafna.hirschfeld at intel.com
Mon Mar 24 11:07:29 UTC 2025


add the function forcewake_get, forcewake_put. They will be
used in laters commits.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld at intel.com>
---
changes from v1:
1. fix according to comments,
2. support steering for mcr registers.

 drivers/gpu/drm/xe/xe_debugfs.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index d0503959a8ed..e60eaefdd4a5 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -87,9 +87,8 @@ static const struct drm_info_list debugfs_list[] = {
 	{ .name = "sriov_info", .show = sriov_info, },
 };
 
-static int forcewake_open(struct inode *inode, struct file *file)
+static int forcewake_get(struct xe_device *xe)
 {
-	struct xe_device *xe = inode->i_private;
 	struct xe_gt *gt;
 	u8 id, last_gt;
 	unsigned int fw_ref;
@@ -119,15 +118,28 @@ static int forcewake_open(struct inode *inode, struct file *file)
 	return -ETIMEDOUT;
 }
 
-static int forcewake_release(struct inode *inode, struct file *file)
+static int forcewake_open(struct inode *inode, struct file *file)
 {
 	struct xe_device *xe = inode->i_private;
+
+	return forcewake_get(xe);
+}
+
+static void forcewake_put(struct xe_device *xe)
+{
 	struct xe_gt *gt;
 	u8 id;
 
 	for_each_gt(gt, xe, id)
 		xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
 	xe_pm_runtime_put(xe);
+}
+
+static int forcewake_release(struct inode *inode, struct file *file)
+{
+	struct xe_device *xe = inode->i_private;
+
+	forcewake_put(xe);
 
 	return 0;
 }
-- 
2.34.1



More information about the Intel-xe mailing list