From: "Christian König" <christian.koenig@amd.com>
To: Sunil Khatri <sunil.khatri@amd.com>, dri-devel@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org, simona@ffwll.ch,
tzimmermann@suse.de, tursulin@ursulin.net, phasta@kernel.org,
dakr@kernel.org
Subject: Re: [PATCH v7 1/5] drm: move the debugfs accel driver code to drm layer
Date: Mon, 30 Jun 2025 20:34:39 +0200 [thread overview]
Message-ID: <d8ade1e5-c173-434c-bb81-e1365a5ec339@amd.com> (raw)
In-Reply-To: <20250630143613.2520111-1-sunil.khatri@amd.com>
On 30.06.25 16:36, Sunil Khatri wrote:
> Move the debugfs accel driver code to the drm layer
> and it is an intermediate step to move all debugfs
> related handling into drm_debugfs.c
>
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/accel/drm_accel.c | 16 ----------------
> drivers/gpu/drm/drm_drv.c | 6 +++++-
> include/drm/drm_accel.h | 5 -----
> 3 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/accel/drm_accel.c b/drivers/accel/drm_accel.c
> index aa826033b0ce..ca3357acd127 100644
> --- a/drivers/accel/drm_accel.c
> +++ b/drivers/accel/drm_accel.c
> @@ -20,8 +20,6 @@
>
> DEFINE_XARRAY_ALLOC(accel_minors_xa);
>
> -static struct dentry *accel_debugfs_root;
> -
> static const struct device_type accel_sysfs_device_minor = {
> .name = "accel_minor"
> };
> @@ -73,17 +71,6 @@ static const struct drm_info_list accel_debugfs_list[] = {
> };
> #define ACCEL_DEBUGFS_ENTRIES ARRAY_SIZE(accel_debugfs_list)
>
> -/**
> - * accel_debugfs_init() - Initialize debugfs for device
> - * @dev: Pointer to the device instance.
> - *
> - * This function creates a root directory for the device in debugfs.
> - */
> -void accel_debugfs_init(struct drm_device *dev)
> -{
> - drm_debugfs_dev_init(dev, accel_debugfs_root);
> -}
> -
As pointed out by somebody on the mailing list this doesn't remove the accel_debugfs_init() dummy which is used when CONFIG_DRM_ACCEL isn't enabled.
> /**
> * accel_debugfs_register() - Register debugfs for device
> * @dev: Pointer to the device instance.
> @@ -194,7 +181,6 @@ static const struct file_operations accel_stub_fops = {
> void accel_core_exit(void)
> {
> unregister_chrdev(ACCEL_MAJOR, "accel");
> - debugfs_remove(accel_debugfs_root);
> accel_sysfs_destroy();
> WARN_ON(!xa_empty(&accel_minors_xa));
> }
> @@ -209,8 +195,6 @@ int __init accel_core_init(void)
> goto error;
> }
>
> - accel_debugfs_root = debugfs_create_dir("accel", NULL);
> -
> ret = register_chrdev(ACCEL_MAJOR, "accel", &accel_stub_fops);
> if (ret < 0)
> DRM_ERROR("Cannot register ACCEL major: %d\n", ret);
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 17fc5dc708f4..5d57b622f9aa 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -70,6 +70,7 @@ DEFINE_XARRAY_ALLOC(drm_minors_xa);
> static bool drm_core_init_complete;
>
> static struct dentry *drm_debugfs_root;
> +static struct dentry *accel_debugfs_root;
>
> DEFINE_STATIC_SRCU(drm_unplug_srcu);
>
> @@ -752,7 +753,7 @@ static int drm_dev_init(struct drm_device *dev,
> }
>
> if (drm_core_check_feature(dev, DRIVER_COMPUTE_ACCEL))
> - accel_debugfs_init(dev);
> + drm_debugfs_dev_init(dev, accel_debugfs_root);
> else
> drm_debugfs_dev_init(dev, drm_debugfs_root);
>
> @@ -1166,6 +1167,7 @@ static void drm_core_exit(void)
> {
> drm_privacy_screen_lookup_exit();
> drm_panic_exit();
> + debugfs_remove(accel_debugfs_root);
> accel_core_exit();
> unregister_chrdev(DRM_MAJOR, "drm");
> debugfs_remove(drm_debugfs_root);
> @@ -1193,6 +1195,8 @@ static int __init drm_core_init(void)
> if (ret < 0)
> goto error;
>
> + accel_debugfs_root = debugfs_create_dir("accel", NULL);
> +
We should potentially make that depend on CONFIG_DRM_ACCEL.
Probably best to merge the first and second patch, this also avoids the question why we have the first patch.
Regards,
Christian.
> ret = accel_core_init();
> if (ret < 0)
> goto error;
> diff --git a/include/drm/drm_accel.h b/include/drm/drm_accel.h
> index 038ccb02f9a3..20a665ec6f16 100644
> --- a/include/drm/drm_accel.h
> +++ b/include/drm/drm_accel.h
> @@ -58,7 +58,6 @@ void accel_core_exit(void);
> int accel_core_init(void);
> void accel_set_device_instance_params(struct device *kdev, int index);
> int accel_open(struct inode *inode, struct file *filp);
> -void accel_debugfs_init(struct drm_device *dev);
> void accel_debugfs_register(struct drm_device *dev);
>
> #else
> @@ -77,10 +76,6 @@ static inline void accel_set_device_instance_params(struct device *kdev, int ind
> {
> }
>
> -static inline void accel_debugfs_init(struct drm_device *dev)
> -{
> -}
> -
> static inline void accel_debugfs_register(struct drm_device *dev)
> {
> }
next prev parent reply other threads:[~2025-06-30 18:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 14:36 [PATCH v7 1/5] drm: move the debugfs accel driver code to drm layer Sunil Khatri
2025-06-30 14:36 ` [PATCH v7 2/5] drm: move debugfs functionality from drm_drv.c to drm_debugfs.c Sunil Khatri
2025-06-30 14:36 ` [PATCH v7 3/5] drm: add debugfs support on per client-id basis Sunil Khatri
2025-06-30 14:36 ` [PATCH v7 4/5] drm/amdgpu: add debugfs support for VM pagetable per client Sunil Khatri
2025-06-30 14:36 ` [PATCH v7 5/5] drm/amdgpu: add support of debugfs for mqd information Sunil Khatri
2025-06-30 15:19 ` [PATCH v7 1/5] drm: move the debugfs accel driver code to drm layer Jeff Hugo
2025-07-01 6:14 ` Khatri, Sunil
2025-07-01 15:23 ` Jeff Hugo
2025-06-30 18:34 ` Christian König [this message]
2025-07-01 6:19 ` Khatri, Sunil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8ade1e5-c173-434c-bb81-e1365a5ec339@amd.com \
--to=christian.koenig@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=sunil.khatri@amd.com \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.