Skip to content

Commit d11c5a9

Browse files
committed
drm/xe/vf: Don't expose privileged GT debugfs files if VF
Some of the debugfs files require access to the registers that are not accessible to the VFs. Don't expose those files on VF drivers. Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Marcin Bernatowicz <[email protected]> Cc: Lucas De Marchi <[email protected]> Tested-by: Marcin Bernatowicz <[email protected]> Reviewed-by: Marcin Bernatowicz <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3874449 commit d11c5a9

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

drivers/gpu/drm/xe/xe_gt_debugfs.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,20 @@ static int hwconfig(struct xe_gt *gt, struct drm_printer *p)
299299
return 0;
300300
}
301301

302-
static const struct drm_info_list debugfs_list[] = {
303-
{"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
302+
/*
303+
* only for GT debugfs files which can be safely used on the VF as well:
304+
* - without access to the GT privileged registers
305+
* - without access to the PF specific data
306+
*/
307+
static const struct drm_info_list vf_safe_debugfs_list[] = {
304308
{"force_reset", .show = xe_gt_debugfs_simple_show, .data = force_reset},
305309
{"force_reset_sync", .show = xe_gt_debugfs_simple_show, .data = force_reset_sync},
306310
{"sa_info", .show = xe_gt_debugfs_simple_show, .data = sa_info},
307311
{"topology", .show = xe_gt_debugfs_simple_show, .data = topology},
308-
{"steering", .show = xe_gt_debugfs_simple_show, .data = steering},
309312
{"ggtt", .show = xe_gt_debugfs_simple_show, .data = ggtt},
310-
{"powergate_info", .show = xe_gt_debugfs_simple_show, .data = powergate_info},
311313
{"register-save-restore", .show = xe_gt_debugfs_simple_show, .data = register_save_restore},
312314
{"workarounds", .show = xe_gt_debugfs_simple_show, .data = workarounds},
313315
{"tunings", .show = xe_gt_debugfs_simple_show, .data = tunings},
314-
{"pat", .show = xe_gt_debugfs_simple_show, .data = pat},
315-
{"mocs", .show = xe_gt_debugfs_simple_show, .data = mocs},
316316
{"default_lrc_rcs", .show = xe_gt_debugfs_simple_show, .data = rcs_default_lrc},
317317
{"default_lrc_ccs", .show = xe_gt_debugfs_simple_show, .data = ccs_default_lrc},
318318
{"default_lrc_bcs", .show = xe_gt_debugfs_simple_show, .data = bcs_default_lrc},
@@ -322,6 +322,15 @@ static const struct drm_info_list debugfs_list[] = {
322322
{"hwconfig", .show = xe_gt_debugfs_simple_show, .data = hwconfig},
323323
};
324324

325+
/* everything else should be added here */
326+
static const struct drm_info_list pf_only_debugfs_list[] = {
327+
{"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
328+
{"mocs", .show = xe_gt_debugfs_simple_show, .data = mocs},
329+
{"pat", .show = xe_gt_debugfs_simple_show, .data = pat},
330+
{"powergate_info", .show = xe_gt_debugfs_simple_show, .data = powergate_info},
331+
{"steering", .show = xe_gt_debugfs_simple_show, .data = steering},
332+
};
333+
325334
void xe_gt_debugfs_register(struct xe_gt *gt)
326335
{
327336
struct xe_device *xe = gt_to_xe(gt);
@@ -345,10 +354,15 @@ void xe_gt_debugfs_register(struct xe_gt *gt)
345354
*/
346355
root->d_inode->i_private = gt;
347356

348-
drm_debugfs_create_files(debugfs_list,
349-
ARRAY_SIZE(debugfs_list),
357+
drm_debugfs_create_files(vf_safe_debugfs_list,
358+
ARRAY_SIZE(vf_safe_debugfs_list),
350359
root, minor);
351360

361+
if (!IS_SRIOV_VF(xe))
362+
drm_debugfs_create_files(pf_only_debugfs_list,
363+
ARRAY_SIZE(pf_only_debugfs_list),
364+
root, minor);
365+
352366
xe_uc_debugfs_register(&gt->uc, root);
353367

354368
if (IS_SRIOV_PF(xe))

0 commit comments

Comments
 (0)