<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Thanks Alex. I'll try to use the new api and send v2 patch.<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
BR,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Xiaojie<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Thursday, October 10, 2019 8:57 PM<br>
<b>To:</b> Yuan, Xiaojie <Xiaojie.Yuan@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu/discovery: reserve discovery data at the top of VRAM</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Thu, Oct 10, 2019 at 8:48 AM Yuan, Xiaojie <Xiaojie.Yuan@amd.com> wrote:<br>
><br>
> IP Discovery data is TMR fenced by the latest PSP BL,<br>
> so we need to reserve this region.<br>
><br>
> Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 +<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 15 +++++++++++++++<br>
>  2 files changed, 16 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> index be0b2c69c223..6775647f0ba5 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> @@ -812,6 +812,7 @@ struct amdgpu_device {<br>
>         uint8_t                         *bios;<br>
>         uint32_t                        bios_size;<br>
>         struct amdgpu_bo                *stolen_vga_memory;<br>
> +       struct amdgpu_bo                *discovery_memory;<br>
>         uint32_t                        bios_scratch_reg_offset;<br>
>         uint32_t                        bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
> index edffc883549a..c3d7eb685a23 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c<br>
> @@ -1955,6 +1955,18 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)<br>
>                                     NULL, &stolen_vga_buf);<br>
>         if (r)<br>
>                 return r;<br>
> +<br>
> +       /*<br>
> +        * reserve one TMR (64K) memory at the top of VRAM which holds<br>
> +        * IP Discovery data and is protected by PSP.<br>
> +        */<br>
> +       r = amdgpu_bo_create_kernel(adev, 64 << 10, PAGE_SIZE,<br>
> +                                   AMDGPU_GEM_DOMAIN_VRAM,<br>
> +                                   &adev->discovery_memory,<br>
> +                                   NULL, NULL);<br>
> +       if (r)<br>
> +               return r;<br>
> +<br>
<br>
I think we should use amdgpu_bo_create_kernel_at() for both this and<br>
stolen_vga_memory so that we make sure we end up reserving the right<br>
location since both of these buffers are created by firmware at fixed<br>
locations.<br>
<br>
Alex<br>
<br>
>         DRM_INFO("amdgpu: %uM of VRAM memory ready\n",<br>
>                  (unsigned) (adev->gmc.real_vram_size / (1024 * 1024)));<br>
><br>
> @@ -2024,6 +2036,9 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)<br>
>         void *stolen_vga_buf;<br>
>         /* return the VGA stolen memory (if any) back to VRAM */<br>
>         amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);<br>
> +<br>
> +       /* return the IP Discovery TMR memory back to VRAM */<br>
> +       amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);<br>
>  }<br>
><br>
>  /**<br>
> --<br>
> 2.20.1<br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>