[PATCH 07/12] drm/amdgpu: reserve the first 2x2MB of GART

Alex Deucher alexdeucher at gmail.com
Fri Jun 30 16:41:46 UTC 2017


On Fri, Jun 30, 2017 at 7:22 AM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> We want to use them as remap address space.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 5 ++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h     | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> index 6fdf83a..a0976dc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@ -43,12 +43,15 @@ static int amdgpu_gtt_mgr_init(struct ttm_mem_type_manager *man,
>                                unsigned long p_size)
>  {
>         struct amdgpu_gtt_mgr *mgr;
> +       uint64_t start, size;
>
>         mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
>         if (!mgr)
>                 return -ENOMEM;
>
> -       drm_mm_init(&mgr->mm, 0, p_size);
> +       start = AMDGPU_GTT_MAX_TRANSFER_SIZE * AMDGPU_GTT_NUM_TRANSFER_WINDOWS;
> +       size = p_size - start;
> +       drm_mm_init(&mgr->mm, start, size);
>         spin_lock_init(&mgr->lock);
>         mgr->available = p_size;
>         man->priv = mgr;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> index 2ade5c5..9c4da0a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
> @@ -34,6 +34,9 @@
>  #define AMDGPU_PL_FLAG_GWS             (TTM_PL_FLAG_PRIV << 1)
>  #define AMDGPU_PL_FLAG_OA              (TTM_PL_FLAG_PRIV << 2)
>
> +#define AMDGPU_GTT_MAX_TRANSFER_SIZE   512

Maybe AMDGPU_GTT_MAX_TRANSFER_SIZE_PAGES?  Also you may want to update
the patch title to say 2x512 pages rather than 2x2MB.

> +#define AMDGPU_GTT_NUM_TRANSFER_WINDOWS        2
> +
>  struct amdgpu_mman {
>         struct ttm_bo_global_ref        bo_global_ref;
>         struct drm_global_reference     mem_global_ref;
> --
> 2.7.4
>
> _______________________________________________
> 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