[PATCH 1/1] drm/amdgpu: remove CONFIG_DRM_AMDGPU_GART_DEBUGFS

Christian König ckoenig.leichtzumerken at gmail.com
Thu Feb 11 14:41:37 UTC 2021


Am 11.02.21 um 15:39 schrieb Nirmoy Das:
> Removed unused CONFIG_DRM_AMDGPU_GART_DEBUGFS code.
> We can used umr instead of this gart debugfs.
>
> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/Kconfig       |  9 ----
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 25 -----------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h |  3 --
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 57 ------------------------
>   4 files changed, 94 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
> index 9375e7f12420..74a8105fd2c0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Kconfig
> +++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
> @@ -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"
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> index 0db933026722..23823a57374f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
> @@ -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);
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h
> index afa2e2877d87..a25fe97b0196 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.h
> @@ -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 */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 27abfbc480fc..ce92768cd146 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -2364,58 +2364,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
>    *
> @@ -2543,11 +2491,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);



More information about the amd-gfx mailing list