]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/guc: Make creation of SLPC debugfs files conditional
authorAradhya Bhatia <aradhya.bhatia@intel.com>
Fri, 16 May 2025 14:19:02 +0000 (14:19 +0000)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 23 May 2025 07:40:55 +0000 (09:40 +0200)
Platforms that do not support SLPC are exempted from the GuC PC support.
The GuC PC does not get initialized, and neither do its BOs get created.

This causes a problem because the GuC PC debugfs file is still being
created. Whenever the file is attempted to read, it causes a NULL
pointer dereference on the supposed BO of the GuC PC.

So, make the creation of SLPC debugfs files conditional to when SLPC
features are supported.

Fixes: aaab5404b16f ("drm/xe: Introduce GuC PC debugfs")
Suggested-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Signed-off-by: Aradhya Bhatia <aradhya.bhatia@intel.com>
Link: https://lore.kernel.org/r/20250516141902.5614-1-aradhya.bhatia@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
(cherry picked from commit 17486cf3df5320752cc67ee8bcb2379d1b9de76c)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
drivers/gpu/drm/xe/xe_guc_debugfs.c

index f33013f8a0f38a3091e5e99c405ed84f2c16da0b..0b102ab46c4df214ac5fb3f38e7bbd74b3b0cb14 100644 (file)
@@ -113,23 +113,34 @@ static const struct drm_info_list vf_safe_debugfs_list[] = {
        { "guc_ctb", .show = guc_debugfs_show, .data = guc_ctb },
 };
 
+/* For GuC debugfs files that require the SLPC support */
+static const struct drm_info_list slpc_debugfs_list[] = {
+       { "guc_pc", .show = guc_debugfs_show, .data = guc_pc },
+};
+
 /* everything else should be added here */
 static const struct drm_info_list pf_only_debugfs_list[] = {
        { "guc_log", .show = guc_debugfs_show, .data = guc_log },
        { "guc_log_dmesg", .show = guc_debugfs_show, .data = guc_log_dmesg },
-       { "guc_pc", .show = guc_debugfs_show, .data = guc_pc },
 };
 
 void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
 {
-       struct drm_minor *minor = guc_to_xe(guc)->drm.primary;
+       struct xe_device *xe =  guc_to_xe(guc);
+       struct drm_minor *minor = xe->drm.primary;
 
        drm_debugfs_create_files(vf_safe_debugfs_list,
                                 ARRAY_SIZE(vf_safe_debugfs_list),
                                 parent, minor);
 
-       if (!IS_SRIOV_VF(guc_to_xe(guc)))
+       if (!IS_SRIOV_VF(xe)) {
                drm_debugfs_create_files(pf_only_debugfs_list,
                                         ARRAY_SIZE(pf_only_debugfs_list),
                                         parent, minor);
+
+               if (!xe->info.skip_guc_pc)
+                       drm_debugfs_create_files(slpc_debugfs_list,
+                                                ARRAY_SIZE(slpc_debugfs_list),
+                                                parent, minor);
+       }
 }