drm/amdgpu: remove CONFIG_DRM_AMDGPU_GART_DEBUGFS
authorNirmoy Das <nirmoy.das@amd.com>
Thu, 11 Feb 2021 14:33:30 +0000 (15:33 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 18 Feb 2021 21:43:09 +0000 (16:43 -0500)
Removed unused CONFIG_DRM_AMDGPU_GART_DEBUGFS code.
We can use umr instead of this gart debugfs.

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/Kconfig
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 9375e7f..74a8105 100644 (file)
@@ -34,15 +34,6 @@ config DRM_AMDGPU_USERPTR
          This option selects CONFIG_HMM and CONFIG_HMM_MIRROR if it
          isn't already selected to enabled full userptr support.
 
-config DRM_AMDGPU_GART_DEBUGFS
-       bool "Allow GART access through debugfs"
-       depends on DRM_AMDGPU
-       depends on DEBUG_FS
-       default n
-       help
-         Selecting this option creates a debugfs file to inspect the mapped
-         pages. Uses more memory for housekeeping, enable only for debugging.
-
 source "drivers/gpu/drm/amd/acp/Kconfig"
 source "drivers/gpu/drm/amd/display/Kconfig"
 source "drivers/gpu/drm/amd/amdkfd/Kconfig"
index 0db9330..23823a5 100644 (file)
@@ -236,9 +236,6 @@ int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
        t = offset / AMDGPU_GPU_PAGE_SIZE;
        p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE;
        for (i = 0; i < pages; i++, p++) {
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-               adev->gart.pages[p] = NULL;
-#endif
                page_base = adev->dummy_page_addr;
                if (!adev->gart.ptr)
                        continue;
@@ -312,9 +309,6 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
                     int pages, struct page **pagelist, dma_addr_t *dma_addr,
                     uint64_t flags)
 {
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       unsigned t,p;
-#endif
        int r, i;
 
        if (!adev->gart.ready) {
@@ -322,13 +316,6 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
                return -EINVAL;
        }
 
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       t = offset / AMDGPU_GPU_PAGE_SIZE;
-       p = t / AMDGPU_GPU_PAGES_IN_CPU_PAGE;
-       for (i = 0; i < pages; i++, p++)
-               adev->gart.pages[p] = pagelist ? pagelist[i] : NULL;
-#endif
-
        if (!adev->gart.ptr)
                return 0;
 
@@ -373,14 +360,6 @@ int amdgpu_gart_init(struct amdgpu_device *adev)
        DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n",
                 adev->gart.num_cpu_pages, adev->gart.num_gpu_pages);
 
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       /* Allocate pages table */
-       adev->gart.pages = vzalloc(array_size(sizeof(void *),
-                                             adev->gart.num_cpu_pages));
-       if (adev->gart.pages == NULL)
-               return -ENOMEM;
-#endif
-
        return 0;
 }
 
@@ -393,9 +372,5 @@ int amdgpu_gart_init(struct amdgpu_device *adev)
  */
 void amdgpu_gart_fini(struct amdgpu_device *adev)
 {
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       vfree(adev->gart.pages);
-       adev->gart.pages = NULL;
-#endif
        amdgpu_gart_dummy_page_fini(adev);
 }
index afa2e28..a25fe97 100644 (file)
@@ -46,9 +46,6 @@ struct amdgpu_gart {
        unsigned                        num_gpu_pages;
        unsigned                        num_cpu_pages;
        unsigned                        table_size;
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       struct page                     **pages;
-#endif
        bool                            ready;
 
        /* Asic default pte flags */
index 8a9c466..6615a9e 100644 (file)
@@ -2308,58 +2308,6 @@ static const struct file_operations amdgpu_ttm_vram_fops = {
        .llseek = default_llseek,
 };
 
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-
-/*
- * amdgpu_ttm_gtt_read - Linear read access to GTT memory
- */
-static ssize_t amdgpu_ttm_gtt_read(struct file *f, char __user *buf,
-                                  size_t size, loff_t *pos)
-{
-       struct amdgpu_device *adev = file_inode(f)->i_private;
-       ssize_t result = 0;
-       int r;
-
-       while (size) {
-               loff_t p = *pos / PAGE_SIZE;
-               unsigned off = *pos & ~PAGE_MASK;
-               size_t cur_size = min_t(size_t, size, PAGE_SIZE - off);
-               struct page *page;
-               void *ptr;
-
-               if (p >= adev->gart.num_cpu_pages)
-                       return result;
-
-               page = adev->gart.pages[p];
-               if (page) {
-                       ptr = kmap(page);
-                       ptr += off;
-
-                       r = copy_to_user(buf, ptr, cur_size);
-                       kunmap(adev->gart.pages[p]);
-               } else
-                       r = clear_user(buf, cur_size);
-
-               if (r)
-                       return -EFAULT;
-
-               result += cur_size;
-               buf += cur_size;
-               *pos += cur_size;
-               size -= cur_size;
-       }
-
-       return result;
-}
-
-static const struct file_operations amdgpu_ttm_gtt_fops = {
-       .owner = THIS_MODULE,
-       .read = amdgpu_ttm_gtt_read,
-       .llseek = default_llseek
-};
-
-#endif
-
 /*
  * amdgpu_iomem_read - Virtual read access to GPU mapped memory
  *
@@ -2487,11 +2435,6 @@ int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 
        debugfs_create_file_size("amdgpu_vram", mode, root, adev,
                                 &amdgpu_ttm_vram_fops, adev->gmc.mc_vram_size);
-#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
-       debugfs_create_file_size("amdgpu_gtt", mode, root, adev,
-                                &amdgpu_ttm_gtt_fops, adev->gmc.gart_size);
-#endif
-
        debugfs_create_file("amdgpu_iomem", mode, root, adev,
                            &amdgpu_ttm_iomem_fops);
        count = ARRAY_SIZE(amdgpu_ttm_debugfs_list);