<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);">
Thanks very much 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 scanned the whole code, only two functions pass in NULL cpu_addr,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
amdgpu_ttm_init() and gfx_v9_0_ngg_create_buf(),</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
but the related BOs are not further mapped for cpu access.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
so I think this change is safe.</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);">
<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> Monday, August 19, 2019 16:07<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> Xiao, Jack <Jack.Xiao@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu/psp: move TMR to cpu invisible vram region</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 19.08.19 um 10:05 schrieb Tianci Yin:<br>
> From: "Tianci.Yin" <tianci.yin@amd.com><br>
><br>
> so that more visible vram can be available for umd.<br>
><br>
> Signed-off-by: Tianci.Yin <tianci.yin@amd.com><br>
<br>
Assuming that you checked that we don't have other users who are using <br>
amdgpu_bo_create_kernel() without a CPU pointer this patch is <br>
Reviewed-by: Christian König <christian.koenig@amd.com>.<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++--<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++--<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 1 -<br>
> 3 files changed, 5 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> index 1059771..0476790 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> @@ -246,8 +246,9 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,<br>
> bp.size = size;<br>
> bp.byte_align = align;<br>
> bp.domain = domain;<br>
> - bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |<br>
> - AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;<br>
> + bp.flags = cpu_addr ? AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED<br>
> + : AMDGPU_GEM_CREATE_NO_CPU_ACCESS;<br>
> + bp.flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;<br>
> bp.type = ttm_bo_type_kernel;<br>
> bp.resv = NULL;<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> index 7715c0d..5e7fbbe 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> @@ -264,7 +264,7 @@ static int psp_tmr_init(struct psp_context *psp)<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, &psp->tmr_buf);<br>
> + &psp->tmr_bo, &psp->tmr_mc_addr, NULL);<br>
> <br>
> return ret;<br>
> }<br>
> @@ -1215,7 +1215,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, &psp->tmr_buf);<br>
> + amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, NULL);<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 0029fa2..48b057d 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h<br>
> @@ -172,7 +172,6 @@ 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>