Re: [PATCH v3 2/4] drm/xe/sysctrl: Add sysctrl debugfs infrastructure

Rodrigo Vivi <[email protected]>
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
On Fri, Aug 07, 2026 at 07:56:23AM -0700, Anoop, Vijay wrote:
> From: Anoop Vijay <[email protected]>
> 
> Add basic debugfs support for sysctrl. This patch adds necessary
> types and registration hooks.
> 
> Changes:
> - Add debugfs structure to xe_sysctrl_types.h
> - Add xe_sysctrl_debugfs.h header
> - Add xe_sysctrl_debugfs_register() stub
> - Wire up sysctrl debugfs registration
> 
> No functional changes, debugfs directory created but empty.

I know that we all keep asking smaller patches that are easier
to review. But as everything in life, we need to find the good
balance. In this case I believe it would be good if this was
squashed with the patch 3...

(more below)

> 
> Signed-off-by: Anoop Vijay <[email protected]>
> ---
>  drivers/gpu/drm/xe/Makefile             |  1 +
>  drivers/gpu/drm/xe/xe_debugfs.c         |  5 +++++
>  drivers/gpu/drm/xe/xe_sysctrl_debugfs.c | 27 +++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_sysctrl_debugfs.h | 14 +++++++++++++
>  drivers/gpu/drm/xe/xe_sysctrl_types.h   |  7 +++++++
>  5 files changed, 54 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
>  create mode 100644 drivers/gpu/drm/xe/xe_sysctrl_debugfs.h
> 
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 44ed055439d4..f083451608ff 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -127,6 +127,7 @@ xe-y += xe_bb.o \
>  	xe_survivability_mode.o \
>  	xe_sync.o \
>  	xe_sysctrl.o \
> +	xe_sysctrl_debugfs.o \
>  	xe_sysctrl_event.o \
>  	xe_sysctrl_mailbox.o \
>  	xe_tile.o \
> diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
> index 8de78cd0aa03..666290d83bfe 100644
> --- a/drivers/gpu/drm/xe/xe_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_debugfs.c
> @@ -30,6 +30,8 @@
>  #include "xe_sriov_pf_debugfs.h"
>  #include "xe_sriov_vf.h"
>  #include "xe_step.h"
> +#include "xe_sysctrl.h"
> +#include "xe_sysctrl_debugfs.h"
>  #include "xe_tile_debugfs.h"
>  #include "xe_vsec.h"
>  #include "xe_wa.h"
> @@ -770,6 +772,9 @@ void xe_debugfs_register(struct xe_device *xe)
>  
>  	xe_fault_inject_debugfs_register(xe, root);
>  
> +	if (xe->info.has_sysctrl)
> +		xe_sysctrl_debugfs_register(&xe->sc, root);

Here is where you put the check if the fw is loaded... ideally...

> +
>  	if (IS_SRIOV_PF(xe))
>  		xe_sriov_pf_debugfs_register(xe, root);
>  	else if (IS_SRIOV_VF(xe))
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> new file mode 100644
> index 000000000000..0238ff093831
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> @@ -0,0 +1,27 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#include <linux/debugfs.h>
> +
> +#include "xe_device.h"
> +#include "xe_sysctrl.h"
> +#include "xe_sysctrl_debugfs.h"
> +#include "xe_sysctrl_types.h"
> +
> +/**
> + * xe_sysctrl_debugfs_register - Register debugfs entries for System Controller
> + * @sc: xe_sysctrl instance
> + * @parent: parent debugfs directory
> + */
> +void xe_sysctrl_debugfs_register(struct xe_sysctrl *sc, struct dentry *parent)
> +{
> +	struct dentry *root;
> +
> +	root = debugfs_create_dir("sc", parent);
> +	if (IS_ERR(root))
> +		return;
> +
> +	sc->debugfs.root = root;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.h b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.h
> new file mode 100644
> index 000000000000..d1414ac3562e
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef _XE_SYSCTRL_DEBUGFS_H_
> +#define _XE_SYSCTRL_DEBUGFS_H_
> +
> +struct dentry;
> +struct xe_sysctrl;
> +
> +void xe_sysctrl_debugfs_register(struct xe_sysctrl *sc, struct dentry *parent);
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_types.h b/drivers/gpu/drm/xe/xe_sysctrl_types.h
> index 66ba24f43017..d50a35fefb7a 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_types.h
> @@ -11,6 +11,7 @@
>  #include <linux/workqueue_types.h>
>  
>  struct xe_mmio;
> +struct dentry;
>  
>  /**
>   * struct xe_sysctrl - System Controller driver context
> @@ -34,6 +35,12 @@ struct xe_sysctrl {
>  
>  	/** @event_lock: Mutex protecting pending events */
>  	struct mutex event_lock;
> +
> +	/** @debugfs: Debugfs entries */
> +	struct {
> +		/** @debugfs.root: Root debugfs directory */
> +		struct dentry *root;
> +	} debugfs;
>  };
>  
>  #endif
> -- 
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.