[PATCH] drm/amdgpu/discovery: reserve discovery data at the top of VRAM

Alex Deucher alexdeucher at gmail.com
Thu Oct 10 12:57:36 UTC 2019


On Thu, Oct 10, 2019 at 8:48 AM Yuan, Xiaojie <Xiaojie.Yuan at amd.com> wrote:
>
> IP Discovery data is TMR fenced by the latest PSP BL,
> so we need to reserve this region.
>
> Signed-off-by: Xiaojie Yuan <xiaojie.yuan at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 15 +++++++++++++++
>  2 files changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index be0b2c69c223..6775647f0ba5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -812,6 +812,7 @@ struct amdgpu_device {
>         uint8_t                         *bios;
>         uint32_t                        bios_size;
>         struct amdgpu_bo                *stolen_vga_memory;
> +       struct amdgpu_bo                *discovery_memory;
>         uint32_t                        bios_scratch_reg_offset;
>         uint32_t                        bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index edffc883549a..c3d7eb685a23 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1955,6 +1955,18 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>                                     NULL, &stolen_vga_buf);
>         if (r)
>                 return r;
> +
> +       /*
> +        * reserve one TMR (64K) memory at the top of VRAM which holds
> +        * IP Discovery data and is protected by PSP.
> +        */
> +       r = amdgpu_bo_create_kernel(adev, 64 << 10, PAGE_SIZE,
> +                                   AMDGPU_GEM_DOMAIN_VRAM,
> +                                   &adev->discovery_memory,
> +                                   NULL, NULL);
> +       if (r)
> +               return r;
> +

I think we should use amdgpu_bo_create_kernel_at() for both this and
stolen_vga_memory so that we make sure we end up reserving the right
location since both of these buffers are created by firmware at fixed
locations.

Alex

>         DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
>                  (unsigned) (adev->gmc.real_vram_size / (1024 * 1024)));
>
> @@ -2024,6 +2036,9 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)
>         void *stolen_vga_buf;
>         /* return the VGA stolen memory (if any) back to VRAM */
>         amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
> +
> +       /* return the IP Discovery TMR memory back to VRAM */
> +       amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
>  }
>
>  /**
> --
> 2.20.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