Skip to contentSkip to conversation

drm/amdgpu/uvd6: fix allocation size in enc ring test

PATCH In review Alex Deucher 4 participants 6 messages Oct 11, 2019 – Oct 15, 2019 4 messages not in the archive

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

PATCH 1/2 drm/amdgpu/uvd6: fix allocation size in enc ring test

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -4
index 670784a78512..909bc2ce791f 100644
@@ -215,12 +215,12 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
 	uint64_t dummy;
 	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
 	if (r)
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -277,12 +277,12 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
 	uint64_t dummy;
 	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
 	if (r)
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
Signature · 6 lines
2.20.1

_______________________________________________
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): 20191011205050.21021-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu/uvd7: fix allocation size in enc ring test

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

---
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +4 -4
index 01f658fa72c6..0ce6a1e7ff79 100644
@@ -223,12 +223,12 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
 	uint64_t dummy;
 	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
 	if (r)
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -284,12 +284,12 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl
 	uint64_t dummy;
 	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
 	if (r)
 		return r;
 
 	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
 	ib->length_dw = 0;
 	ib->ptr[ib->length_dw++] = 0x00000018;
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw
In reply to a message not in the archive

Am 11.10.19 um 22:50 schrieb Alex Deucher:

Quoted 6 lines

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -3
index 670784a78512..909bc2ce791f 100644
@@ -215,12 +215,12 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
  	uint64_t dummy;
  	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
  	if (r)
  		return r;
 
  	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
  	ib->length_dw = 0;
  	ib->ptr[ib->length_dw++] = 0x00000018;
@@ -277,12 +277,12 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
  	uint64_t dummy;
  	int i, r;
 
-	r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, · line 288

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -1
+	r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
  	if (r)
  		return r;
 
  	ib = &job->ibs[0];
-	dummy = ib->gpu_addr + 1024;
+	dummy = ib->gpu_addr + (ib_size_dw * 4);
 
  	ib->length_dw = 0;
  	ib->ptr[ib->length_dw++] = 0x00000018;

_______________________________________________
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): 990fccc3-f8a1-a1dc-52c6-5299c645c24a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw
Quoted 10 lines · Christian König

Am 11.10.19 um 22:50 schrieb Alex Deucher:

Quoted 6 lines

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

+ Leo, James

Seems like we still overwrite the buffer. Do you know how big the session buffer needs to be? Is it different for UVD and VCN?

Alex

Quoted 33 lines
Quoted 33 lines
---
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -3
index 670784a78512..909bc2ce791f 100644
@@ -215,12 +215,12 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
      uint64_t dummy;
      int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
      if (r)
              return r;
 
      ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
      ib->length_dw = 0;
      ib->ptr[ib->length_dw++] = 0x00000018;
@@ -277,12 +277,12 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
      uint64_t dummy;
      int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
      if (r)
              return r;
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · line 226

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -1
      ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
      ib->length_dw = 0;
      ib->ptr[ib->length_dw++] = 0x00000018;

_______________________________________________
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): CADnq5_O9ipAScOVXAvaqGTuM-4qMhzJdAK6_yxCg3-E3xzfqOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw

Am 14.10.19 um 15:01 schrieb Alex Deucher:

Quoted 7 lines
Quoted 5 lines · Christian König

Am 11.10.19 um 22:50 schrieb Alex Deucher:

Quoted 4 lines

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

+ Leo, James

Seems like we still overwrite the buffer. Do you know how big the session buffer needs to be? Is it different for UVD and VCN?

At least originally we allocated a separate 4KB BO in VRAM for this. The message was quite large IIRC.

Christian.

Quoted 35 lines

Alex

Quoted 32 lines
Quoted 32 lines
---
   drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++----
   1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -3
index 670784a78512..909bc2ce791f 100644
@@ -215,12 +215,12 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
       uint64_t dummy;
       int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
       if (r)
               return r;
 
       ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
       ib->length_dw = 0;
       ib->ptr[ib->length_dw++] = 0x00000018;
@@ -277,12 +277,12 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
       uint64_t dummy;
       int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
       if (r)
               return r;
 
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · line 226

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -1
       ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
       ib->length_dw = 0;
       ib->ptr[ib->length_dw++] = 0x00000018;

_______________________________________________
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): 5f597d92-86f1-d221-abde-d3f7f9597024-5C7GfCeVMHo@public.gmane.org

#9 lore raw
Quoted 15 lines · Christian

Am 14.10.19 um 15:01 schrieb Alex Deucher:

Quoted 14 lines
Quoted 8 lines · Christian König

Am 11.10.19 um 22:50 schrieb Alex Deucher:

Quoted 6 lines

We need to allocate a large enough buffer for the
session info, otherwise the IB test can overwrite
other memory.

+ Leo, James

Seems like we still overwrite the buffer. Do you know how big the session buffer needs to be? Is it different for UVD and VCN?

I will check with Firmware team.

James

Quoted 39 lines

At least originally we allocated a separate 4KB BO in VRAM for this. The message was quite large IIRC.

Christian.

Quoted 34 lines

Alex

Quoted 32 lines
Quoted 32 lines
---
    drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -3
index 670784a78512..909bc2ce791f 100644
@@ -215,12 +215,12 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle
        uint64_t dummy;
        int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
        if (r)
                return r;
 
        ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
        ib->length_dw = 0;
        ib->ptr[ib->length_dw++] = 0x00000018;
@@ -277,12 +277,12 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
        uint64_t dummy;
        int i, r;
 
-     r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
+     r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, &job);
        if (r)
                return r;
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, · line 288

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -1
        ib = &job->ibs[0];
-     dummy = ib->gpu_addr + 1024;
+     dummy = ib->gpu_addr + (ib_size_dw * 4);
 
        ib->length_dw = 0;
        ib->ptr[ib->length_dw++] = 0x00000018;

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