<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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);">
Great! That's good idea!</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!<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> Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Sent:</b> Wednesday, August 28, 2019 18:25<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 style="background-color:#FFFFFF">
<div class="x_moz-cite-prefix">
<blockquote type="cite">
<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>
</blockquote>
<br>
You can also just pass a cpu pointer to the function allocating the stolen_vga_memory.<br>
<br>
That's probably less work to change all callers and cleaner in general.<br>
<br>
Christian.<br>
<br>
Am 28.08.19 um 12:21 schrieb Yin, Tianci (Rico):<br>
</div>
<blockquote type="cite"><style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<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>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Christian König
<a class="x_moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com">
<ckoenig.leichtzumerken@gmail.com></a><br>
<b>Sent:</b> Wednesday, August 28, 2019 17:57<br>
<b>To:</b> Yin, Tianci (Rico) <a class="x_moz-txt-link-rfc2396E" href="mailto:Tianci.Yin@amd.com">
<Tianci.Yin@amd.com></a>; <a class="x_moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">
amd-gfx@lists.freedesktop.org</a> <a class="x_moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org">
<amd-gfx@lists.freedesktop.org></a><br>
<b>Cc:</b> Xu, Feifei <a class="x_moz-txt-link-rfc2396E" href="mailto:Feifei.Xu@amd.com">
<Feifei.Xu@amd.com></a>; Ma, Le <a class="x_moz-txt-link-rfc2396E" href="mailto:Le.Ma@amd.com">
<Le.Ma@amd.com></a>; Xiao, Jack <a class="x_moz-txt-link-rfc2396E" href="mailto:Jack.Xiao@amd.com">
<Jack.Xiao@amd.com></a>; Zhang, Hawking <a class="x_moz-txt-link-rfc2396E" href="mailto:Hawking.Zhang@amd.com">
<Hawking.Zhang@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu/psp: keep TMR in visible vram region for SRIOV</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">Am 28.08.19 um 11:25 schrieb Tianci Yin:<br>
> From: "Tianci.Yin" <a class="x_moz-txt-link-rfc2396E" href="mailto:tianci.yin@amd.com">
<tianci.yin@amd.com></a><br>
><br>
> Fix compute ring test failure in sriov scenario.<br>
><br>
> Signed-off-by: Tianci.Yin <a class="x_moz-txt-link-rfc2396E" href="mailto:tianci.yin@amd.com">
<tianci.yin@amd.com></a><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>
</blockquote>
<br>
</div>
</body>
</html>