dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix GPU TLB update error when PAGE_SIZE > AMDGPU_PAGE_SIZE
@ 2021-05-14  6:40 Huacai Chen
  2021-05-14  7:18 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Huacai Chen @ 2021-05-14  6:40 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie
  Cc: Yi Li, dri-devel, amd-gfx, Huacai Chen

From: Yi Li <liyi@loongson.cn>

When PAGE_SIZE is larger than AMDGPU_PAGE_SIZE, the number of GPU TLB
entries which need to update in amdgpu_map_buffer() should be multiplied
by AMDGPU_GPU_PAGES_IN_CPU_PAGE (PAGE_SIZE / AMDGPU_PAGE_SIZE).

Signed-off-by: Yi Li <liyi@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 3bef0432cac2..a376a993e474 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -225,7 +225,7 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
 	*addr += mm_cur->start & ~PAGE_MASK;
 
 	num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
-	num_bytes = num_pages * 8;
+	num_bytes = num_pages * 8 * AMDGPU_GPU_PAGES_IN_CPU_PAGE;
 
 	r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes,
 				     AMDGPU_IB_POOL_DELAYED, &job);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix GPU TLB update error when PAGE_SIZE > AMDGPU_PAGE_SIZE
  2021-05-14  6:40 [PATCH] drm/amdgpu: Fix GPU TLB update error when PAGE_SIZE > AMDGPU_PAGE_SIZE Huacai Chen
@ 2021-05-14  7:18 ` Christian König
  2021-05-14 21:16   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2021-05-14  7:18 UTC (permalink / raw)
  To: Huacai Chen, Alex Deucher, David Airlie; +Cc: Yi Li, dri-devel, amd-gfx

Am 14.05.21 um 08:40 schrieb Huacai Chen:
> From: Yi Li <liyi@loongson.cn>
>
> When PAGE_SIZE is larger than AMDGPU_PAGE_SIZE, the number of GPU TLB
> entries which need to update in amdgpu_map_buffer() should be multiplied
> by AMDGPU_GPU_PAGES_IN_CPU_PAGE (PAGE_SIZE / AMDGPU_PAGE_SIZE).
>
> Signed-off-by: Yi Li <liyi@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 3bef0432cac2..a376a993e474 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -225,7 +225,7 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
>   	*addr += mm_cur->start & ~PAGE_MASK;
>   
>   	num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
> -	num_bytes = num_pages * 8;
> +	num_bytes = num_pages * 8 * AMDGPU_GPU_PAGES_IN_CPU_PAGE;
>   
>   	r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes,
>   				     AMDGPU_IB_POOL_DELAYED, &job);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix GPU TLB update error when PAGE_SIZE > AMDGPU_PAGE_SIZE
  2021-05-14  7:18 ` Christian König
@ 2021-05-14 21:16   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-05-14 21:16 UTC (permalink / raw)
  To: Christian König
  Cc: David Airlie, Yi Li, amd-gfx list, Maling list - DRI developers,
	Alex Deucher, Huacai Chen

Applied.  Thanks!

Alex


On Fri, May 14, 2021 at 3:18 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 14.05.21 um 08:40 schrieb Huacai Chen:
> > From: Yi Li <liyi@loongson.cn>
> >
> > When PAGE_SIZE is larger than AMDGPU_PAGE_SIZE, the number of GPU TLB
> > entries which need to update in amdgpu_map_buffer() should be multiplied
> > by AMDGPU_GPU_PAGES_IN_CPU_PAGE (PAGE_SIZE / AMDGPU_PAGE_SIZE).
> >
> > Signed-off-by: Yi Li <liyi@loongson.cn>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > index 3bef0432cac2..a376a993e474 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > @@ -225,7 +225,7 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
> >       *addr += mm_cur->start & ~PAGE_MASK;
> >
> >       num_dw = ALIGN(adev->mman.buffer_funcs->copy_num_dw, 8);
> > -     num_bytes = num_pages * 8;
> > +     num_bytes = num_pages * 8 * AMDGPU_GPU_PAGES_IN_CPU_PAGE;
> >
> >       r = amdgpu_job_alloc_with_ib(adev, num_dw * 4 + num_bytes,
> >                                    AMDGPU_IB_POOL_DELAYED, &job);
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-14 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  6:40 [PATCH] drm/amdgpu: Fix GPU TLB update error when PAGE_SIZE > AMDGPU_PAGE_SIZE Huacai Chen
2021-05-14  7:18 ` Christian König
2021-05-14 21:16   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).