[PATCH] drm7amdgpu: once more fix amdgpu_bo_create_kernel_at

Alex Deucher alexdeucher at gmail.com
Tue Sep 24 12:29:10 UTC 2019


On Tue, Sep 24, 2019 at 7:56 AM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> When CPU access is needed we should tell that to
> amdgpu_bo_create_reserved() or otherwise the access is denied later on.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 12d2adcdf14e..f10b6175e20c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -369,7 +369,7 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>         size = ALIGN(size, PAGE_SIZE);
>
>         r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain, bo_ptr,
> -                                     NULL, NULL);
> +                                     NULL, cpu_addr);
>         if (r)
>                 return r;
>
> @@ -377,12 +377,15 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>          * Remove the original mem node and create a new one at the request
>          * position.
>          */
> +       if (cpu_addr)
> +               amdgpu_bo_kunmap(*bo_ptr);
> +
> +       ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
> +
>         for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) {
>                 (*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT;
>                 (*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT;
>         }
> -
> -       ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem);
>         r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement,
>                              &(*bo_ptr)->tbo.mem, &ctx);
>         if (r)
> --
> 2.14.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list