[PATCH 3/3] drm/xe/vf: Don't expose privileged GT debugfs files if VF

Lucas De Marchi lucas.demarchi at intel.com
Fri Mar 21 16:55:24 UTC 2025


On Thu, Mar 20, 2025 at 10:07:38PM +0100, Michal Wajdeczko wrote:
>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 <michal.wajdeczko at intel.com>
>Cc: Marcin Bernatowicz <marcin.bernatowicz at linux.intel.com>
>---
> drivers/gpu/drm/xe/xe_gt_debugfs.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
>index 2d63a69cbfa3..789d463fe395 100644
>--- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
>+++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
>@@ -300,19 +300,14 @@ static int hwconfig(struct xe_gt *gt, struct drm_printer *p)
> }
>
> static const struct drm_info_list debugfs_list[] = {
>-	{"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
> 	{"force_reset", .show = xe_gt_debugfs_simple_show, .data = force_reset},
> 	{"force_reset_sync", .show = xe_gt_debugfs_simple_show, .data = force_reset_sync},
> 	{"sa_info", .show = xe_gt_debugfs_simple_show, .data = sa_info},
> 	{"topology", .show = xe_gt_debugfs_simple_show, .data = topology},
>-	{"steering", .show = xe_gt_debugfs_simple_show, .data = steering},
> 	{"ggtt", .show = xe_gt_debugfs_simple_show, .data = ggtt},
>-	{"powergate_info", .show = xe_gt_debugfs_simple_show, .data = powergate_info},
> 	{"register-save-restore", .show = xe_gt_debugfs_simple_show, .data = register_save_restore},
> 	{"workarounds", .show = xe_gt_debugfs_simple_show, .data = workarounds},
> 	{"tunings", .show = xe_gt_debugfs_simple_show, .data = tunings},
>-	{"pat", .show = xe_gt_debugfs_simple_show, .data = pat},
>-	{"mocs", .show = xe_gt_debugfs_simple_show, .data = mocs},
> 	{"default_lrc_rcs", .show = xe_gt_debugfs_simple_show, .data = rcs_default_lrc},
> 	{"default_lrc_ccs", .show = xe_gt_debugfs_simple_show, .data = ccs_default_lrc},
> 	{"default_lrc_bcs", .show = xe_gt_debugfs_simple_show, .data = bcs_default_lrc},
>@@ -322,6 +317,14 @@ static const struct drm_info_list debugfs_list[] = {
> 	{"hwconfig", .show = xe_gt_debugfs_simple_show, .data = hwconfig},
> };
>
>+static const struct drm_info_list privileged_list[] = {

"privileged" may not be a good word? How are devs supposed to know
what is or is not available on VF and that "privileged" here has nothing
to do with userspace access but rahter it's about pf/native only things.

/*
  * <document here something to hint developers where to add new files>
  */
static const struct drm_info_list vf_safe_debugfs_list[] = {
};

static const struct drm_info_list pf_only_debugfs_list[] = {
};

Another possible idea: would it make sense to add a flag in
drm.driver_features to note if the driver if pf/vf? That way we may
simplify other places and then here we could just do:

	{ {"steering", .show = xe_gt_debugfs_simple_show, .data = steering,
	   .driver_features = DRIVER_SRIOV_PF },
	   ...
	}

instead of splitting the array.

pass by comment since I was involved in other threads related to default
context in PTL... Are these default_lrc_* accurate from the VF point of
view? Are they different from the ones for PF?

Lucas De Marchi

>+	{"hw_engines", .show = xe_gt_debugfs_simple_show, .data = hw_engines},
>+	{"mocs", .show = xe_gt_debugfs_simple_show, .data = mocs},
>+	{"pat", .show = xe_gt_debugfs_simple_show, .data = pat},
>+	{"powergate_info", .show = xe_gt_debugfs_simple_show, .data = powergate_info},
>+	{"steering", .show = xe_gt_debugfs_simple_show, .data = steering},
>+};
>+
> void xe_gt_debugfs_register(struct xe_gt *gt)
> {
> 	struct xe_device *xe = gt_to_xe(gt);
>@@ -349,6 +352,11 @@ void xe_gt_debugfs_register(struct xe_gt *gt)
> 				 ARRAY_SIZE(debugfs_list),
> 				 root, minor);
>
>+	if (!IS_SRIOV_VF(xe))
>+		drm_debugfs_create_files(privileged_list,
>+					 ARRAY_SIZE(privileged_list),
>+					 root, minor);
>+
> 	xe_uc_debugfs_register(&gt->uc, root);
>
> 	if (IS_SRIOV_PF(xe))
>-- 
>2.47.1
>


More information about the Intel-xe mailing list