<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Reviewed-by: Christian König
      <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>.<br>
      <br>
      Am 22.10.2016 um 10:20 schrieb Edward O'Callaghan:<br>
    </div>
    <blockquote
      cite="mid:0851af1f-0e53-b0aa-10a7-432f6fad68dd@folklore1984.net"
      type="cite">
      <pre wrap="">Acked-by: Edward O'Callaghan <a class="moz-txt-link-rfc2396E" href="mailto:funfunctor@folklore1984.net"><funfunctor@folklore1984.net></a>

On 10/22/2016 06:31 AM, Alex Deucher wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Rather than open coding it.

Signed-off-by: Alex Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 37 ++++++------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b7b6542..314295f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -443,13 +443,9 @@ void amdgpu_doorbell_get_kfd_info(struct amdgpu_device *adev,
 static void amdgpu_wb_fini(struct amdgpu_device *adev)
 {
        if (adev->wb.wb_obj) {
-               if (!amdgpu_bo_reserve(adev->wb.wb_obj, false)) {
-                       amdgpu_bo_kunmap(adev->wb.wb_obj);
-                       amdgpu_bo_unpin(adev->wb.wb_obj);
-                       amdgpu_bo_unreserve(adev->wb.wb_obj);
-               }
-               amdgpu_bo_unref(&adev->wb.wb_obj);
-               adev->wb.wb = NULL;
+               amdgpu_bo_free_kernel(&adev->wb.wb_obj,
+                                     &adev->wb.gpu_addr,
+                                     (void **)&adev->wb.wb);
                adev->wb.wb_obj = NULL;
        }
 }
@@ -468,33 +464,14 @@ static int amdgpu_wb_init(struct amdgpu_device *adev)
        int r;
 
        if (adev->wb.wb_obj == NULL) {
-               r = amdgpu_bo_create(adev, AMDGPU_MAX_WB * 4, PAGE_SIZE, true,
-                                    AMDGPU_GEM_DOMAIN_GTT, 0,  NULL, NULL,
-                                    &adev->wb.wb_obj);
+               r = amdgpu_bo_create_kernel(adev, AMDGPU_MAX_WB * 4,
+                                           PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
+                                           &adev->wb.wb_obj, &adev->wb.gpu_addr,
+                                           (void **)&adev->wb.wb);
                if (r) {
                        dev_warn(adev->dev, "(%d) create WB bo failed\n", r);
                        return r;
                }
-               r = amdgpu_bo_reserve(adev->wb.wb_obj, false);
-               if (unlikely(r != 0)) {
-                       amdgpu_wb_fini(adev);
-                       return r;
-               }
-               r = amdgpu_bo_pin(adev->wb.wb_obj, AMDGPU_GEM_DOMAIN_GTT,
-                               &adev->wb.gpu_addr);
-               if (r) {
-                       amdgpu_bo_unreserve(adev->wb.wb_obj);
-                       dev_warn(adev->dev, "(%d) pin WB bo failed\n", r);
-                       amdgpu_wb_fini(adev);
-                       return r;
-               }
-               r = amdgpu_bo_kmap(adev->wb.wb_obj, (void **)&adev->wb.wb);
-               amdgpu_bo_unreserve(adev->wb.wb_obj);
-               if (r) {
-                       dev_warn(adev->dev, "(%d) map WB bo failed\n", r);
-                       amdgpu_wb_fini(adev);
-                       return r;
-               }
 
                adev->wb.num_wb = AMDGPU_MAX_WB;
                memset(&adev->wb.used, 0, sizeof(adev->wb.used));

</pre>
      </blockquote>
      <pre wrap="">
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>
    <p><br>
    </p>
  </body>
</html>