diff options
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 84 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 33 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r420.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.h | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 47 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_dp_mst.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_fence.c | 42 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ib.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 79 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 66 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs400.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs600.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv515.c | 56 |
18 files changed, 225 insertions, 394 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 2955bb32d5ad..fcfcaec25a9e 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c @@ -32,7 +32,6 @@ #include <linux/seq_file.h> #include <linux/slab.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_fourcc.h> @@ -1121,9 +1120,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) uint32_t tmp; int r; - if (r100_debugfs_cp_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for CP !\n"); - } + r100_debugfs_cp_init(rdev); if (!rdev->me_fw) { r = r100_cp_init_microcode(rdev); if (r) { @@ -2920,11 +2917,9 @@ static void r100_set_safe_registers(struct radeon_device *rdev) * Debugfs info */ #if defined(CONFIG_DEBUG_FS) -static int r100_debugfs_rbbm_info(struct seq_file *m, void *data) +static int r100_debugfs_rbbm_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t reg, value; unsigned i; @@ -2941,11 +2936,9 @@ static int r100_debugfs_rbbm_info(struct seq_file *m, void *data) return 0; } -static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data) +static int r100_debugfs_cp_ring_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; uint32_t rdp, wdp; unsigned count, i, j; @@ -2969,11 +2962,9 @@ static int r100_debugfs_cp_ring_info(struct seq_file *m, void *data) } -static int r100_debugfs_cp_csq_fifo(struct seq_file *m, void *data) +static int r100_debugfs_cp_csq_fifo_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t csq_stat, csq2_stat, tmp; unsigned r_rptr, r_wptr, ib1_rptr, ib1_wptr, ib2_rptr, ib2_wptr; unsigned i; @@ -3019,11 +3010,9 @@ static int r100_debugfs_cp_csq_fifo(struct seq_file *m, void *data) return 0; } -static int r100_debugfs_mc_info(struct seq_file *m, void *data) +static int r100_debugfs_mc_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32(RADEON_CONFIG_MEMSIZE); @@ -3049,44 +3038,42 @@ static int r100_debugfs_mc_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list r100_debugfs_rbbm_list[] = { - {"r100_rbbm_info", r100_debugfs_rbbm_info, 0, NULL}, -}; - -static struct drm_info_list r100_debugfs_cp_list[] = { - {"r100_cp_ring_info", r100_debugfs_cp_ring_info, 0, NULL}, - {"r100_cp_csq_fifo", r100_debugfs_cp_csq_fifo, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(r100_debugfs_rbbm_info); +DEFINE_SHOW_ATTRIBUTE(r100_debugfs_cp_ring_info); +DEFINE_SHOW_ATTRIBUTE(r100_debugfs_cp_csq_fifo); +DEFINE_SHOW_ATTRIBUTE(r100_debugfs_mc_info); -static struct drm_info_list r100_debugfs_mc_info_list[] = { - {"r100_mc_info", r100_debugfs_mc_info, 0, NULL}, -}; #endif -int r100_debugfs_rbbm_init(struct radeon_device *rdev) +void r100_debugfs_rbbm_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, r100_debugfs_rbbm_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("r100_rbbm_info", 0444, root, rdev, + &r100_debugfs_rbbm_info_fops); #endif } -int r100_debugfs_cp_init(struct radeon_device *rdev) +void r100_debugfs_cp_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, r100_debugfs_cp_list, 2); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("r100_cp_ring_info", 0444, root, rdev, + &r100_debugfs_cp_ring_info_fops); + debugfs_create_file("r100_cp_csq_fifo", 0444, root, rdev, + &r100_debugfs_cp_csq_fifo_fops); #endif } -int r100_debugfs_mc_info_init(struct radeon_device *rdev) +void r100_debugfs_mc_info_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, r100_debugfs_mc_info_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("r100_mc_info", 0444, root, rdev, + &r100_debugfs_mc_info_fops); #endif } @@ -3834,15 +3821,6 @@ void r100_vga_render_disable(struct radeon_device *rdev) WREG8(R_0003C2_GENMO_WT, C_0003C2_VGA_RAM_EN & tmp); } -static void r100_debugfs(struct radeon_device *rdev) -{ - int r; - - r = r100_debugfs_mc_info_init(rdev); - if (r) - dev_warn(rdev->dev, "Failed to create r100_mc debugfs file.\n"); -} - static void r100_mc_program(struct radeon_device *rdev) { struct r100_mc_save save; @@ -4031,7 +4009,7 @@ int r100_init(struct radeon_device *rdev) int r; /* Register debugfs file specific to this group of asics */ - r100_debugfs(rdev); + r100_debugfs_mc_info_init(rdev); /* Disable VGA */ r100_vga_render_disable(rdev); /* Initialize scratch registers */ diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 213dc49b6322..92643dfdd8a8 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c @@ -32,7 +32,6 @@ #include <drm/drm.h> #include <drm/drm_crtc_helper.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/radeon_drm.h> @@ -83,7 +82,7 @@ void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) /* * rv370,rv380 PCIE GART */ -static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev); +static void rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev); void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) { @@ -140,9 +139,8 @@ int rv370_pcie_gart_init(struct radeon_device *rdev) r = radeon_gart_init(rdev); if (r) return r; - r = rv370_debugfs_pcie_gart_info_init(rdev); - if (r) - DRM_ERROR("Failed to register debugfs file for PCIE gart !\n"); + rv370_debugfs_pcie_gart_info_init(rdev); + rdev->gart.table_size = rdev->gart.num_gpu_pages * 4; rdev->asic->gart.tlb_flush = &rv370_pcie_gart_tlb_flush; rdev->asic->gart.get_page_entry = &rv370_pcie_gart_get_page_entry; @@ -590,11 +588,9 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) } #if defined(CONFIG_DEBUG_FS) -static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data) +static int rv370_debugfs_pcie_gart_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); @@ -614,17 +610,16 @@ static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list rv370_pcie_gart_info_list[] = { - {"rv370_pcie_gart_info", rv370_debugfs_pcie_gart_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(rv370_debugfs_pcie_gart_info); #endif -static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev) +static void rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, rv370_pcie_gart_info_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("rv370_pcie_gart_info", 0444, root, rdev, + &rv370_debugfs_pcie_gart_info_fops); #endif } @@ -1331,12 +1326,8 @@ void r300_set_reg_safe(struct radeon_device *rdev) void r300_mc_program(struct radeon_device *rdev) { struct r100_mc_save save; - int r; - r = r100_debugfs_mc_info_init(rdev); - if (r) { - dev_err(rdev->dev, "Failed to create r100_mc debugfs file.\n"); - } + r100_debugfs_mc_info_init(rdev); /* Stops all mc clients */ r100_mc_stop(rdev, &save); diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 50b89b6d9a6c..1ed4407b91aa 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c @@ -30,7 +30,6 @@ #include <linux/seq_file.h> #include <linux/slab.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> @@ -187,12 +186,8 @@ void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v) static void r420_debugfs(struct radeon_device *rdev) { - if (r100_debugfs_rbbm_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for RBBM !\n"); - } - if (r420_debugfs_pipes_info_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for pipes !\n"); - } + r100_debugfs_rbbm_init(rdev); + r420_debugfs_pipes_info_init(rdev); } static void r420_clock_resume(struct radeon_device *rdev) @@ -480,11 +475,9 @@ int r420_init(struct radeon_device *rdev) * Debugfs info */ #if defined(CONFIG_DEBUG_FS) -static int r420_debugfs_pipes_info(struct seq_file *m, void *data) +static int r420_debugfs_pipes_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32(R400_GB_PIPE_SELECT); @@ -496,16 +489,15 @@ static int r420_debugfs_pipes_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list r420_pipes_info_list[] = { - {"r420_pipes_info", r420_debugfs_pipes_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(r420_debugfs_pipes_info); #endif -int r420_debugfs_pipes_info_init(struct radeon_device *rdev) +void r420_debugfs_pipes_info_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, r420_pipes_info_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("r420_pipes_info", 0444, root, rdev, + &r420_debugfs_pipes_info_fops); #endif } diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index b44e0c607b1b..a0459b168d53 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -32,7 +32,6 @@ #include <linux/slab.h> #include <linux/seq_file.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_vblank.h> #include <drm/radeon_drm.h> @@ -106,7 +105,7 @@ static const u32 crtc_offsets[2] = AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL }; -int r600_debugfs_mc_info_init(struct radeon_device *rdev); +static void r600_debugfs_mc_info_init(struct radeon_device *rdev); /* r600,rv610,rv630,rv620,rv635,rv670 */ int r600_mc_wait_for_idle(struct radeon_device *rdev); @@ -3251,9 +3250,7 @@ int r600_init(struct radeon_device *rdev) { int r; - if (r600_debugfs_mc_info_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for mc !\n"); - } + r600_debugfs_mc_info_init(rdev); /* Read BIOS */ if (!radeon_get_bios(rdev)) { if (ASIC_IS_AVIVO(rdev)) @@ -4346,28 +4343,26 @@ restart_ih: */ #if defined(CONFIG_DEBUG_FS) -static int r600_debugfs_mc_info(struct seq_file *m, void *data) +static int r600_debugfs_mc_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; DREG32_SYS(m, rdev, R_000E50_SRBM_STATUS); DREG32_SYS(m, rdev, VM_L2_STATUS); return 0; } -static struct drm_info_list r600_mc_info_list[] = { - {"r600_mc_info", r600_debugfs_mc_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(r600_debugfs_mc_info); #endif -int r600_debugfs_mc_info_init(struct radeon_device *rdev) +static void r600_debugfs_mc_info_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, r600_mc_info_list, ARRAY_SIZE(r600_mc_info_list)); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("r600_mc_info", 0444, root, rdev, + &r600_debugfs_mc_info_fops); + #endif } diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index f820b29127f8..ea064ddf3f18 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -511,8 +511,6 @@ struct radeon_bo { }; #define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, tbo.base) -int radeon_gem_debugfs_init(struct radeon_device *rdev); - /* sub-allocation manager, it has to be protected by another lock. * By conception this is an helper for other part of the driver * like the indirect buffer or semaphore, which both have their @@ -1789,15 +1787,8 @@ static inline void radeon_mn_unregister(struct radeon_bo *bo) {} /* * Debugfs */ -struct radeon_debugfs { - struct drm_info_list *files; - unsigned num_files; -}; - -int radeon_debugfs_add_files(struct radeon_device *rdev, - struct drm_info_list *files, - unsigned nfiles); -int radeon_debugfs_fence_init(struct radeon_device *rdev); +void radeon_debugfs_fence_init(struct radeon_device *rdev); +void radeon_gem_debugfs_init(struct radeon_device *rdev); /* * ASIC ring specific functions. @@ -2422,9 +2413,6 @@ struct radeon_device { struct drm_file *cmask_filp; /* i2c buses */ struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS]; - /* debugfs */ - struct radeon_debugfs debugfs[RADEON_DEBUGFS_MAX_COMPONENTS]; - unsigned debugfs_count; /* virtual memory */ struct radeon_vm_manager vm_manager; struct mutex gpu_clock_mutex; diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 24644daead53..1cf2a5e0d91d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -99,8 +99,8 @@ void r100_hpd_fini(struct radeon_device *rdev); bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); void r100_hpd_set_polarity(struct radeon_device *rdev, enum radeon_hpd_id hpd); -int r100_debugfs_rbbm_init(struct radeon_device *rdev); -int r100_debugfs_cp_init(struct radeon_device *rdev); +void r100_debugfs_rbbm_init(struct radeon_device *rdev); +void r100_debugfs_cp_init(struct radeon_device *rdev); void r100_cp_disable(struct radeon_device *rdev); int r100_cp_init(struct radeon_device *rdev, unsigned ring_size); void r100_cp_fini(struct radeon_device *rdev); @@ -108,7 +108,7 @@ int r100_pci_gart_init(struct radeon_device *rdev); void r100_pci_gart_fini(struct radeon_device *rdev); int r100_pci_gart_enable(struct radeon_device *rdev); void r100_pci_gart_disable(struct radeon_device *rdev); -int r100_debugfs_mc_info_init(struct radeon_device *rdev); +void r100_debugfs_mc_info_init(struct radeon_device *rdev); int r100_gui_wait_for_idle(struct radeon_device *rdev); int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); void r100_irq_disable(struct radeon_device *rdev); @@ -199,7 +199,7 @@ extern int r420_resume(struct radeon_device *rdev); extern void r420_pm_init_profile(struct radeon_device *rdev); extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg); extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v); -extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev); +extern void r420_debugfs_pipes_info_init(struct radeon_device *rdev); extern void r420_pipes_init(struct radeon_device *rdev); /* diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 2cbf14fc6ece..cc445c4cba2e 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -36,7 +36,6 @@ #include <drm/drm_cache.h> #include <drm/drm_crtc_helper.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_probe_helper.h> @@ -1448,15 +1447,8 @@ int radeon_device_init(struct radeon_device *rdev, if (r) goto failed; - r = radeon_gem_debugfs_init(rdev); - if (r) { - DRM_ERROR("registering gem debugfs failed (%d).\n", r); - } - - r = radeon_mst_debugfs_init(rdev); - if (r) { - DRM_ERROR("registering mst debugfs failed (%d).\n", r); - } + radeon_gem_debugfs_init(rdev); + radeon_mst_debugfs_init(rdev); if (rdev->flags & RADEON_IS_AGP && !rdev->accel_working) { /* Acceleration not working on AGP card try again @@ -1884,38 +1876,3 @@ int radeon_gpu_reset(struct radeon_device *rdev) up_read(&rdev->exclusive_lock); return r; } - - -/* - * Debugfs - */ -int radeon_debugfs_add_files(struct radeon_device *rdev, - struct drm_info_list *files, - unsigned nfiles) -{ - unsigned i; - - for (i = 0; i < rdev->debugfs_count; i++) { - if (rdev->debugfs[i].files == files) { - /* Already registered */ - return 0; - } - } - - i = rdev->debugfs_count + 1; - if (i > RADEON_DEBUGFS_MAX_COMPONENTS) { - DRM_ERROR("Reached maximum number of debugfs components.\n"); - DRM_ERROR("Report so we increase " - "RADEON_DEBUGFS_MAX_COMPONENTS.\n"); - return -EINVAL; - } - rdev->debugfs[rdev->debugfs_count].files = files; - rdev->debugfs[rdev->debugfs_count].num_files = nfiles; - rdev->debugfs_count = i; -#if defined(CONFIG_DEBUG_FS) - drm_debugfs_create_files(files, nfiles, - rdev->ddev->primary->debugfs_root, - rdev->ddev->primary); -#endif - return 0; -} diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c index 2c32186c4acd..66a0e736cc4d 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: MIT -#include <drm/drm_debugfs.h> #include <drm/drm_dp_mst_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_file.h> @@ -723,10 +722,10 @@ go_again: #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_mst_info(struct seq_file *m, void *data) +static int radeon_debugfs_mst_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; + struct radeon_device *rdev = (struct radeon_device *)m->private; + struct drm_device *dev = rdev->ddev; struct drm_connector *connector; struct radeon_connector *radeon_connector; struct radeon_connector_atom_dig *dig_connector; @@ -754,15 +753,16 @@ static int radeon_debugfs_mst_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list radeon_debugfs_mst_list[] = { - {"radeon_mst_info", &radeon_debugfs_mst_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_mst_info); #endif -int radeon_mst_debugfs_init(struct radeon_device *rdev) +void radeon_mst_debugfs_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, radeon_debugfs_mst_list, 1); + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("radeon_mst_info", 0444, root, rdev, + &radeon_debugfs_mst_info_fops); + #endif - return 0; } diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 9ee6e599ef83..0d8ef2368adf 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -37,7 +37,6 @@ #include <linux/slab.h> #include <linux/wait.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> @@ -916,9 +915,9 @@ int radeon_fence_driver_init(struct radeon_device *rdev) for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { radeon_fence_driver_init_ring(rdev, ring); } - if (radeon_debugfs_fence_init(rdev)) { - dev_err(rdev->dev, "fence debugfs file creation failed\n"); - } + + radeon_debugfs_fence_init(rdev); + return 0; } @@ -973,11 +972,9 @@ void radeon_fence_driver_force_completion(struct radeon_device *rdev, int ring) * Fence debugfs */ #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_fence_info(struct seq_file *m, void *data) +static int radeon_debugfs_fence_info_show(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; int i, j; for (i = 0; i < RADEON_NUM_RINGS; ++i) { @@ -1006,33 +1003,34 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data) * * Manually trigger a gpu reset at the next fence wait. */ -static int radeon_debugfs_gpu_reset(struct seq_file *m, void *data) +static int radeon_debugfs_gpu_reset(void *data, u64 *val) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)data; down_read(&rdev->exclusive_lock); - seq_printf(m, "%d\n", rdev->needs_reset); + *val = rdev->needs_reset; rdev->needs_reset = true; wake_up_all(&rdev->fence_queue); up_read(&rdev->exclusive_lock); return 0; } - -static struct drm_info_list radeon_debugfs_fence_list[] = { - {"radeon_fence_info", &radeon_debugfs_fence_info, 0, NULL}, - {"radeon_gpu_reset", &radeon_debugfs_gpu_reset, 0, NULL} -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_fence_info); +DEFINE_DEBUGFS_ATTRIBUTE(radeon_debugfs_gpu_reset_fops, + radeon_debugfs_gpu_reset, NULL, "%lld\n"); #endif -int radeon_debugfs_fence_init(struct radeon_device *rdev) +void radeon_debugfs_fence_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, radeon_debugfs_fence_list, 2); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("radeon_gpu_reset", 0444, root, rdev, + &radeon_debugfs_gpu_reset_fops); + debugfs_create_file("radeon_fence_info", 0444, root, rdev, + &radeon_debugfs_fence_info_fops); + + #endif } diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 941826923247..412ab3181f84 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c @@ -28,7 +28,6 @@ #include <linux/pci.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_gem_ttm_helper.h> @@ -801,11 +800,9 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, } #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_gem_info(struct seq_file *m, void *data) +static int radeon_debugfs_gem_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; struct radeon_bo *rbo; unsigned i = 0; @@ -836,15 +833,16 @@ static int radeon_debugfs_gem_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list radeon_debugfs_gem_list[] = { - {"radeon_gem_info", &radeon_debugfs_gem_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_gem_info); #endif -int radeon_gem_debugfs_init(struct radeon_device *rdev) +void radeon_gem_debugfs_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, radeon_debugfs_gem_list, 1); + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("radeon_gem_info", 0444, root, rdev, + &radeon_debugfs_gem_info_fops); + #endif - return 0; } diff --git a/drivers/gpu/drm/radeon/radeon_ib.c b/drivers/gpu/drm/radeon/radeon_ib.c index c1fca2ba443c..62b116727b4f 100644 --- a/drivers/gpu/drm/radeon/radeon_ib.c +++ b/drivers/gpu/drm/radeon/radeon_ib.c @@ -27,7 +27,6 @@ * Christian König */ -#include <drm/drm_debugfs.h> #include <drm/drm_file.h> #include "radeon.h" @@ -41,7 +40,7 @@ * produce command buffers which are send to the kernel and * put in IBs for execution by the requested ring. */ -static int radeon_debugfs_sa_init(struct radeon_device *rdev); +static void radeon_debugfs_sa_init(struct radeon_device *rdev); /** * radeon_ib_get - request an IB (Indirect Buffer) @@ -225,9 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev) } rdev->ib_pool_ready = true; - if (radeon_debugfs_sa_init(rdev)) { - dev_err(rdev->dev, "failed to register debugfs file for SA\n"); - } + radeon_debugfs_sa_init(rdev); return 0; } @@ -295,11 +292,9 @@ int radeon_ib_ring_tests(struct radeon_device *rdev) */ #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_sa_info(struct seq_file *m, void *data) +static int radeon_debugfs_sa_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; radeon_sa_bo_dump_debug_info(&rdev->ring_tmp_bo, m); @@ -307,17 +302,16 @@ static int radeon_debugfs_sa_info(struct seq_file *m, void *data) } -static struct drm_info_list radeon_debugfs_sa_list[] = { - {"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_sa_info); #endif -static int radeon_debugfs_sa_init(struct radeon_device *rdev) +static void radeon_debugfs_sa_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, radeon_debugfs_sa_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("radeon_sa_info", 0444, root, rdev, + &radeon_debugfs_sa_info_fops); #endif } diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index c7f223743d46..fe16f140a6b4 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -994,7 +994,7 @@ int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tile int radeon_dp_mst_init(struct radeon_connector *radeon_connector); int radeon_dp_mst_probe(struct radeon_connector *radeon_connector); int radeon_dp_mst_check_status(struct radeon_connector *radeon_connector); -int radeon_mst_debugfs_init(struct radeon_device *rdev); +void radeon_mst_debugfs_init(struct radeon_device *rdev); void radeon_dp_mst_prepare_pll(struct drm_crtc *crtc, struct drm_display_mode *mode); void radeon_setup_mst_connector(struct drm_device *dev); diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 1995dad59dd0..b6737be9165c 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -26,7 +26,6 @@ #include <linux/pci.h> #include <linux/power_supply.h> -#include <drm/drm_debugfs.h> #include <drm/drm_vblank.h> #include "atom.h" @@ -48,7 +47,7 @@ static const char *radeon_pm_state_type_name[5] = { }; static void radeon_dynpm_idle_work_handler(struct work_struct *work); -static int radeon_debugfs_pm_init(struct radeon_device *rdev); +static void radeon_debugfs_pm_init(struct radeon_device *rdev); static bool radeon_pm_in_vbl(struct radeon_device *rdev); static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish); static void radeon_pm_update_profile(struct radeon_device *rdev); @@ -1399,10 +1398,7 @@ static int radeon_pm_init_old(struct radeon_device *rdev) INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); if (rdev->pm.num_power_states > 1) { - if (radeon_debugfs_pm_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for PM!\n"); - } - + radeon_debugfs_pm_init(rdev); DRM_INFO("radeon: power management initialized\n"); } @@ -1456,9 +1452,7 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev) goto dpm_failed; rdev->pm.dpm_enabled = true; - if (radeon_debugfs_pm_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for dpm!\n"); - } + radeon_debugfs_pm_init(rdev); DRM_INFO("radeon: dpm initialized\n"); @@ -1916,11 +1910,9 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work) */ #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_pm_info(struct seq_file *m, void *data) +static int radeon_debugfs_pm_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; struct drm_device *ddev = rdev->ddev; if ((rdev->flags & RADEON_IS_PX) && @@ -1952,16 +1944,16 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list radeon_pm_info_list[] = { - {"radeon_pm_info", radeon_debugfs_pm_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_pm_info); #endif -static int radeon_debugfs_pm_init(struct radeon_device *rdev) +static void radeon_debugfs_pm_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, radeon_pm_info_list, ARRAY_SIZE(radeon_pm_info_list)); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("radeon_pm_info", 0444, root, rdev, + &radeon_debugfs_pm_info_fops); + #endif } diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 41ed8aba1313..7e207276df37 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -27,7 +27,6 @@ * Christian König */ -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> @@ -46,7 +45,7 @@ * wptr. The GPU then starts fetching commands and executes * them until the pointers are equal again. */ -static int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring); +static void radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring); /** * radeon_ring_supports_scratch_reg - check if the ring supports @@ -422,9 +421,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig ring->next_rptr_gpu_addr = rdev->wb.gpu_addr + index; ring->next_rptr_cpu_addr = &rdev->wb.wb[index/4]; } - if (radeon_debugfs_ring_init(rdev, ring)) { - DRM_ERROR("Failed to register debugfs file for rings !\n"); - } + radeon_debugfs_ring_init(rdev, ring); radeon_ring_lockup_update(rdev, ring); return 0; } @@ -465,13 +462,10 @@ void radeon_ring_fini(struct radeon_device *rdev, struct radeon_ring *ring) */ #if defined(CONFIG_DEBUG_FS) -static int radeon_debugfs_ring_info(struct seq_file *m, void *data) +static int radeon_debugfs_ring_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; - int ridx = *(int*)node->info_ent->data; - struct radeon_ring *ring = &rdev->ring[ridx]; + struct radeon_ring *ring = (struct radeon_ring *) m->private; + struct radeon_device *rdev = ring->rdev; uint32_t rptr, wptr, rptr_next; unsigned count, i, j; @@ -522,44 +516,43 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data) return 0; } -static int radeon_gfx_index = RADEON_RING_TYPE_GFX_INDEX; -static int cayman_cp1_index = CAYMAN_RING_TYPE_CP1_INDEX; -static int cayman_cp2_index = CAYMAN_RING_TYPE_CP2_INDEX; -static int radeon_dma1_index = R600_RING_TYPE_DMA_INDEX; -static int radeon_dma2_index = CAYMAN_RING_TYPE_DMA1_INDEX; -static int r600_uvd_index = R600_RING_TYPE_UVD_INDEX; -static int si_vce1_index = TN_RING_TYPE_VCE1_INDEX; -static int si_vce2_index = TN_RING_TYPE_VCE2_INDEX; - -static struct drm_info_list radeon_debugfs_ring_info_list[] = { - {"radeon_ring_gfx", radeon_debugfs_ring_info, 0, &radeon_gfx_index}, - {"radeon_ring_cp1", radeon_debugfs_ring_info, 0, &cayman_cp1_index}, - {"radeon_ring_cp2", radeon_debugfs_ring_info, 0, &cayman_cp2_index}, - {"radeon_ring_dma1", radeon_debugfs_ring_info, 0, &radeon_dma1_index}, - {"radeon_ring_dma2", radeon_debugfs_ring_info, 0, &radeon_dma2_index}, - {"radeon_ring_uvd", radeon_debugfs_ring_info, 0, &r600_uvd_index}, - {"radeon_ring_vce1", radeon_debugfs_ring_info, 0, &si_vce1_index}, - {"radeon_ring_vce2", radeon_debugfs_ring_info, 0, &si_vce2_index}, -}; +DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_ring_info); + +static const char *radeon_debugfs_ring_idx_to_name(uint32_t ridx) +{ + switch (ridx) { + case RADEON_RING_TYPE_GFX_INDEX: + return "radeon_ring_gfx"; + case CAYMAN_RING_TYPE_CP1_INDEX: + return "radeon_ring_cp1"; + case CAYMAN_RING_TYPE_CP2_INDEX: + return "radeon_ring_cp2"; + case R600_RING_TYPE_DMA_INDEX: + return "radeon_ring_dma1"; + case CAYMAN_RING_TYPE_DMA1_INDEX: + return "radeon_ring_dma2"; + case R600_RING_TYPE_UVD_INDEX: + return "radeon_ring_uvd"; + case TN_RING_TYPE_VCE1_INDEX: + return "radeon_ring_vce1"; + case TN_RING_TYPE_VCE2_INDEX: + return "radeon_ring_vce2"; + default: + return NULL; + } +} #endif -static int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring) +static void radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring) { #if defined(CONFIG_DEBUG_FS) - unsigned i; - for (i = 0; i < ARRAY_SIZE(radeon_debugfs_ring_info_list); ++i) { - struct drm_info_list *info = &radeon_debugfs_ring_info_list[i]; - int ridx = *(int*)radeon_debugfs_ring_info_list[i].data; - unsigned r; + const char *ring_name = radeon_debugfs_ring_idx_to_name(ring->idx); + struct dentry *root = rdev->ddev->primary->debugfs_root; - if (&rdev->ring[ridx] != ring) - continue; + if (ring_name) + debugfs_create_file(ring_name, 0444, root, ring, + &radeon_debugfs_ring_info_fops); - r = radeon_debugfs_add_files(rdev, info, 1); - if (r) - return r; - } #endif - return 0; } diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index aab3e5f9273c..c740e371893b 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -39,7 +39,6 @@ #include <linux/swiotlb.h> #include <drm/drm_agpsupport.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_prime.h> @@ -52,7 +51,7 @@ #include "radeon.h" #include "radeon_ttm.h" -static int radeon_ttm_debugfs_init(struct radeon_device *rdev); +static void radeon_ttm_debugfs_init(struct radeon_device *rdev); static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev, struct ttm_tt *ttm, @@ -762,11 +761,8 @@ int radeon_ttm_init(struct radeon_device *rdev) DRM_INFO("radeon: %uM of GTT memory ready.\n", (unsigned)(rdev->mc.gtt_size / (1024 * 1024))); - r = radeon_ttm_debugfs_init(rdev); - if (r) { - DRM_ERROR("Failed to init debugfs\n"); - return r; - } + radeon_ttm_debugfs_init(rdev); + return 0; } @@ -862,36 +858,38 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma) #if defined(CONFIG_DEBUG_FS) -static int radeon_mm_dump_table(struct seq_file *m, void *data) +static int radeon_mm_vram_dump_table_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - unsigned ttm_pl = *(int*)node->info_ent->data; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; - struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev, ttm_pl); + struct radeon_device *rdev = (struct radeon_device *)m->private; + struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev, + TTM_PL_VRAM); struct drm_printer p = drm_seq_file_printer(m); man->func->debug(man, &p); return 0; } -static int radeon_ttm_pool_debugfs(struct seq_file *m, void *data) +static int radeon_ttm_page_pool_show(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; return ttm_pool_debugfs(&rdev->mman.bdev.pool, m); } -static int ttm_pl_vram = TTM_PL_VRAM; -static int ttm_pl_tt = TTM_PL_TT; +static int radeon_mm_gtt_dump_table_show(struct seq_file *m, void *unused) +{ + struct radeon_device *rdev = (struct radeon_device *)m->private; + struct ttm_resource_manager *man = ttm_manager_type(&rdev->mman.bdev, + TTM_PL_TT); + struct drm_printer p = drm_seq_file_printer(m); -static struct drm_info_list radeon_ttm_debugfs_list[] = { - {"radeon_vram_mm", radeon_mm_dump_table, 0, &ttm_pl_vram}, - {"radeon_gtt_mm", radeon_mm_dump_table, 0, &ttm_pl_tt}, - {"ttm_page_pool", radeon_ttm_pool_debugfs, 0, NULL} -}; + man->func->debug(man, &p); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(radeon_mm_vram_dump_table); +DEFINE_SHOW_ATTRIBUTE(radeon_mm_gtt_dump_table); +DEFINE_SHOW_ATTRIBUTE(radeon_ttm_page_pool); static int radeon_ttm_vram_open(struct inode *inode, struct file *filep) { @@ -1001,25 +999,23 @@ static const struct file_operations radeon_ttm_gtt_fops = { #endif -static int radeon_ttm_debugfs_init(struct radeon_device *rdev) +static void radeon_ttm_debugfs_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - unsigned count; - struct drm_minor *minor = rdev->ddev->primary; struct dentry *root = minor->debugfs_root; - debugfs_create_file("radeon_vram", S_IFREG | S_IRUGO, root, rdev, + debugfs_create_file("radeon_vram", 0444, root, rdev, &radeon_ttm_vram_fops); - debugfs_create_file("radeon_gtt", S_IFREG | S_IRUGO, root, rdev, + debugfs_create_file("radeon_gtt", 0444, root, rdev, &radeon_ttm_gtt_fops); - count = ARRAY_SIZE(radeon_ttm_debugfs_list); - - return radeon_debugfs_add_files(rdev, radeon_ttm_debugfs_list, count); -#else - - return 0; + debugfs_create_file("radeon_vram_mm", 0444, root, rdev, + &radeon_mm_vram_dump_table_fops); + debugfs_create_file("radeon_gtt_mm", 0444, root, rdev, + &radeon_mm_gtt_dump_table_fops); + debugfs_create_file("ttm_page_pool", 0444, root, rdev, + &radeon_ttm_page_pool_fops); #endif } diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 117f60af1ee4..8423bcc3302b 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c @@ -29,7 +29,6 @@ #include <linux/seq_file.h> #include <linux/slab.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> @@ -38,7 +37,7 @@ #include "rs400d.h" /* This files gather functions specifics to : rs400,rs480 */ -static int rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev); +static void rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev); void rs400_gart_adjust_size(struct radeon_device *rdev) { @@ -103,8 +102,7 @@ int rs400_gart_init(struct radeon_device *rdev) r = radeon_gart_init(rdev); if (r) return r; - if (rs400_debugfs_pcie_gart_info_init(rdev)) - DRM_ERROR("Failed to register debugfs file for RS400 GART !\n"); + rs400_debugfs_pcie_gart_info_init(rdev); rdev->gart.table_size = rdev->gart.num_gpu_pages * 4; return radeon_gart_table_ram_alloc(rdev); } @@ -307,11 +305,9 @@ void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) } #if defined(CONFIG_DEBUG_FS) -static int rs400_debugfs_gart_info(struct seq_file *m, void *data) +static int rs400_debugfs_gart_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32(RADEON_HOST_PATH_CNTL); @@ -376,17 +372,16 @@ static int rs400_debugfs_gart_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list rs400_gart_info_list[] = { - {"rs400_gart_info", rs400_debugfs_gart_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(rs400_debugfs_gart_info); #endif -static int rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev) +static void rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, rs400_gart_info_list, 1); -#else - return 0; + struct dentry *root = rdev->ddev->primary->debugfs_root; + + debugfs_create_file("rs400_gart_info", 0444, root, rdev, + &rs400_debugfs_gart_info_fops); #endif } diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index c88b4906f7bc..5bf26058eec0 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c @@ -945,12 +945,6 @@ void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); } -static void rs600_debugfs(struct radeon_device *rdev) -{ - if (r100_debugfs_rbbm_init(rdev)) - DRM_ERROR("Failed to register debugfs file for RBBM !\n"); -} - void rs600_set_safe_registers(struct radeon_device *rdev) { rdev->config.r300.reg_safe_bm = rs600_reg_safe_bm; @@ -1136,7 +1130,7 @@ int rs600_init(struct radeon_device *rdev) radeon_get_clock_info(rdev->ddev); /* initialize memory controller */ rs600_mc_init(rdev); - rs600_debugfs(rdev); + r100_debugfs_rbbm_init(rdev); /* Fence driver */ r = radeon_fence_driver_init(rdev); if (r) diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 147e5cf8348d..46a53dd38079 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c @@ -29,7 +29,6 @@ #include <linux/seq_file.h> #include <linux/slab.h> -#include <drm/drm_debugfs.h> #include <drm/drm_device.h> #include <drm/drm_file.h> @@ -40,8 +39,6 @@ #include "rv515d.h" /* This files gather functions specifics to: rv515 */ -static int rv515_debugfs_pipes_info_init(struct radeon_device *rdev); -static int rv515_debugfs_ga_info_init(struct radeon_device *rdev); static void rv515_gpu_init(struct radeon_device *rdev); int rv515_mc_wait_for_idle(struct radeon_device *rdev); @@ -51,19 +48,6 @@ static const u32 crtc_offsets[2] = AVIVO_D2CRTC_H_TOTAL - AVIVO_D1CRTC_H_TOTAL }; -void rv515_debugfs(struct radeon_device *rdev) -{ - if (r100_debugfs_rbbm_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for RBBM !\n"); - } - if (rv515_debugfs_pipes_info_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for pipes !\n"); - } - if (rv515_debugfs_ga_info_init(rdev)) { - DRM_ERROR("Failed to register debugfs file for pipes !\n"); - } -} - void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) { int r; @@ -235,11 +219,9 @@ void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) } #if defined(CONFIG_DEBUG_FS) -static int rv515_debugfs_pipes_info(struct seq_file *m, void *data) +static int rv515_debugfs_pipes_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32(GB_PIPE_SELECT); @@ -253,11 +235,9 @@ static int rv515_debugfs_pipes_info(struct seq_file *m, void *data) return 0; } -static int rv515_debugfs_ga_info(struct seq_file *m, void *data) +static int rv515_debugfs_ga_info_show(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; - struct radeon_device *rdev = dev->dev_private; + struct radeon_device *rdev = (struct radeon_device *)m->private; uint32_t tmp; tmp = RREG32(0x2140); @@ -268,31 +248,21 @@ static int rv515_debugfs_ga_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list rv515_pipes_info_list[] = { - {"rv515_pipes_info", rv515_debugfs_pipes_info, 0, NULL}, -}; - -static struct drm_info_list rv515_ga_info_list[] = { - {"rv515_ga_info", rv515_debugfs_ga_info, 0, NULL}, -}; +DEFINE_SHOW_ATTRIBUTE(rv515_debugfs_pipes_info); +DEFINE_SHOW_ATTRIBUTE(rv515_debugfs_ga_info); #endif -static int rv515_debugfs_pipes_info_init(struct radeon_device *rdev) +void rv515_debugfs(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, rv515_pipes_info_list, 1); -#else - return 0; -#endif -} + struct dentry *root = rdev->ddev->primary->debugfs_root; -static int rv515_debugfs_ga_info_init(struct radeon_device *rdev) -{ -#if defined(CONFIG_DEBUG_FS) - return radeon_debugfs_add_files(rdev, rv515_ga_info_list, 1); -#else - return 0; + debugfs_create_file("rv515_pipes_info", 0444, root, rdev, + &rv515_debugfs_pipes_info_fops); + debugfs_create_file("rv515_ga_info", 0444, root, rdev, + &rv515_debugfs_ga_info_fops); #endif + r100_debugfs_rbbm_init(rdev); } void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save) |