<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 id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Got it .</p>
<p style="margin-top:0;margin-bottom:0">Thanks.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Christian König <ckoenig.leichtzumerken@gmail.com><br>
<b>Sent:</b> Monday, November 12, 2018 6:42 PM<br>
<b>To:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Fix CSA buffer alloc failed on Vega</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 12.11.18 um 11:33 schrieb Rex Zhu:<br>
> Alloc_pte failed when the VA address located in<br>
> the higher arrange of 256T.<br>
><br>
> so reserve the csa buffer under 128T as a work around.<br>
><br>
> [ 122.979425] amdgpu 0000:03:00.0: va above limit (0xFFFFFFFFFFF1F >= 0x1000000000)<br>
> [ 122.987080] BUG: unable to handle kernel paging request at ffff880e1a79fff8<br>
><br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
<br>
Well NAK, userspace wants to use the full address space below 128T for SVM.<br>
<br>
The problem is rather that you incorrectly use amdgpu_csa_vaddr(). See <br>
the code in amdgpu_driver_open_kms() how to do it correctly:<br>
<br>
> uint64_t csa_addr = amdgpu_csa_vaddr(adev) & <br>
> AMDGPU_GMC_HOLE_MASK;<br>
><br>
> r = amdgpu_map_static_csa(adev, &fpriv->vm, <br>
> adev->virt.csa_obj,<br>
> &fpriv->csa_va, csa_addr, AMDGPU_CSA_SIZE);<br>
> if (r)<br>
> goto error_vm;<br>
<br>
Christian.<br>
<br>
<br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++--<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-<br>
> 2 files changed, 3 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<br>
> index fea4555..e2f325b 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<br>
> @@ -36,9 +36,9 @@ uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev, uint32_t id)<br>
> {<br>
> uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;<br>
> <br>
> - addr -= AMDGPU_VA_RESERVED_SIZE * id;<br>
> + addr = min(addr, AMDGPU_GMC_HOLE_START);<br>
> <br>
> - addr = amdgpu_gmc_sign_extend(addr);<br>
> + addr -= (uint64_t)AMDGPU_VA_RESERVED_SIZE * id;<br>
> <br>
> return addr;<br>
> }<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> index 338a091..ea6a12a 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
> @@ -711,7 +711,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file<br>
> <br>
> dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;<br>
> dev_info.virtual_address_max =<br>
> - min(vm_size, AMDGPU_GMC_HOLE_START);<br>
> + min(vm_size, AMDGPU_GMC_HOLE_START - adev->vm_manager.reserved_vm_size);<br>
> <br>
> if (vm_size > AMDGPU_GMC_HOLE_START) {<br>
> dev_info.high_va_offset = AMDGPU_GMC_HOLE_END;<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>