]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/amdgpu: add vm_needs_flush parameter to amdgpu_copy_buffer
authorChristian König <christian.koenig@amd.com>
Thu, 29 Jun 2017 09:46:15 +0000 (11:46 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:05:57 +0000 (11:05 -0400)
This allows us to flush the system VM here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h

index 1beae5b930d0e10d407501708a0585e56001181e..2fb299afc12b7e9a51c853b5ff1b048172856e4d 100644 (file)
@@ -40,7 +40,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
        for (i = 0; i < n; i++) {
                struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
                r = amdgpu_copy_buffer(ring, saddr, daddr, size, NULL, &fence,
-                                      false);
+                                      false, false);
                if (r)
                        goto exit_do_move;
                r = dma_fence_wait(fence, false);
index 8ee69652be8ceea145129cefb46ab46920744a74..c34cf2c1ae4e113fd28b725d1a33f26fe6e771b2 100644 (file)
@@ -535,7 +535,7 @@ int amdgpu_bo_backup_to_shadow(struct amdgpu_device *adev,
 
        r = amdgpu_copy_buffer(ring, bo_addr, shadow_addr,
                               amdgpu_bo_size(bo), resv, fence,
-                              direct);
+                              direct, false);
        if (!r)
                amdgpu_bo_fence(bo, *fence, true);
 
@@ -588,7 +588,7 @@ int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,
 
        r = amdgpu_copy_buffer(ring, shadow_addr, bo_addr,
                               amdgpu_bo_size(bo), resv, fence,
-                              direct);
+                              direct, false);
        if (!r)
                amdgpu_bo_fence(bo, *fence, true);
 
index 15510dadde018d87d455b371af32e8d349c3a6e1..d02e611a2dae1102baa34741cd58124c50f1d81f 100644 (file)
@@ -111,7 +111,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
                amdgpu_bo_kunmap(gtt_obj[i]);
 
                r = amdgpu_copy_buffer(ring, gtt_addr, vram_addr,
-                                      size, NULL, &fence, false);
+                                      size, NULL, &fence, false, false);
 
                if (r) {
                        DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
@@ -156,7 +156,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
                amdgpu_bo_kunmap(vram_obj);
 
                r = amdgpu_copy_buffer(ring, vram_addr, gtt_addr,
-                                      size, NULL, &fence, false);
+                                      size, NULL, &fence, false, false);
 
                if (r) {
                        DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
index c9b131b13ef74de91a85afa562d2b2446c59a1bd..8c5f75d29f32e1e136506c66a06c5ed56302b8ec 100644 (file)
@@ -318,7 +318,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 
                r = amdgpu_copy_buffer(ring, old_start, new_start,
                                       cur_pages * PAGE_SIZE,
-                                      bo->resv, &next, false);
+                                      bo->resv, &next, false, false);
                if (r)
                        goto error;
 
@@ -1256,12 +1256,11 @@ int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma)
        return ttm_bo_mmap(filp, vma, &adev->mman.bdev);
 }
 
-int amdgpu_copy_buffer(struct amdgpu_ring *ring,
-                      uint64_t src_offset,
-                      uint64_t dst_offset,
-                      uint32_t byte_count,
+int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
+                      uint64_t dst_offset, uint32_t byte_count,
                       struct reservation_object *resv,
-                      struct dma_fence **fence, bool direct_submit)
+                      struct dma_fence **fence, bool direct_submit,
+                      bool vm_needs_flush)
 {
        struct amdgpu_device *adev = ring->adev;
        struct amdgpu_job *job;
@@ -1283,6 +1282,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring,
        if (r)
                return r;
 
+       job->vm_needs_flush = vm_needs_flush;
        if (resv) {
                r = amdgpu_sync_resv(adev, &job->sync, resv,
                                     AMDGPU_FENCE_OWNER_UNDEFINED);
index 6bdede8ff12b4c37f1e679de83f7afd54014cc0b..cd5bbfa2773fc5272af71a292f688a1ed56abd5e 100644 (file)
@@ -61,12 +61,11 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
                         const struct ttm_place *place,
                         struct ttm_mem_reg *mem);
 
-int amdgpu_copy_buffer(struct amdgpu_ring *ring,
-                      uint64_t src_offset,
-                      uint64_t dst_offset,
-                      uint32_t byte_count,
+int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
+                      uint64_t dst_offset, uint32_t byte_count,
                       struct reservation_object *resv,
-                      struct dma_fence **fence, bool direct_submit);
+                      struct dma_fence **fence, bool direct_submit,
+                      bool vm_needs_flush);
 int amdgpu_fill_buffer(struct amdgpu_bo *bo,
                        uint32_t src_data,
                        struct reservation_object *resv,