]> Git Repo - linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
Merge tag 'drm-intel-next-fixes-2020-10-22' of git://anongit.freedesktop.org/drm...
[linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_vm.c
index 771c27478bb1256482f566a64c30cb5bd63e6a35..2b65e83c808b17d9d4e2b0ca6da966fa5cbc154f 100644 (file)
@@ -1502,6 +1502,8 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
 
                        pt = cursor.entry->base.bo;
                        shift = parent_shift;
+                       frag_end = max(frag_end, ALIGN(frag_start + 1,
+                                  1ULL << shift));
                }
 
                /* Looks good so far, calculate parameters for the update */
@@ -1513,19 +1515,26 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
                entry_end = min(entry_end, end);
 
                do {
+                       struct amdgpu_vm *vm = params->vm;
                        uint64_t upd_end = min(entry_end, frag_end);
                        unsigned nptes = (upd_end - frag_start) >> shift;
+                       uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag);
 
                        /* This can happen when we set higher level PDs to
                         * silent to stop fault floods.
                         */
                        nptes = max(nptes, 1u);
+
+                       trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
+                                                   nptes, dst, incr, upd_flags,
+                                                   vm->task_info.pid,
+                                                   vm->immediate.fence_context);
                        amdgpu_vm_update_flags(params, pt, cursor.level,
                                               pe_start, dst, nptes, incr,
-                                              flags | AMDGPU_PTE_FRAG(frag));
+                                              upd_flags);
 
                        pe_start += nptes * 8;
-                       dst += (uint64_t)nptes * AMDGPU_GPU_PAGE_SIZE << shift;
+                       dst += nptes * incr;
 
                        frag_start = upd_end;
                        if (frag_start >= frag_end) {
@@ -1693,13 +1702,13 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
                uint64_t max_entries;
                uint64_t addr, last;
 
+               max_entries = mapping->last - start + 1;
                if (nodes) {
                        addr = nodes->start << PAGE_SHIFT;
-                       max_entries = (nodes->size - pfn) *
-                               AMDGPU_GPU_PAGES_IN_CPU_PAGE;
+                       max_entries = min((nodes->size - pfn) *
+                               AMDGPU_GPU_PAGES_IN_CPU_PAGE, max_entries);
                } else {
                        addr = 0;
-                       max_entries = S64_MAX;
                }
 
                if (pages_addr) {
@@ -1729,7 +1738,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
                        addr += pfn << PAGE_SHIFT;
                }
 
-               last = min((uint64_t)mapping->last, start + max_entries - 1);
+               last = start + max_entries - 1;
                r = amdgpu_vm_bo_update_mapping(adev, vm, false, false, resv,
                                                start, last, flags, addr,
                                                dma_addr, fence);
@@ -1767,7 +1776,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
        struct amdgpu_vm *vm = bo_va->base.vm;
        struct amdgpu_bo_va_mapping *mapping;
        dma_addr_t *pages_addr = NULL;
-       struct ttm_mem_reg *mem;
+       struct ttm_resource *mem;
        struct drm_mm_node *nodes;
        struct dma_fence **last_update;
        struct dma_resv *resv;
@@ -3222,7 +3231,7 @@ void amdgpu_vm_manager_fini(struct amdgpu_device *adev)
 int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 {
        union drm_amdgpu_vm *args = data;
-       struct amdgpu_device *adev = dev->dev_private;
+       struct amdgpu_device *adev = drm_to_adev(dev);
        struct amdgpu_fpriv *fpriv = filp->driver_priv;
        long timeout = msecs_to_jiffies(2000);
        int r;
This page took 0.036614 seconds and 4 git commands to generate.