On 29/03/17 01:46 PM, Christian König wrote: > Am 29.03.2017 um 19:44 schrieb Tom St Denis: >> On 29/03/17 01:41 PM, Christian König wrote: >>> Am 29.03.2017 um 19:07 schrieb Tom St Denis: >>>> On 29/03/17 01:07 PM, Tom St Denis wrote: >>>>> 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 at amd.com> >>>>> --- >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- >>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c >>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c >>>>> index ac0ce3f27f87..b6d2c0b2a501 100644 >>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c >>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c >>>>> @@ -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->ring_size >> >>>>> 2) - 1); >>>>> + early[2] = ring->wptr & ((ring->ring_size >> 2) - 1); >>>>> for (i = *pos / 4; i < 3 && size; i++) { >>>>> r = put_user(early[i], (uint32_t *)buf); >>>>> if (r) >>>>> >>>> >>>> Particularly if reviewers could make sure I got the dword/byte >>>> conversion correct here. It's my understanding ring_size is bytes and >>>> the get_*ptr() macros is in dwords right? >>> >>> Actually you should use ptr_mask here instead, this way you don't need >>> to mess with the ring size at all. >> >> ring->buf_mask = (ring->ring_size / 4) - 1; >> ring->ptr_mask = ring->funcs->support_64bit_ptrs ? >> 0xffffffffffffffff : ring->buf_mask; >> >> This won't wrap the value like debugfs needs though. > > Ups, I meant buf_mask instead of ptr_mask. > > We seem to mess those two up more than once, might think about a better > name for them. > Righto v2 coming up. Cheers, Tom