Radeon debugging patches for 3.14
Subsystems (2)
The following patchset improves debugging functionality for the radeon driver.
Apart from a few other minor improvements it gives debugging access to even the invisible parts of VRAM. And in general now allows to make dumps of all the memory the GPU can access.
Please review,
Christian.
PATCH 1/6 drm/radeon: improve ring debugfs a bit
From: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/radeon_ring.c | 56 ++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_ring.c +38 -18
@@ -790,34 +790,54 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)struct radeon_device *rdev = dev->dev_private;int ridx = *(int *)node->info_ent->data;struct radeon_ring *ring = &rdev->ring[ridx]; + +uint32_t rptr, wptr, rptr_next;unsigned count, i, j; -u32 tmp;radeon_ring_free_size (rdev, ring); count = (ring->ring_size /4 ) - ring->ring_free_dw; - tmp =radeon_ring_get_wptr (rdev, ring); -seq_printf (m,"wptr(0x%04x): 0x%08x [%5d]\n" , ring->wptr_reg, tmp, tmp); - tmp =radeon_ring_get_rptr (rdev, ring); -seq_printf (m,"rptr(0x%04x): 0x%08x [%5d]\n" , ring->rptr_reg, tmp, tmp); + + wptr =radeon_ring_get_wptr (rdev, ring); +seq_printf (m,"wptr(0x%04x): 0x%08x [%5d]\n" , + ring->wptr_reg, wptr, wptr); + + rptr =radeon_ring_get_rptr (rdev, ring); +seq_printf (m,"rptr(0x%04x): 0x%08x [%5d]\n" , + ring->rptr_reg, rptr, rptr); +if (ring->rptr_save_reg) { -seq_printf (m,"rptr next(0x%04x): 0x%08x\n" , ring->rptr_save_reg, -RREG32 (ring->rptr_save_reg)); - } -seq_printf (m,"driver's copy of the wptr: 0x%08x [%5d]\n" , ring->wptr, ring->wptr); -seq_printf (m,"driver's copy of the rptr: 0x%08x [%5d]\n" , ring->rptr, ring->rptr); -seq_printf (m,"last semaphore signal addr : 0x%016llx\n" , ring->last_semaphore_signal_addr); -seq_printf (m,"last semaphore wait addr : 0x%016llx\n" , ring->last_semaphore_wait_addr); + rptr_next =RREG32 (ring->rptr_save_reg); +seq_printf (m,"rptr next(0x%04x): 0x%08x [%5d]\n" , + ring->rptr_save_reg, rptr_next, rptr_next); + }else + rptr_next = ~0 ; + +seq_printf (m,"driver's copy of the wptr: 0x%08x [%5d]\n" , + ring->wptr, ring->wptr); +seq_printf (m,"driver's copy of the rptr: 0x%08x [%5d]\n" , + ring->rptr, ring->rptr); +seq_printf (m,"last semaphore signal addr : 0x%016llx\n" , + ring->last_semaphore_signal_addr); +seq_printf (m,"last semaphore wait addr : 0x%016llx\n" , + ring->last_semaphore_wait_addr);seq_printf (m,"%u free dwords in ring\n" , ring->ring_free_dw);seq_printf (m,"%u dwords in ring\n" , count); + +if (!ring->ready) +return 0 ; +/* print 8 dw before current rptr as often it's the last executed * packet that is the root issue */ - i = (ring->rptr + ring->ptr_mask +1 -32 ) & ring->ptr_mask; -if (ring->ready) { -for (j =0 ; j <= (count +32 ); j++) { -seq_printf (m,"r[%5d]=0x%08x\n" , i, ring->ring[i]); - i = (i +1 ) & ring->ptr_mask; - } + i = (rptr + ring->ptr_mask +1 -32 ) & ring->ptr_mask; +for (j =0 ; j <= (count +32 ); j++) { +seq_printf (m,"r[%5d]=0x%08x" , i, ring->ring[i]); +if (rptr == i) +seq_puts (m," *" ); +if (rptr_next == i) +seq_puts (m," #" ); +seq_puts (m,"\n" ); + i = (i +1 ) & ring->ptr_mask; }return 0 ; }
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/6 drm/radeon: report the real offset in radeon_sa_bo_dump_debug_info
In reply to Christian KönigFrom: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/radeon_sa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_sa.c +4 -2
@@ -402,13 +402,15 @@ void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager,spin_lock (&sa_manager->wq.lock);list_for_each_entry (i, &sa_manager->olist, olist) { +uint64_t soffset = i->soffset + sa_manager->gpu_addr; +uint64_t eoffset = i->eoffset + sa_manager->gpu_addr;if (&i->olist == sa_manager->hole) {seq_printf (m,">" ); }else {seq_printf (m," " ); } -seq_printf (m,"[0x%08x 0x%08x] size %8d" , - i->soffset, i->eoffset, i->eoffset - i->soffset); +seq_printf (m,"[0x%010llx 0x%010llx] size %8lld" , + soffset, eoffset, eoffset - soffset);if (i->fence) {seq_printf (m," protected by 0x%016llx on ring %d" , i->fence->seq, i->fence->ring);
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/6 drm/radeon: update fence values in before reporting them
In reply to Christian KönigFrom: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/radeon_fence.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_fence.c +2 -0
@@ -841,6 +841,8 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data)if (!rdev->fence_drv[i].initialized)continue ; +radeon_fence_process (rdev, i); +seq_printf (m,"--- ring %d ---\n" , i);seq_printf (m,"Last signaled fence 0x%016llx\n" , (unsigned long long )atomic64_read (&rdev->fence_drv[i].last_seq));
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/6 drm/radeon: cleanup radeon_ttm debugfs handling
In reply to Christian KönigFrom: Christian König <[email protected]>
Otherwise we not necessary export the right information.
--- drivers/gpu/drm/radeon/radeon_ttm.c | 59 +++++++++++++++---------------------- 1 file changed, 23 insertions(+), 36 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +23 -36
@@ -832,16 +832,15 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)return 0 ; } - -#define RADEON_DEBUGFS_MEM_TYPES 2 -#if defined(CONFIG_DEBUG_FS ) +static int radeon_mm_dump_table (struct seq_file *m,void *data) {struct drm_info_node *node = (struct drm_info_node *)m->private; -struct drm_mm *mm = (struct drm_mm *)node->info_ent->data; +unsigned ttm_pl = *(int *)node->info_ent->data;struct drm_device *dev = node->minor->dev;struct radeon_device *rdev = dev->dev_private; +struct drm_mm *mm = (struct drm_mm *)rdev->mman.bdev.man[ttm_pl].priv;int ret;struct ttm_bo_global *glob = rdev->mman.bdev.glob;
@@ -850,46 +849,34 @@ static int radeon_mm_dump_table(struct seq_file *m, void *data)spin_unlock (&glob->lru_lock);return ret; } + +static int ttm_pl_vram =TTM_PL_VRAM ; +static int ttm_pl_tt =TTM_PL_TT ; + +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" , ttm_page_alloc_debugfs,0 ,NULL }, +#ifdef CONFIG_SWIOTLB + {"ttm_dma_page_pool" , ttm_dma_page_alloc_debugfs,0 ,NULL } +#endif +}; +#endif static int radeon_ttm_debugfs_init (struct radeon_device *rdev) {#if defined(CONFIG_DEBUG_FS ) -static struct drm_info_list radeon_mem_types_list[RADEON_DEBUGFS_MEM_TYPES +2 ]; -static char radeon_mem_types_names[RADEON_DEBUGFS_MEM_TYPES +2 ][32 ]; -unsigned i; +unsigned count =ARRAY_SIZE (radeon_ttm_debugfs_list); -for (i =0 ; i <RADEON_DEBUGFS_MEM_TYPES ; i++) { -if (i ==0 ) -sprintf (radeon_mem_types_names[i],"radeon_vram_mm" ); -else -sprintf (radeon_mem_types_names[i],"radeon_gtt_mm" ); - radeon_mem_types_list[i].name = radeon_mem_types_names[i]; - radeon_mem_types_list[i].show = &radeon_mm_dump_table; - radeon_mem_types_list[i].driver_features =0 ; -if (i ==0 ) - radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_VRAM ].priv; -else - radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_TT ].priv; - - } -/* Add ttm page pool to debugfs */ -sprintf (radeon_mem_types_names[i],"ttm_page_pool" ); - radeon_mem_types_list[i].name = radeon_mem_types_names[i]; - radeon_mem_types_list[i].show = &ttm_page_alloc_debugfs; - radeon_mem_types_list[i].driver_features =0 ; - radeon_mem_types_list[i++].data =NULL ;#ifdef CONFIG_SWIOTLB -if (swiotlb_nr_tbl ()) { -sprintf (radeon_mem_types_names[i],"ttm_dma_page_pool" ); - radeon_mem_types_list[i].name = radeon_mem_types_names[i]; - radeon_mem_types_list[i].show = &ttm_dma_page_alloc_debugfs; - radeon_mem_types_list[i].driver_features =0 ; - radeon_mem_types_list[i++].data =NULL ; - } +if (!swiotlb_nr_tbl ()) + --count;#endif -return radeon_debugfs_add_files (rdev, radeon_mem_types_list, i); -#endif +return radeon_debugfs_add_files (rdev, radeon_ttm_debugfs_list, count); +#else +return 0 ; +#endif }
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/6 drm/radeon: add VRAM debugfs access
In reply to Christian KönigFrom: Christian König <[email protected]>
Not very fast, but makes it possible to access even the normally inaccessible parts of VRAM from userspace.
--- drivers/gpu/drm/radeon/radeon.h | 4 +++ drivers/gpu/drm/radeon/radeon_ttm.c | 72 ++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon.h +4 -0
@@ -413,6 +413,10 @@ struct radeon_mman {struct ttm_bo_device bdev;bool mem_global_referenced;bool initialized; + +#if defined(CONFIG_DEBUG_FS ) +struct dentry *vram; +#endif };/* bo virtual address in a specific vm */
drivers/gpu/drm/radeon/radeon_ttm.c +71 -1
104 lines not on this page · raw message
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/6] drm/radeon: add VRAM debugfs access
Quoted 72 lines · Christian König
From: Christian König <[email protected]>
Not very fast, but makes it possible to access even the normally inaccessible parts of VRAM from userspace.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/radeon/radeon.h | 4 +++ drivers/gpu/drm/radeon/radeon_ttm.c | 72 ++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon.h +4
-0@@ -413,6 +413,10 @@ struct radeon_mman {struct ttm_bo_device bdev;bool mem_global_referenced;bool initialized; + +#if defined(CONFIG_DEBUG_FS ) +struct dentry *vram; +#endif };/* bo virtual address in a specific vm */ drivers/gpu/drm/radeon/radeon_ttm.c +18
-0@@ -39,12 +39,14 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/swiotlb.h> +#include <linux/debugfs.h> #include "radeon_reg.h" #include "radeon.h" #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)static int radeon_ttm_debugfs_init (struct radeon_device *rdev); +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev);static struct radeon_device *radeon_get_rdev (struct ttm_bo_device *bdev) {@@ -753,6 +755,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)if (!rdev->mman.initialized)return ; +radeon_ttm_debugfs_fini (rdev);if (rdev->stollen_vga_memory) { r =radeon_bo_reserve (rdev->stollen_vga_memory, false);if (r ==0 ) {@@ -862,12 +865,70 @@ static struct drm_info_list radeon_ttm_debugfs_list[] = {#endif }; +static int radeon_ttm_mem_open (struct inode *inode,struct file *filep) +{ + filep->private_data = inode->i_private; +return 0 ; +} + +static ssize_t radeon_ttm_vram_read (struct file *f,char __user *buf, +size_t size,loff_t *pos) +{ +struct radeon_device *rdev = f->private_data; +ssize_t result =0 ; +int r; + +if (size &0x3 || *pos &0x3 ) +return -EINVAL ;
drivers/gpu/drm/radeon/radeon_ttm.c static struct drm_info_list radeon_ttm_debugfs_list[] = { · line 892
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c +10
-0+ +while (size) { +unsigned long flags; +uint32_t value; + +if (*pos >= rdev->mc.mc_vram_size || *pos >=0x7FFFFFFF ) +return result; + +spin_lock_irqsave (&rdev->mmio_idx_lock, flags); +WREG32 (RADEON_MM_INDEX , ((uint32_t )*pos) |0x80000000 );
Starting with evergreen dGPUs, there is also an MM_INDEX_HI register at 0x18 for accessing addresses over 30 bits.
Alex
Quoted 63 lines
drivers/gpu/drm/radeon/radeon_ttm.c +43
-2+ value =RREG32 (RADEON_MM_DATA ); +spin_unlock_irqrestore (&rdev->mmio_idx_lock, flags); + + r =put_user (value, (uint32_t *)buf); +if (r) +return r; + + result +=4 ; + buf +=4 ; + *pos +=4 ; + size -= 4; + } + +return result; +} + +static const struct file_operations radeon_ttm_vram_fops = { + .owner =THIS_MODULE , + .open = radeon_ttm_mem_open, + .read = radeon_ttm_vram_read, +}; +#endif static int radeon_ttm_debugfs_init (struct radeon_device *rdev) {#if defined(CONFIG_DEBUG_FS ) -unsigned count =ARRAY_SIZE (radeon_ttm_debugfs_list); +unsigned count; + +struct drm_minor *minor = rdev->ddev->primary; +struct dentry *ent, *root = minor->debugfs_root; + + ent =debugfs_create_file ("radeon_vram" ,S_IFREG |S_IRUGO , root, + rdev, &radeon_ttm_vram_fops); +if (IS_ERR (ent)) +return PTR_ERR (ent); + rdev->mman.vram = ent; + + count =ARRAY_SIZE (radeon_ttm_debugfs_list);#ifdef CONFIG_SWIOTLB if (!swiotlb_nr_tbl ())@@ -880,3 +941,12 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)return 0 ;#endif } + +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev) +{ +#if defined(CONFIG_DEBUG_FS ) + +debugfs_remove (rdev->mman.vram); + rdev->mman.vram =NULL ; +#endif +} --1.8.1.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/6] drm/radeon: add VRAM debugfs access
Am 12.12.2013 14:31, schrieb Alex Deucher:
Quoted 78 lines
Quoted 76 lines · Christian König
From: Christian König <[email protected]>
Not very fast, but makes it possible to access even the normally inaccessible parts of VRAM from userspace.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/radeon/radeon.h | 4 +++ drivers/gpu/drm/radeon/radeon_ttm.c | 72 ++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon.h +4
-0@@ -413,6 +413,10 @@ struct radeon_mman {struct ttm_bo_device bdev;bool mem_global_referenced;bool initialized; + +#if defined(CONFIG_DEBUG_FS ) +struct dentry *vram; +#endif };/* bo virtual address in a specific vm */ drivers/gpu/drm/radeon/radeon_ttm.c +22
-0@@ -39,12 +39,14 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/swiotlb.h> +#include <linux/debugfs.h> #include "radeon_reg.h" #include "radeon.h" #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)static int radeon_ttm_debugfs_init (struct radeon_device *rdev); +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev);static struct radeon_device *radeon_get_rdev (struct ttm_bo_device *bdev) {@@ -753,6 +755,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)if (!rdev->mman.initialized)return ; +radeon_ttm_debugfs_fini (rdev);if (rdev->stollen_vga_memory) { r =radeon_bo_reserve (rdev->stollen_vga_memory, false);if (r ==0 ) {@@ -862,12 +865,70 @@ static struct drm_info_list radeon_ttm_debugfs_list[] = {#endif }; +static int radeon_ttm_mem_open (struct inode *inode,struct file *filep) +{ + filep->private_data = inode->i_private; +return 0 ; +} + +static ssize_t radeon_ttm_vram_read (struct file *f,char __user *buf, +size_t size,loff_t *pos) +{ +struct radeon_device *rdev = f->private_data; +ssize_t result =0 ; +int r; + +if (size &0x3 || *pos &0x3 ) +return -EINVAL ; + +while (size) { +unsigned long flags; +uint32_t value;
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_ttm.c static struct drm_info_list radeon_ttm_debugfs_list[] = { · line 892
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_ttm.c +6
-0+ +if (*pos >= rdev->mc.mc_vram_size || *pos >=0x7FFFFFFF ) +return result; + +spin_lock_irqsave (&rdev->mmio_idx_lock, flags); +WREG32 (RADEON_MM_INDEX , ((uint32_t )*pos) |0x80000000 );Starting with evergreen dGPUs, there is also an
MM_INDEX_HIregister at0x18for accessing addresses over 30 bits.
I know, but I wanted to keep that as simple and stupid as possible. I mean this code should work from r100 till CIK and except for HAINAN do we really have cards with more than 2GB or ram?
And I'm not even sure if radeon_ttm is the right place for this.
Christian.
Quoted 67 lines
Alex
Quoted 63 lines
drivers/gpu/drm/radeon/radeon_ttm.c +43
-2+ value =RREG32 (RADEON_MM_DATA ); +spin_unlock_irqrestore (&rdev->mmio_idx_lock, flags); + + r =put_user (value, (uint32_t *)buf); +if (r) +return r; + + result +=4 ; + buf +=4 ; + *pos +=4 ; + size -= 4; + } + +return result; +} + +static const struct file_operations radeon_ttm_vram_fops = { + .owner =THIS_MODULE , + .open = radeon_ttm_mem_open, + .read = radeon_ttm_vram_read, +}; +#endif static int radeon_ttm_debugfs_init (struct radeon_device *rdev) {#if defined(CONFIG_DEBUG_FS ) -unsigned count =ARRAY_SIZE (radeon_ttm_debugfs_list); +unsigned count; + +struct drm_minor *minor = rdev->ddev->primary; +struct dentry *ent, *root = minor->debugfs_root; + + ent =debugfs_create_file ("radeon_vram" ,S_IFREG |S_IRUGO , root, + rdev, &radeon_ttm_vram_fops); +if (IS_ERR (ent)) +return PTR_ERR (ent); + rdev->mman.vram = ent; + + count =ARRAY_SIZE (radeon_ttm_debugfs_list);#ifdef CONFIG_SWIOTLB if (!swiotlb_nr_tbl ())@@ -880,3 +941,12 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)return 0 ;#endif } + +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev) +{ +#if defined(CONFIG_DEBUG_FS ) + +debugfs_remove (rdev->mman.vram); + rdev->mman.vram =NULL ; +#endif +} --1.8.1.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/6] drm/radeon: add VRAM debugfs access
Quoted 97 lines · Christian König
Am 12.12.2013 14:31, schrieb Alex Deucher:
Quoted 85 lines
Quoted 83 lines · Christian König
From: Christian König <[email protected]>
Not very fast, but makes it possible to access even the normally inaccessible parts of VRAM from userspace.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/radeon/radeon.h | 4 +++ drivers/gpu/drm/radeon/radeon_ttm.c | 72 ++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-)drivers/gpu/drm/radeon/radeon.h +4
-0@@ -413,6 +413,10 @@ struct radeon_mman {struct ttm_bo_device bdev;bool mem_global_referenced;bool initialized; + +#if defined(CONFIG_DEBUG_FS ) +struct dentry *vram; +#endif };/* bo virtual address in a specific vm */ drivers/gpu/drm/radeon/radeon_ttm.c +2
-0@@ -39,12 +39,14 @@#include <linux/seq_file.h> #include <linux/slab.h> #include <linux/swiotlb.h> +#include <linux/debugfs.h> #include "radeon_reg.h" #include "radeon.h" #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)static int radeon_ttm_debugfs_init (struct radeon_device *rdev); +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev);static struct radeon_device *radeon_get_rdev (struct ttm_bo_device *bdev){drivers/gpu/drm/radeon/radeon_ttm.c +21
-0@@ -753,6 +755,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)if (!rdev->mman.initialized)return ; +radeon_ttm_debugfs_fini (rdev);if (rdev->stollen_vga_memory) { r =radeon_bo_reserve (rdev->stollen_vga_memory, false);if (r ==0 ) {@@ -862,12 +865,70 @@ static struct drm_info_list radeon_ttm_debugfs_list[] = {#endif }; +static int radeon_ttm_mem_open (struct inode *inode,struct file *filep) +{ + filep->private_data = inode->i_private; +return 0 ; +} + +static ssize_t radeon_ttm_vram_read (struct file *f,char __user *buf, +size_t size,loff_t *pos) +{ +struct radeon_device *rdev = f->private_data; +ssize_t result =0 ; +int r; + +if (size &0x3 || *pos &0x3 ) +return -EINVAL ; + +while (size) { +unsigned long flags; +uint32_t value; +Quoted 8 lines
drivers/gpu/drm/radeon/radeon_ttm.c static struct drm_info_list radeon_ttm_debugfs_list[] = { · line 892
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_ttm.c +5
-0+if (*pos >= rdev->mc.mc_vram_size || *pos >=0x7FFFFFFF ) +return result; + +spin_lock_irqsave (&rdev->mmio_idx_lock, flags); +WREG32 (RADEON_MM_INDEX , ((uint32_t )*pos) |0x80000000 );Starting with evergreen dGPUs, there is also an
MM_INDEX_HIregister at0x18for accessing addresses over 30 bits.
Quoted 3 lines
I know, but I wanted to keep that as simple and stupid as possible. I mean this code should work from r100 till CIK and except for HAINAN do we really have cards with more than 2GB or ram?
Most Hawaii boards are shipping with 4GB and a number of workstation cards have large amounts of memory.
Alex
Quoted 76 lines
And I'm not even sure if
radeon_ttmis the right place for this.Christian.
Quoted 68 lines
Alex
Quoted 64 lines
drivers/gpu/drm/radeon/radeon_ttm.c +34
-1+ value =RREG32 (RADEON_MM_DATA ); +spin_unlock_irqrestore (&rdev->mmio_idx_lock, flags); + + r =put_user (value, (uint32_t *)buf); +if (r) +return r; + + result +=4 ; + buf +=4 ; + *pos +=4 ; + size -= 4; + } + +return result; +} + +static const struct file_operations radeon_ttm_vram_fops = { + .owner =THIS_MODULE , + .open = radeon_ttm_mem_open, + .read = radeon_ttm_vram_read, +}; +#endif static int radeon_ttm_debugfs_init (struct radeon_device *rdev) {#if defined(CONFIG_DEBUG_FS ) -unsigned count =ARRAY_SIZE (radeon_ttm_debugfs_list); +unsigned count; + +struct drm_minor *minor = rdev->ddev->primary; +struct dentry *ent, *root = minor->debugfs_root; + + ent =debugfs_create_file ("radeon_vram" ,S_IFREG |S_IRUGO , root, + rdev, &radeon_ttm_vram_fops); +if (IS_ERR (ent)) +return PTR_ERR (ent); + rdev->mman.vram = ent; + + count =ARRAY_SIZE (radeon_ttm_debugfs_list);#ifdef CONFIG_SWIOTLB if (!swiotlb_nr_tbl())drivers/gpu/drm/radeon/radeon_ttm.c +9
-1@@ -880,3 +941,12 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)return 0 ;#endif } + +static void radeon_ttm_debugfs_fini (struct radeon_device *rdev) +{ +#if defined(CONFIG_DEBUG_FS ) + +debugfs_remove (rdev->mman.vram); + rdev->mman.vram =NULL ; +#endif +} --1.8.1.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/6 drm/radeon: add GART debugfs access
In reply to Christian KönigFrom: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_ttm.c | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+)
drivers/gpu/drm/radeon/radeon.h +1 -0
@@ -416,6 +416,7 @@ struct radeon_mman {#if defined(CONFIG_DEBUG_FS )struct dentry *vram; +struct dentry *gtt;#endif };
drivers/gpu/drm/radeon/radeon_ttm.c +54 -0
71 lines not on this page · raw message
Signature · 6 lines
1.8.1.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel