Skip to content

Commit e22d7ac

Browse files
aradhyab7Thomas Hellström
authored andcommitted
drm/xe/guc: Make creation of SLPC debugfs files conditional
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: aaab540 ("drm/xe: Introduce GuC PC debugfs") Suggested-by: Matt Roper <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Reviewed-by: Stuart Summers <[email protected]> Signed-off-by: Aradhya Bhatia <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Matt Roper <[email protected]> (cherry picked from commit 17486cf) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 1faeeb3 commit e22d7ac

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/gpu/drm/xe/xe_guc_debugfs.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,34 @@ static const struct drm_info_list vf_safe_debugfs_list[] = {
113113
{ "guc_ctb", .show = guc_debugfs_show, .data = guc_ctb },
114114
};
115115

116+
/* For GuC debugfs files that require the SLPC support */
117+
static const struct drm_info_list slpc_debugfs_list[] = {
118+
{ "guc_pc", .show = guc_debugfs_show, .data = guc_pc },
119+
};
120+
116121
/* everything else should be added here */
117122
static const struct drm_info_list pf_only_debugfs_list[] = {
118123
{ "guc_log", .show = guc_debugfs_show, .data = guc_log },
119124
{ "guc_log_dmesg", .show = guc_debugfs_show, .data = guc_log_dmesg },
120-
{ "guc_pc", .show = guc_debugfs_show, .data = guc_pc },
121125
};
122126

123127
void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
124128
{
125-
struct drm_minor *minor = guc_to_xe(guc)->drm.primary;
129+
struct xe_device *xe = guc_to_xe(guc);
130+
struct drm_minor *minor = xe->drm.primary;
126131

127132
drm_debugfs_create_files(vf_safe_debugfs_list,
128133
ARRAY_SIZE(vf_safe_debugfs_list),
129134
parent, minor);
130135

131-
if (!IS_SRIOV_VF(guc_to_xe(guc)))
136+
if (!IS_SRIOV_VF(xe)) {
132137
drm_debugfs_create_files(pf_only_debugfs_list,
133138
ARRAY_SIZE(pf_only_debugfs_list),
134139
parent, minor);
140+
141+
if (!xe->info.skip_guc_pc)
142+
drm_debugfs_create_files(slpc_debugfs_list,
143+
ARRAY_SIZE(slpc_debugfs_list),
144+
parent, minor);
145+
}
135146
}

0 commit comments

Comments
 (0)