<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">No, if the vm size is small, there may only on root pd entry.</p>
<p style="margin-top:0;margin-bottom:0">we need to make sure the mask >= 0;</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Maybe this change revert Christian's commit:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>commit 72af632549b97ead9251bb155f08fefd1fb6f5c3<br>
Author: Christian König <christian.koenig@amd.com><br>
Date:   Sat Sep 15 10:02:13 2018 +0200<br>
<br>
    drm/amdgpu: add amdgpu_vm_entries_mask v2<br>
    <br>
    We can't get the mask for the root directory from the number of entries.<br>
    <br>
    So add a new function to avoid that problem.</div>
<p></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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhang, Jerry(Junwei) <Jerry.Zhang@amd.com><br>
<b>Sent:</b> Tuesday, October 23, 2018 1:12 PM<br>
<b>To:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org; Deucher, Alexander; Koenig, Christian<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Fix amdgpu_vm_alloc_pts failed</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 10/23/2018 11:29 AM, Rex Zhu wrote:<br>
> when the VA address located in the last PD entries,<br>
> the alloc_pts will faile.<br>
><br>
> Use the right PD mask instand of hardcode, suggested<br>
> by jerry.zhang.<br>
><br>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
<br>
Thanks to verify that.<br>
Feel free to add<br>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com><br>
<br>
Also like to get to know some background about these two functions from <br>
Christian.<br>
Perhaps we may make it more simple, e.g. merging them together.<br>
<br>
Regards,<br>
Jerry<br>
<br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 ++++-<br>
>   1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> index 054633b..3939013 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
> @@ -202,8 +202,11 @@ static unsigned amdgpu_vm_num_entries(struct amdgpu_device *adev,<br>
>   static uint32_t amdgpu_vm_entries_mask(struct amdgpu_device *adev,<br>
>                                       unsigned int level)<br>
>   {<br>
> +     unsigned shift = amdgpu_vm_level_shift(adev,<br>
> +                                            adev->vm_manager.root_level);<br>
> +<br>
>        if (level <= adev->vm_manager.root_level)<br>
> -             return 0xffffffff;<br>
> +             return (round_up(adev->vm_manager.max_pfn, 1 << shift) >> shift) - 1;<br>
>        else if (level != AMDGPU_VM_PTB)<br>
>                return 0x1ff;<br>
>        else<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk206689" class="OWAAutoLink" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15402730099220.06989990489403342" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15402730099180.16758172594804666" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" role="presentation" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="TextCell_15402730099180.9196994567727107" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_15402730099180.1670273140970655"></div>
<div id="LPTitle_15402730099180.46519874882455503" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light", "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15402730099200.5625533175983499" style="text-decoration: none;" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15402730099200.935286511114562" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.freedesktop.org</div>
<div id="LPDescription_15402730099200.10363074579177611" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
To see the collection of prior postings to the list, visit the amd-gfx Archives.. Using amd-gfx: To post a message to all the list members, send email to amd-gfx@lists.freedesktop.org. You can subscribe to the list, or change your existing subscription, in
 the sections below.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>