On 5/28/2021 3:03 PM, Christian König wrote:


Am 28.05.21 um 14:54 schrieb Nirmoy Das:
Flush gpu tlb in amdgpu_ttm_alloc_gart(). Also
don't flush gpu tlb after recovering each BO.

Signed-off-by: Nirmoy Das <nirmoy....@amd.com>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 2 --
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 5 ++++-
  2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
index 5562b5c90c03..68d41063e120 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
@@ -329,8 +329,6 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
        mb();
      amdgpu_asic_flush_hdp(adev, NULL);

The memory barrier and HDP flush can be moved as well.

-    for (i = 0; i < adev->num_vmhubs; i++)
-        amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
      return 0;
  }
  diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index c0aef327292a..e68b5dab84a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -977,7 +977,7 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)
      struct ttm_placement placement;
      struct ttm_place placements;
      uint64_t addr, flags;
-    int r;
+    int r, i;
        if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET)
          return 0;
@@ -1014,6 +1014,9 @@ int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo)
              return r;
          }
  +        for (i = 0; i < adev->num_vmhubs; i++)
+            amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
+

Probably best to make that a function in amdgpu_gart.c to keep the GART functionality properly abstracted.

This can then be called from both amdgpu_gtt_mgr_recover() after dropping the lock and here.


Thanks, Christian! I will resend.


Nirmoy


Regards,
Christian.

          ttm_resource_free(bo, &bo->mem);
          bo->mem = tmp;
      }

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to