Commit 771c8ec1 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: use the ring name for debugfs (v2)

Instead of hard coding just another name in the ring code.

v2: squash in Tom's rebase fix
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b38d99c4
...@@ -368,9 +368,8 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data) ...@@ -368,9 +368,8 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data)
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
int roffset = *(int*)node->info_ent->data; int roffset = (unsigned long)node->info_ent->data;
struct amdgpu_ring *ring = (void *)(((uint8_t*)adev) + roffset); struct amdgpu_ring *ring = (void *)(((uint8_t*)adev) + roffset);
uint32_t rptr, wptr, rptr_next; uint32_t rptr, wptr, rptr_next;
unsigned i; unsigned i;
...@@ -413,46 +412,37 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data) ...@@ -413,46 +412,37 @@ static int amdgpu_debugfs_ring_info(struct seq_file *m, void *data)
return 0; return 0;
} }
/* TODO: clean this up !*/ static struct drm_info_list amdgpu_debugfs_ring_info_list[AMDGPU_MAX_RINGS];
static int amdgpu_gfx_index = offsetof(struct amdgpu_device, gfx.gfx_ring[0]); static char amdgpu_debugfs_ring_names[AMDGPU_MAX_RINGS][32];
static int cayman_cp1_index = offsetof(struct amdgpu_device, gfx.compute_ring[0]);
static int cayman_cp2_index = offsetof(struct amdgpu_device, gfx.compute_ring[1]);
static int amdgpu_dma1_index = offsetof(struct amdgpu_device, sdma.instance[0].ring);
static int amdgpu_dma2_index = offsetof(struct amdgpu_device, sdma.instance[1].ring);
static int r600_uvd_index = offsetof(struct amdgpu_device, uvd.ring);
static int si_vce1_index = offsetof(struct amdgpu_device, vce.ring[0]);
static int si_vce2_index = offsetof(struct amdgpu_device, vce.ring[1]);
static const struct drm_info_list amdgpu_debugfs_ring_info_list[] = {
{"amdgpu_ring_gfx", amdgpu_debugfs_ring_info, 0, &amdgpu_gfx_index},
{"amdgpu_ring_cp1", amdgpu_debugfs_ring_info, 0, &cayman_cp1_index},
{"amdgpu_ring_cp2", amdgpu_debugfs_ring_info, 0, &cayman_cp2_index},
{"amdgpu_ring_dma1", amdgpu_debugfs_ring_info, 0, &amdgpu_dma1_index},
{"amdgpu_ring_dma2", amdgpu_debugfs_ring_info, 0, &amdgpu_dma2_index},
{"amdgpu_ring_uvd", amdgpu_debugfs_ring_info, 0, &r600_uvd_index},
{"amdgpu_ring_vce1", amdgpu_debugfs_ring_info, 0, &si_vce1_index},
{"amdgpu_ring_vce2", amdgpu_debugfs_ring_info, 0, &si_vce2_index},
};
#endif #endif
static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring) static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
struct amdgpu_ring *ring)
{ {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
unsigned offset = (uint8_t*)ring - (uint8_t*)adev;
unsigned i; unsigned i;
struct drm_info_list *info;
char *name;
for (i = 0; i < ARRAY_SIZE(amdgpu_debugfs_ring_info_list); ++i) { for (i = 0; i < ARRAY_SIZE(amdgpu_debugfs_ring_info_list); ++i) {
const struct drm_info_list *info = &amdgpu_debugfs_ring_info_list[i]; info = &amdgpu_debugfs_ring_info_list[i];
int roffset = *(int*)amdgpu_debugfs_ring_info_list[i].data; if (!info->data)
struct amdgpu_ring *other = (void *)(((uint8_t*)adev) + roffset); break;
unsigned r; }
if (other != ring) if (i == ARRAY_SIZE(amdgpu_debugfs_ring_info_list))
continue; return -ENOSPC;
r = amdgpu_debugfs_add_files(adev, info, 1); name = &amdgpu_debugfs_ring_names[i][0];
if (r) sprintf(name, "amdgpu_ring_%s", ring->name);
return r; info->name = name;
} info->show = amdgpu_debugfs_ring_info;
info->driver_features = 0;
info->data = (void*)(uintptr_t)offset;
return amdgpu_debugfs_add_files(adev, info, 1);
#endif #endif
return 0; return 0;
} }
...@@ -4438,7 +4438,7 @@ static int gfx_v7_0_sw_init(void *handle) ...@@ -4438,7 +4438,7 @@ static int gfx_v7_0_sw_init(void *handle)
ring->me = 1; /* first MEC */ ring->me = 1; /* first MEC */
ring->pipe = i / 8; ring->pipe = i / 8;
ring->queue = i % 8; ring->queue = i % 8;
sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue); sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue);
irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
/* type-2 packets are deprecated on MEC, use type-3 instead */ /* type-2 packets are deprecated on MEC, use type-3 instead */
r = amdgpu_ring_init(adev, ring, 1024, r = amdgpu_ring_init(adev, ring, 1024,
......
...@@ -1594,7 +1594,7 @@ static int gfx_v8_0_sw_init(void *handle) ...@@ -1594,7 +1594,7 @@ static int gfx_v8_0_sw_init(void *handle)
ring->me = 1; /* first MEC */ ring->me = 1; /* first MEC */
ring->pipe = i / 8; ring->pipe = i / 8;
ring->queue = i % 8; ring->queue = i % 8;
sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue); sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue);
irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
/* type-2 packets are deprecated on MEC, use type-3 instead */ /* type-2 packets are deprecated on MEC, use type-3 instead */
r = amdgpu_ring_init(adev, ring, 1024, r = amdgpu_ring_init(adev, ring, 1024,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment