[Intel-xe] [PATCH 2/4] drm/xe: Refactor debugfs into an early and late part

Stuart Summers stuart.summers at intel.com
Wed Apr 19 17:54:59 UTC 2023


Split the device info piece of debugfs into an earlier
call to allow the device info to be defined prior to
full device initialization in the xe_device_probe()
routine.

Signed-off-by: Stuart Summers <stuart.summers at intel.com>
---
 drivers/gpu/drm/xe/xe_debugfs.c | 14 ++++++++++----
 drivers/gpu/drm/xe/xe_debugfs.h |  1 +
 drivers/gpu/drm/xe/xe_pci.c     |  2 ++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index 7827a785b020..4b381861344a 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -94,6 +94,16 @@ static const struct file_operations forcewake_all_fops = {
 	.release = forcewake_release,
 };
 
+void xe_debugfs_register_early(struct xe_device *xe)
+{
+	struct drm_minor *minor = xe->drm.primary;
+	struct dentry *root = minor->debugfs_root;
+
+	drm_debugfs_create_files(debugfs_list,
+				 ARRAY_SIZE(debugfs_list),
+				 root, minor);
+}
+
 void xe_debugfs_register(struct xe_device *xe)
 {
 	struct ttm_device *bdev = &xe->ttm;
@@ -104,10 +114,6 @@ void xe_debugfs_register(struct xe_device *xe)
 	u32 mem_type;
 	u8 id;
 
-	drm_debugfs_create_files(debugfs_list,
-				 ARRAY_SIZE(debugfs_list),
-				 root, minor);
-
 	debugfs_create_file("forcewake_all", 0400, root, xe,
 			    &forcewake_all_fops);
 
diff --git a/drivers/gpu/drm/xe/xe_debugfs.h b/drivers/gpu/drm/xe/xe_debugfs.h
index 715b8e2e0bd9..5fe31520ac98 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.h
+++ b/drivers/gpu/drm/xe/xe_debugfs.h
@@ -8,6 +8,7 @@
 
 struct xe_device;
 
+void xe_debugfs_register_early(struct xe_device *xe);
 void xe_debugfs_register(struct xe_device *xe);
 
 #endif
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index c968c9a19de3..f8ca179254fa 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -452,6 +452,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	xe_display_info_init(xe);
 
+	xe_debugfs_register_early(xe);
+
 	err = xe_device_init(xe);
 	if (err)
 		return err;
-- 
2.38.1.143.g1fc3c0ad40



More information about the Intel-xe mailing list