<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta 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 dir="auto">That's irrelevant in this case. CPU mapping's are destroyed automatically when the BO is freed.
<div dir="auto"><br>
</div>
<div dir="auto">Giving the CPU pointer to the free function is only for extra checking that we can't access it anymore.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Christian.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 28.08.2019 13:05 schrieb "Yin, Tianci (Rico)" <Tianci.Yin@amd.com>:<br type="attribution">
</div>
</div>
<div>
<blockquote style="border-color:rgb(200,200,200); border-left:3px solid rgb(200,200,200); padding-left:1ex; margin-left:0.8ex; color:rgb(102,102,102)">
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<font size="2"><span style="font-size:11pt">Might be better to use a local variable for the CPU pointer instead of
<br>
</span></font></div>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<font size="2"><span style="font-size:11pt">duplicating the calling parameters.</span></font></div>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<br>
</div>
</blockquote>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
Local variable can't be used in cleaner.<br>
</div>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<br>
</div>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<br>
</div>
<div dir="ltr" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); text-align:left">
<br>
</div>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><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>
</div>
</body>
</html>