accel/ivpu: Update debugfs to latest changes in DRM
PATCH 1/2 accel/ivpu: Update debugfs to latest changes in DRM
Use new drm debugfs helpers. This is needed after changes from commit 78346ebf9f94 ("drm/debugfs: drop debugfs_init() for the render and accel node v2").
--- drivers/accel/ivpu/ivpu_debugfs.c | 50 +++++++++++++++---------------- drivers/accel/ivpu/ivpu_debugfs.h | 4 +-- drivers/accel/ivpu/ivpu_drv.c | 8 ++--- 3 files changed, 30 insertions(+), 32 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +24 -26
@@ -17,20 +17,26 @@#include "ivpu_jsm_msg.h" #include "ivpu_pm.h" +static inline struct ivpu_device *seq_to_ivpu (struct seq_file *s) +{ +struct drm_debugfs_entry *entry = s->private; + +return to_ivpu_device (entry->dev); +} +static int bo_list_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private;struct drm_printer p =drm_seq_file_printer (s); +struct ivpu_device *vdev =seq_to_ivpu (s); -ivpu_bo_list (node->minor->dev, &p); +ivpu_bo_list (&vdev->drm, &p);return 0 ; }static int fw_name_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);seq_printf (s,"%s\n" , vdev->fw->name);return 0 ;
@@ -38,8 +44,7 @@ static int fw_name_show(struct seq_file *s, void *v)static int fw_trace_capability_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);u64 trace_hw_component_mask;u32 trace_destination_mask;int ret;
@@ -57,8 +62,7 @@ static int fw_trace_capability_show(struct seq_file *s, void *v)static int fw_trace_config_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);/** * WA: VPU_JSM_MSG_TRACE_GET_CONFIG command is not working yet, * so we use values from vdev->fw instead of calling ivpu_jsm_trace_get_config()
@@ -78,8 +82,7 @@ static int fw_trace_config_show(struct seq_file *s, void *v)static int last_bootmode_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);seq_printf (s,"%s\n" , (vdev->pm->is_warmboot) ?"warmboot" :"coldboot" );
@@ -88,8 +91,7 @@ static int last_bootmode_show(struct seq_file *s, void *v)static int reset_counter_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);seq_printf (s,"%d\n" ,atomic_read (&vdev->pm->reset_counter));return 0 ;
@@ -97,14 +99,13 @@ static int reset_counter_show(struct seq_file *s, void *v)static int reset_pending_show (struct seq_file *s,void *v) { -struct drm_info_node *node = (struct drm_info_node *)s->private; -struct ivpu_device *vdev =to_ivpu_device (node->minor->dev); +struct ivpu_device *vdev =seq_to_ivpu (s);seq_printf (s,"%d\n" ,atomic_read (&vdev->pm->in_reset));return 0 ; } -static const struct drm_info_list vdev_debugfs_list[] = { +static const struct drm_debugfs_info vdev_debugfs_list[] = { {"bo_list" , bo_list_show,0 }, {"fw_name" , fw_name_show,0 }, {"fw_trace_capability" , fw_trace_capability_show,0 },
@@ -270,25 +271,22 @@ static const struct file_operations ivpu_reset_engine_fops = { .write = ivpu_reset_engine_fn, }; -void ivpu_debugfs_init (struct drm_minor *minor) +void ivpu_debugfs_init (struct ivpu_device *vdev) { -struct ivpu_device *vdev =to_ivpu_device (minor->dev); - -drm_debugfs_create_files (vdev_debugfs_list,ARRAY_SIZE (vdev_debugfs_list), - minor->debugfs_root, minor); +drm_debugfs_add_files (&vdev->drm, vdev_debugfs_list,ARRAY_SIZE (vdev_debugfs_list)); -debugfs_create_file ("force_recovery" ,0200 , minor->debugfs_root, vdev, +debugfs_create_file ("force_recovery" ,0200 , vdev->drm.debugfs_root, vdev, &ivpu_force_recovery_fops); -debugfs_create_file ("fw_log" ,0644 , minor->debugfs_root, vdev, +debugfs_create_file ("fw_log" ,0644 , vdev->drm.debugfs_root, vdev, &fw_log_fops); -debugfs_create_file ("fw_trace_destination_mask" ,0200 , minor->debugfs_root, vdev, +debugfs_create_file ("fw_trace_destination_mask" ,0200 , vdev->drm.debugfs_root, vdev, &fw_trace_destination_mask_fops); -debugfs_create_file ("fw_trace_hw_comp_mask" ,0200 , minor->debugfs_root, vdev, +debugfs_create_file ("fw_trace_hw_comp_mask" ,0200 , vdev->drm.debugfs_root, vdev, &fw_trace_hw_comp_mask_fops); -debugfs_create_file ("fw_trace_level" ,0200 , minor->debugfs_root, vdev, +debugfs_create_file ("fw_trace_level" ,0200 , vdev->drm.debugfs_root, vdev, &fw_trace_level_fops); -debugfs_create_file ("reset_engine" ,0200 , minor->debugfs_root, vdev, +debugfs_create_file ("reset_engine" ,0200 , vdev->drm.debugfs_root, vdev, &ivpu_reset_engine_fops); }
drivers/accel/ivpu/ivpu_debugfs.h +2 -2
@@ -6,8 +6,8 @@#ifndef __IVPU_DEBUGFS_H__#define __IVPU_DEBUGFS_H__ -struct drm_minor ; +struct ivpu_device ; -void ivpu_debugfs_init (struct drm_minor *minor); +void ivpu_debugfs_init (struct ivpu_device *vdev);#endif /* __IVPU_DEBUGFS_H__ */
drivers/accel/ivpu/ivpu_drv.c +4 -4
@@ -395,10 +395,6 @@ static const struct drm_driver driver = { .postclose = ivpu_postclose, .gem_prime_import = ivpu_gem_prime_import, -#if defined(CONFIG_DEBUG_FS) - .debugfs_init = ivpu_debugfs_init, -#endif - .ioctls = ivpu_drm_ioctls, .num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls), .fops = &ivpu_fops,
@@ -631,6 +627,10 @@ static int ivpu_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret)return ret; +#if defined(CONFIG_DEBUG_FS ) +ivpu_debugfs_init (vdev); +#endif + ret =drm_dev_register (&vdev->drm,0 );if (ret) {dev_err (&pdev->dev,"Failed to register DRM device: %d\n" , ret);
Signature · 1 line
2.25.1
PATCH 2/2 accel/ivpu: Compile ivpu_debugfs.c conditionally
Only compile ivpu_debugfs.c file with CONFIG_DEBUG_FS.
--- drivers/accel/ivpu/Makefile | 3 ++- drivers/accel/ivpu/ivpu_debugfs.h | 4 ++++ drivers/accel/ivpu/ivpu_drv.c | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/accel/ivpu/Makefile +2 -1
@@ -2,7 +2,6 @@ # Copyright (C) 2023 Intel Corporation intel_vpu-y := \ - ivpu_debugfs.o \ ivpu_drv.o \ ivpu_fw.o \ ivpu_fw_log.o \
@@ -16,4 +15,6 @@ intel_vpu-y := \ ivpu_mmu_context.o \ ivpu_pm.o +intel_vpu-$(CONFIG_DEBUG_FS) += ivpu_debugfs.o + obj-$(CONFIG_DRM_ACCEL_IVPU) += intel_vpu.o
drivers/accel/ivpu/ivpu_debugfs.h +4 -0
@@ -8,6 +8,10 @@struct ivpu_device ; +#if defined(CONFIG_DEBUG_FS )void ivpu_debugfs_init (struct ivpu_device *vdev); +#else +static inline void ivpu_debugfs_init (struct ivpu_device *vdev) { } +#endif #endif /* __IVPU_DEBUGFS_H__ */
drivers/accel/ivpu/ivpu_drv.c +0 -2
@@ -627,9 +627,7 @@ static int ivpu_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret)return ret; -#if defined(CONFIG_DEBUG_FS )ivpu_debugfs_init (vdev); -#endif ret =drm_dev_register (&vdev->drm,0 );if (ret) {
Signature · 1 line
2.25.1
Re: [PATCH 2/2] accel/ivpu: Compile ivpu_debugfs.c conditionally
Quoted 3 lines · Stanislaw Gruszka
Only compile
ivpu_debugfs.cfile withCONFIG_DEBUG_FS.Signed-off-by Stanislaw Gruszka <[email protected]>
[PATCH 3/2] accel/ivpu: Use local variable for debugfs root
In reply to Stanislaw GruszkaUse local variable for debugfs root, just to make further changes easier.
---
I'll squash that patch into patch 1
drivers/accel/ivpu/ivpu_debugfs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +8 -6
@@ -273,20 +273,22 @@ static const struct file_operations ivpu_reset_engine_fops = {void ivpu_debugfs_init (struct ivpu_device *vdev) { +struct dentry *debugfs_root = vdev->drm.debugfs_root; +drm_debugfs_add_files (&vdev->drm, vdev_debugfs_list,ARRAY_SIZE (vdev_debugfs_list)); -debugfs_create_file ("force_recovery" ,0200 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("force_recovery" ,0200 , debugfs_root, vdev, &ivpu_force_recovery_fops); -debugfs_create_file ("fw_log" ,0644 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("fw_log" ,0644 , debugfs_root, vdev, &fw_log_fops); -debugfs_create_file ("fw_trace_destination_mask" ,0200 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("fw_trace_destination_mask" ,0200 , debugfs_root, vdev, &fw_trace_destination_mask_fops); -debugfs_create_file ("fw_trace_hw_comp_mask" ,0200 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("fw_trace_hw_comp_mask" ,0200 , debugfs_root, vdev, &fw_trace_hw_comp_mask_fops); -debugfs_create_file ("fw_trace_level" ,0200 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("fw_trace_level" ,0200 , debugfs_root, vdev, &fw_trace_level_fops); -debugfs_create_file ("reset_engine" ,0200 , vdev->drm.debugfs_root, vdev, +debugfs_create_file ("reset_engine" ,0200 , debugfs_root, vdev, &ivpu_reset_engine_fops); }
Signature · 1 line
2.25.1
Jeffrey Hugo
Reviewed-byRe: [PATCH 3/2] accel/ivpu: Use local variable for debugfs root
Quoted 4 lines · Stanislaw Gruszka
Use local variable for debugfs root, just to make further changes easier.
Signed-off-by Stanislaw Gruszka <[email protected]>
Quoted 5 lines · Stanislaw Gruszka
Use new drm debugfs helpers. This is needed after changes from commit
78346ebf9f94("drm/debugfs: dropdebugfs_init()for the render and accel node v2").Signed-off-by Stanislaw Gruszka <[email protected]>
Stanislaw Gruszka
AppliedQuoted 3 lines · Stanislaw Gruszka
Use new drm debugfs helpers. This is needed after changes from commit
78346ebf9f94("drm/debugfs: dropdebugfs_init()for the render and accel node v2").
Applied to drm-misc-next
Thanks
Stanislaw