Skip to contentSkip to conversation

drm/amd/amdgpu: Correct ring wptr address in debugfs (v2)

PATCH In review Tom St Denis 2 participants 2 messages Mar 29, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: Correct ring wptr address in debugfs (v2)

On gfx9 hardware the value is not wrapped and is a 64-bit value. So we reduce it modulo the ring size.

(v2) use buf_mask instead of computing on the fly

---
 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
index ac0ce3f27f87..130357bdc275 100644
@@ -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)
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]

Reviewed-by
#2 lore raw

Am 29.03.2017 um 19:48 schrieb Tom St Denis:

Quoted 4 lines

On gfx9 hardware the value is not wrapped and is a 64-bit value. So we reduce it modulo the ring size.

Quoted 11 lines

(v2) use buf_mask instead of computing on the fly

---
  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
index ac0ce3f27f87..130357bdc275 100644

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->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)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx