drm/amd/amdgpu: Correct ring wptr address in debugfs
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: Correct ring wptr address in debugfs
On gfx9 hardware the value is not wrapped and is a 64-bit value. So we reduce it modulo the ring size.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
@@ -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)
Signature · 6 lines
2.12.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Tom St Denis
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf, · line 327
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-2@@ -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?
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 0e859090-4374-4d5e-03c2-81f1bca49d58-5C7GfCeVMHo@public.gmane.org
Am 29.03.2017 um 19:07 schrieb Tom St Denis:
Quoted 16 lines · Tom St Denis
Quoted 15 lines
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0@@ -320,8 +320,8 @@ static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf,
Quoted 13 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-2if (*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_sizeis 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.
Regards,
Christian.
Quoted 6 lines
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): d6de1f4d-72d8-1dd4-8bb9-983290047d7e-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 34 lines · Christian König
Am 29.03.2017 um 19:07 schrieb Tom St Denis:
Quoted 17 lines · Tom St Denis
Quoted 16 lines
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0@@ -320,8 +320,8 @@ static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf,Quoted 15 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-2if (*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_sizeis bytes and the get_*ptr() macros is in dwords right?
Quoted 2 lines
Actually you should use
ptr_maskhere 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.
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): dd2aa2a7-293e-c172-47f5-dc1a5f1c2ae6-5C7GfCeVMHo@public.gmane.org
Am 29.03.2017 um 19:44 schrieb Tom St Denis:
Quoted 35 lines · Christian König
Quoted 34 lines
Am 29.03.2017 um 19:07 schrieb Tom St Denis:
Quoted 32 lines · Tom St Denis
Quoted 24 lines
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-2@@ -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++) {Quoted 3 lines
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_sizeis bytes and the get_*ptr() macros is in dwords right?
Quoted 8 lines
Quoted 2 lines
Actually you should use
ptr_maskhere 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.
Christian.
Quoted 2 lines
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 59c599ee-887a-9b11-3412-e33358f9e0b7-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 43 lines · Christian König
Am 29.03.2017 um 19:44 schrieb Tom St Denis:
Quoted 42 lines · Christian König
Quoted 34 lines
Am 29.03.2017 um 19:07 schrieb Tom St Denis:
Quoted 17 lines · Tom St Denis
Quoted 16 lines
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0@@ -320,8 +320,8 @@ static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf,Quoted 15 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-2if (*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_sizeis bytes and the get_*ptr() macros is in dwords right?Quoted 2 lines
Actually you should use
ptr_maskhere 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;
Quoted 7 lines
Quoted 1 line
This won't wrap the value like debugfs needs though.
Ups, I meant
buf_maskinstead ofptr_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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx