static bool amdgpu_mem_visible(struct amdgpu_device *adev,
                               struct ttm_resource *mem)
 {
-       uint64_t mem_size = (u64)mem->num_pages << PAGE_SHIFT;
+       u64 mem_size = (u64)mem->num_pages << PAGE_SHIFT;
        struct amdgpu_res_cursor cursor;
+       u64 end;
 
        if (mem->mem_type == TTM_PL_SYSTEM ||
            mem->mem_type == TTM_PL_TT)
                return false;
 
        amdgpu_res_first(mem, 0, mem_size, &cursor);
+       end = cursor.start + cursor.size;
+       while (cursor.remaining) {
+               amdgpu_res_next(&cursor, cursor.size);
 
-       /* ttm_resource_ioremap only supports contiguous memory */
-       if (cursor.size != mem_size)
-               return false;
+               /* ttm_resource_ioremap only supports contiguous memory */
+               if (end != cursor.start)
+                       return false;
+
+               end = cursor.start + cursor.size;
+       }
 
-       return cursor.start + cursor.size <= adev->gmc.visible_vram_size;
+       return end <= adev->gmc.visible_vram_size;
 }
 
 /*