[PATCH 1/3] drm/xe/guc: Refactor GuC debugfs initialization
Lucas De Marchi
lucas.demarchi at intel.com
Fri Mar 21 16:37:37 UTC 2025
On Thu, Mar 20, 2025 at 10:07:36PM +0100, Michal Wajdeczko wrote:
>We don't have to drmm_kmalloc() local copy of debugfs_list to
>write there our pointer to the struct xe_guc as we can extract
>pointer to the struct xe_gt from the grandparent debugfs entry,
>in similar way to what we did for GT debugfs files.
Please add something like this here:
No change in file/directory structure, just refactor how they are
created and used.
>
>Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>---
> drivers/gpu/drm/xe/xe_guc_debugfs.c | 94 ++++++++++-------------------
> 1 file changed, 31 insertions(+), 63 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_guc_debugfs.c b/drivers/gpu/drm/xe/xe_guc_debugfs.c
>index c569ff456e74..d59408ef0b9d 100644
>--- a/drivers/gpu/drm/xe/xe_guc_debugfs.c
>+++ b/drivers/gpu/drm/xe/xe_guc_debugfs.c
>@@ -17,101 +17,69 @@
> #include "xe_macros.h"
> #include "xe_pm.h"
>
>-static struct xe_guc *node_to_guc(struct drm_info_node *node)
>+/*
>+ * /sys/kernel/debug/dri/0/
>+ * ├── gt0
>+ * │ ├── uc
>+ * │ │ ├── guc_info
>+ * │ │ ├── guc_...
>+ */
>+
>+static int guc_debugfs_show(struct seq_file *m, void *data)
> {
>- return node->info_ent->data;
>-}
>-
>-static int guc_info(struct seq_file *m, void *data)
>-{
>- struct xe_guc *guc = node_to_guc(m->private);
>- struct xe_device *xe = guc_to_xe(guc);
> struct drm_printer p = drm_seq_file_printer(m);
>+ struct drm_info_node *node = m->private;
>+ struct dentry *parent = node->dent->d_parent;
>+ struct dentry *grandparent = parent->d_parent;
>+ struct xe_gt *gt = grandparent->d_inode->i_private;
>+ struct xe_device *xe = gt_to_xe(gt);
>+ int (*print)(struct xe_guc *, struct drm_printer *) = node->info_ent->data;
I was a bit nervous when that was done for gt. As I am for guc.
There are several type assumptions here. Like is done for
xe_gt_debugfs_simple_show, please add documentation, even if not
kernel-doc.
Other than those comments, Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
thanks
Lucas De Marchi
More information about the Intel-xe
mailing list