<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi guys,<br>
      <br>
      yeah the root PD doesn't necessarily have a power of two entries.<br>
      <br>
      But what exactly was the problem with the original code? Why does
      0xffffffff doesn't work?<br>
      <br>
      The only possible explanation I can see is that somebody tried to
      use an address which is above max_pfn, or how did that trigger?<br>
      <br>
      Thanks,<br>
      Christian.<br>
      <br>
      Am 23.10.18 um 07:42 schrieb Zhu, Rex:<br>
    </div>
    <blockquote type="cite"
cite="mid:BYAPR12MB2775C0F7BCA52B2969C9D16EFBF50@BYAPR12MB2775.namprd12.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <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>
        <div>commit 72af632549b97ead9251bb155f08fefd1fb6f5c3<br>
          Author: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><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 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"
              face="Calibri, sans-serif" color="#000000"><b>From:</b>
              amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> on
              behalf of Zhang, Jerry(Junwei) <a class="moz-txt-link-rfc2396E" href="mailto:Jerry.Zhang@amd.com"><Jerry.Zhang@amd.com></a><br>
              <b>Sent:</b> Tuesday, October 23, 2018 1:12 PM<br>
              <b>To:</b> Zhu, Rex; <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>;
              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 <a class="moz-txt-link-rfc2396E" href="mailto:Rex.Zhu@amd.com"><Rex.Zhu@amd.com></a><br>
                  <br>
                  Thanks to verify that.<br>
                  Feel free to add<br>
                  Reviewed-by: Junwei Zhang <a class="moz-txt-link-rfc2396E" href="mailto:Jerry.Zhang@amd.com"><Jerry.Zhang@amd.com></a><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>
                  <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
                  <a
                    href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
                    id="LPlnk206689" class="OWAAutoLink"
                    previewremoved="true" moz-do-not-send="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="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" moz-do-not-send="true">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
                              <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>. 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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>