drm/amd/amdgpu: Correct ring wptr address in debugfs (v2)
authorTom St Denis <tom.stdenis@amd.com>
Wed, 29 Mar 2017 17:01:30 +0000 (13:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:55:53 +0000 (23:55 -0400)
On gfx9 hardware the value is not wrapped and is a 64-bit value.  So
we reduce it modulo the ring size.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
(v2) use buf_mask instead of computing on the fly

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index 783d52a007eafa70bbcb63372b02ad678d32e5f2..6a85db0c0bc3b82082f4ad5ff392e2b633ea3f78 100644 (file)
@@ -320,8 +320,8 @@ static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf,
 
        if (*pos < 12) {
                early[0] = amdgpu_ring_get_rptr(ring);
-               early[1] = amdgpu_ring_get_wptr(ring);
-               early[2] = ring->wptr;
+               early[1] = amdgpu_ring_get_wptr(ring) & ring->buf_mask;
+               early[2] = ring->wptr & ring->buf_mask;
                for (i = *pos / 4; i < 3 && size; i++) {
                        r = put_user(early[i], (uint32_t *)buf);
                        if (r)