<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, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Christian,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have just realized the <font size="2"><span style="font-size:11pt"><span>stolen_vga_memory</span></span></font> problem,
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have ever thought that no one really use the <font size="2"><span style="font-size:11pt"><span>stolen_vga_memory BO in KMD code, so it should be safe.</span></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<font size="2"><span style="font-size:11pt"><span><br>
</span></span></font></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<font size="2"><span style="font-size:11pt"><span>It seems we have to add a new parameter for amdgpu_bo_create_kernel</span></span></font>() to pass the prefer region.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Rico<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> Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Wednesday, August 28, 2019 17:57<br>
<b>To:</b> Yin, Tianci (Rico) <Tianci.Yin@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Xu, Feifei <Feifei.Xu@amd.com>; Ma, Le <Le.Ma@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu/psp: keep TMR in visible vram region for SRIOV</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 28.08.19 um 11:25 schrieb Tianci Yin:<br>
> From: "Tianci.Yin" <tianci.yin@amd.com><br>
><br>
> Fix compute ring test failure in sriov scenario.<br>
><br>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com><br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 14 ++++++++++----<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  1 +<br>
>   2 files changed, 11 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> index 9f7cc5b..92c68c9 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> @@ -261,9 +261,15 @@ static int psp_tmr_init(struct psp_context *psp)<br>
>                }<br>
>        }<br>
>   <br>
> -     ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,<br>
> -                                   AMDGPU_GEM_DOMAIN_VRAM,<br>
> -                                   &psp->tmr_bo, &psp->tmr_mc_addr, NULL);<br>
> +     psp->tmr_buf = NULL;<br>
> +     if (!amdgpu_sriov_vf(psp->adev))<br>
> +             ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,<br>
> +                                           AMDGPU_GEM_DOMAIN_VRAM,<br>
> +                                           &psp->tmr_bo, &psp->tmr_mc_addr, NULL);<br>
> +     else<br>
> +             ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE,<br>
> +                                           AMDGPU_GEM_DOMAIN_VRAM,<br>
> +                                           &psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);<br>
<br>
Might be better to use a local variable for the CPU pointer instead of <br>
duplicating the calling parameters.<br>
<br>
BTW: How did you solved the stolen_vga_memory problem I pointed out in <br>
the original patch set?<br>
<br>
Christian.<br>
<br>
>   <br>
>        return ret;<br>
>   }<br>
> @@ -1216,7 +1222,7 @@ static int psp_hw_fini(void *handle)<br>
>   <br>
>        psp_ring_destroy(psp, PSP_RING_TYPE__KM);<br>
>   <br>
> -     amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);<br>
> +     amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);<br>
>        amdgpu_bo_free_kernel(&psp->fw_pri_bo,<br>
>                              &psp->fw_pri_mc_addr, &psp->fw_pri_buf);<br>
>        amdgpu_bo_free_kernel(&psp->fence_buf_bo,<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
> index bc0947f..b73d4aa 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
> @@ -171,6 +171,7 @@ struct psp_context<br>
>        /* tmr buffer */<br>
>        struct amdgpu_bo                *tmr_bo;<br>
>        uint64_t                        tmr_mc_addr;<br>
> +     void                            *tmr_buf;<br>
>   <br>
>        /* asd firmware and buffer */<br>
>        const struct firmware           *asd_fw;<br>
<br>
</div>
</span></font></div>
</body>
</html>