Treat the last page in a non-contiguous range as part of the following
contiguous range.

Signed-off-by: Felix Kuehling <felix.kuehl...@amd.com>
Reviewed-by: Philip Yang <philip.y...@amd.com>
Reviewed-and-tested-by: Rajneesh Bhardwaj <rajneesh.bhard...@amd.com>
Reviewed-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index dc379dc22c77..759e1fab6e28 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -866,6 +866,8 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, 
struct amdgpu_vm *vm,
                                            pages_addr[idx - 1] + PAGE_SIZE))
                                                break;
                                }
+                               if (!contiguous)
+                                       count--;
                                num_entries = count *
                                        AMDGPU_GPU_PAGES_IN_CPU_PAGE;
                        }
-- 
2.34.1

Reply via email to