summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_ttm.c
diff options
context:
space:
mode:
authorNirmoy Das <nirmoy.das@amd.com>2021-02-18 02:34:30 +0300
committerAlex Deucher <alexander.deucher@amd.com>2021-02-19 00:43:10 +0300
commit5b54d6797994fe93432970145c93b9747a3c8d6c (patch)
tree95e7942a8069c62813f9c3d4d9cbdb8e022ec57e /drivers/gpu/drm/radeon/radeon_ttm.c
parente7fa81bbc33e6e5bc9f94ca16add07db85fe08f4 (diff)
downloadlinux-5b54d6797994fe93432970145c93b9747a3c8d6c.tar.xz
drm/radeon: do not use drm middle layer for debugfs (v2)
Use debugfs API directly instead of drm middle layer. v2: squash in build fix (Alex) Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c66
1 files changed, 31 insertions, 35 deletions
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
}