summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_ttm.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2021-03-26 15:52:01 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2021-03-26 15:53:21 +0100
commit2cbcb78c9ee5520c8d836c7ff57d1b60ebe8e9b7 (patch)
tree99d79eecc71a17ccb53205b28bfbe395dba91e43 /drivers/gpu/drm/radeon/radeon_ttm.c
parent06debd6e1b28029e6e77c41e59a162868f377897 (diff)
parent8c44390d8872ebf3a28558b59a0074df39b3da8f (diff)
Merge tag 'amd-drm-next-5.13-2021-03-23' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.13-2021-03-23: amdgpu: - Debugfs cleanup - Various cleanups and spelling fixes - Flexible array cleanups - Initial AMD Freesync HDMI - Display fixes - 10bpc dithering improvements - Display ASSR support - Clean up and unify powerplay and swsmu interfaces - Vangogh fixes - Add SMU gfx busy queues for RV/PCO - PCIE DPM fixes - S0ix fixes - GPU metrics data fixes - DCN secure display support - Backlight type override - Add initial support for Aldebaran - RAS fixes - Prime fixes for A+A systems - Reset fixes - Initial resource cursor support - Drop legacy IO BAR requirements - Various power fixes amdkfd: - MMU notifier fixes - APU fixes radeon: - Debugfs cleanups - Flexible array cleanups UAPI: - amdgpu: Add a new INFO ioctl interface to query video capabilities rather than hardcoding them in userspace. This allows us to provide fine grained asic capabilities (e.g., if a particular part is bandwidth limited, we can limit the capabilities). Proposed userspace: https://gitlab.freedesktop.org/leoliu/drm/-/commits/info_video_caps https://gitlab.freedesktop.org/leoliu/mesa/-/commits/info_video_caps - amdkfd: bump the driver version. There was a problem with reporting some RAS features on older versions of the driver. Proposed userspace: https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/commit/7cdd63475c36bb9f49bb960f90f9a8cdb7e80a21 Danvet: A bunch of conflicts all over, but it seems to compile ... I did put the call to dc_allow_idle_optimizations() on a single line since it looked a bit too jarring to be left alone. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210324040147.1990338-1-alexander.deucher@amd.com
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ttm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c88
1 files changed, 35 insertions, 53 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 5fc8bae401af..476ce9c24b9f 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,8 +51,7 @@
#include "radeon.h"
#include "radeon_ttm.h"
-static int radeon_ttm_debugfs_init(struct radeon_device *rdev);
-static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);
+static void radeon_ttm_debugfs_init(struct radeon_device *rdev);
static int radeon_ttm_tt_bind(struct ttm_device *bdev, struct ttm_tt *ttm,
struct ttm_resource *bo_mem);
@@ -761,11 +759,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;
}
@@ -775,7 +770,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)
if (!rdev->mman.initialized)
return;
- radeon_ttm_debugfs_fini(rdev);
+
if (rdev->stolen_vga_memory) {
r = radeon_bo_reserve(rdev->stolen_vga_memory, false);
if (r == 0) {
@@ -861,36 +856,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);
+
+ man->func->debug(man, &p);
+ return 0;
+}
-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}
-};
+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)
{
@@ -924,7 +921,7 @@ static ssize_t radeon_ttm_vram_read(struct file *f, char __user *buf,
value = RREG32(RADEON_MM_DATA);
spin_unlock_irqrestore(&rdev->mmio_idx_lock, flags);
- r = put_user(value, (uint32_t *)buf);
+ r = put_user(value, (uint32_t __user *)buf);
if (r)
return r;
@@ -1000,38 +997,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;
- rdev->mman.vram = debugfs_create_file("radeon_vram", S_IFREG | S_IRUGO,
- root, rdev,
- &radeon_ttm_vram_fops);
-
- rdev->mman.gtt = debugfs_create_file("radeon_gtt", S_IFREG | S_IRUGO,
- 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;
-#endif
-}
-
-static void radeon_ttm_debugfs_fini(struct radeon_device *rdev)
-{
-#if defined(CONFIG_DEBUG_FS)
+ debugfs_create_file("radeon_vram", 0444, root, rdev,
+ &radeon_ttm_vram_fops);
- debugfs_remove(rdev->mman.vram);
- rdev->mman.vram = NULL;
+ debugfs_create_file("radeon_gtt", 0444, root, rdev,
+ &radeon_ttm_gtt_fops);
- debugfs_remove(rdev->mman.gtt);
- rdev->mman.gtt = NULL;
+ 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
}