Re: [PATCH 1/2] drm/amdgpu/uvd6: fix allocation size in enc ring test
On 2019-10-14 9:04 a.m., Koenig, Christian wrote: > Am 14.10.19 um 15:01 schrieb Alex Deucher: >> On Mon, Oct 14, 2019 at 5:06 AM Christian König >> wrote: >>> Am 11.10.19 um 22:50 schrieb Alex Deucher: We need to allocate a large enough buffer for the session info, otherwise the IB test can overwrite other memory. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241 Signed-off-by: Alex Deucher >>> Acked-by: Christian König for the series. >> + 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 > At least originally we allocated a separate 4KB BO in VRAM for this. The > message was quite large IIRC. > > Christian. > >> Alex >> --- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 670784a78512..909bc2ce791f 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c @@ -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, ); + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, ); if (r) return r; ib = >ibs[0]; - dummy = ib->gpu_addr + 1024; + dummy = ib->gpu_addr + (ib_size_dw * 4); ib->length_dw = 0; ib->ptr[ib->length_dw++] = 0x0018; @@ -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, ); + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, ); if (r) return r; ib = >ibs[0]; - dummy = ib->gpu_addr + 1024; + dummy = ib->gpu_addr + (ib_size_dw * 4); ib->length_dw = 0; ib->ptr[ib->length_dw++] = 0x0018; ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 1/2] drm/amdgpu/uvd6: fix allocation size in enc ring test
Am 14.10.19 um 15:01 schrieb Alex Deucher: > On Mon, Oct 14, 2019 at 5:06 AM Christian König > wrote: >> Am 11.10.19 um 22:50 schrieb Alex Deucher: >>> We need to allocate a large enough buffer for the >>> session info, otherwise the IB test can overwrite >>> other memory. >>> >>> Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241 >>> Signed-off-by: Alex Deucher >> Acked-by: Christian König for the series. > + 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. > > Alex > >>> --- >>>drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 >>>1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >>> b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >>> index 670784a78512..909bc2ce791f 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >>> @@ -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, ); >>> + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, >>> ); >>>if (r) >>>return r; >>> >>>ib = >ibs[0]; >>> - dummy = ib->gpu_addr + 1024; >>> + dummy = ib->gpu_addr + (ib_size_dw * 4); >>> >>>ib->length_dw = 0; >>>ib->ptr[ib->length_dw++] = 0x0018; >>> @@ -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, ); >>> + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, >>> ); >>>if (r) >>>return r; >>> >>>ib = >ibs[0]; >>> - dummy = ib->gpu_addr + 1024; >>> + dummy = ib->gpu_addr + (ib_size_dw * 4); >>> >>>ib->length_dw = 0; >>>ib->ptr[ib->length_dw++] = 0x0018; ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 1/2] drm/amdgpu/uvd6: fix allocation size in enc ring test
On Mon, Oct 14, 2019 at 5:06 AM Christian König wrote: > > Am 11.10.19 um 22:50 schrieb Alex Deucher: > > We need to allocate a large enough buffer for the > > session info, otherwise the IB test can overwrite > > other memory. > > > > Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241 > > Signed-off-by: Alex Deucher > > Acked-by: Christian König for the series. + 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 > > > --- > > drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > > b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > > index 670784a78512..909bc2ce791f 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > > +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c > > @@ -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, ); > > + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, > > ); > > if (r) > > return r; > > > > ib = >ibs[0]; > > - dummy = ib->gpu_addr + 1024; > > + dummy = ib->gpu_addr + (ib_size_dw * 4); > > > > ib->length_dw = 0; > > ib->ptr[ib->length_dw++] = 0x0018; > > @@ -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, ); > > + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, > > ); > > if (r) > > return r; > > > > ib = >ibs[0]; > > - dummy = ib->gpu_addr + 1024; > > + dummy = ib->gpu_addr + (ib_size_dw * 4); > > > > ib->length_dw = 0; > > ib->ptr[ib->length_dw++] = 0x0018; > ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 1/2] drm/amdgpu/uvd6: fix allocation size in enc ring test
Am 11.10.19 um 22:50 schrieb Alex Deucher: We need to allocate a large enough buffer for the session info, otherwise the IB test can overwrite other memory. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=204241 Signed-off-by: Alex Deucher Acked-by: Christian König for the series. --- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 670784a78512..909bc2ce791f 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c @@ -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, ); + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, ); if (r) return r; ib = >ibs[0]; - dummy = ib->gpu_addr + 1024; + dummy = ib->gpu_addr + (ib_size_dw * 4); ib->length_dw = 0; ib->ptr[ib->length_dw++] = 0x0018; @@ -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, ); + r = amdgpu_job_alloc_with_ib(ring->adev, (ib_size_dw * 4) + 1024, ); if (r) return r; ib = >ibs[0]; - dummy = ib->gpu_addr + 1024; + dummy = ib->gpu_addr + (ib_size_dw * 4); ib->length_dw = 0; ib->ptr[ib->length_dw++] = 0x0018; ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx