2018-05-07 06:16:20 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0 OR MIT
|
2015-04-21 03:55:21 +07:00
|
|
|
/*
|
|
|
|
* Copyright 2009 VMware, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Michel Dänzer
|
|
|
|
*/
|
|
|
|
#include <drm/drmP.h>
|
|
|
|
#include <drm/amdgpu_drm.h>
|
|
|
|
#include "amdgpu.h"
|
|
|
|
#include "amdgpu_uvd.h"
|
|
|
|
#include "amdgpu_vce.h"
|
|
|
|
|
|
|
|
/* Test BO GTT->VRAM and VRAM->GTT GPU copies across the whole GTT aperture */
|
|
|
|
static void amdgpu_do_test_moves(struct amdgpu_device *adev)
|
|
|
|
{
|
|
|
|
struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
|
|
|
|
struct amdgpu_bo *vram_obj = NULL;
|
|
|
|
struct amdgpu_bo **gtt_obj = NULL;
|
2018-04-16 17:27:50 +07:00
|
|
|
struct amdgpu_bo_param bp;
|
2017-07-07 16:56:59 +07:00
|
|
|
uint64_t gart_addr, vram_addr;
|
2015-04-21 03:55:21 +07:00
|
|
|
unsigned n, size;
|
|
|
|
int i, r;
|
|
|
|
|
|
|
|
size = 1024 * 1024;
|
|
|
|
|
|
|
|
/* Number of tests =
|
|
|
|
* (Total GTT - IB pool - writeback page - ring buffers) / test size
|
|
|
|
*/
|
2018-01-12 20:52:22 +07:00
|
|
|
n = adev->gmc.gart_size - AMDGPU_IB_POOL_SIZE*64*1024;
|
2015-04-21 03:55:21 +07:00
|
|
|
for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
|
|
|
|
if (adev->rings[i])
|
|
|
|
n -= adev->rings[i]->ring_size;
|
|
|
|
if (adev->wb.wb_obj)
|
|
|
|
n -= AMDGPU_GPU_PAGE_SIZE;
|
|
|
|
if (adev->irq.ih.ring_obj)
|
|
|
|
n -= adev->irq.ih.ring_size;
|
|
|
|
n /= size;
|
|
|
|
|
treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:
kzalloc(a * b, gfp)
with:
kcalloc(a * b, gfp)
as well as handling cases of:
kzalloc(a * b * c, gfp)
with:
kzalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kzalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kzalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 04:03:40 +07:00
|
|
|
gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (!gtt_obj) {
|
|
|
|
DRM_ERROR("Failed to allocate %d pointers\n", n);
|
|
|
|
r = 1;
|
|
|
|
goto out_cleanup;
|
|
|
|
}
|
2018-04-16 17:27:50 +07:00
|
|
|
memset(&bp, 0, sizeof(bp));
|
|
|
|
bp.size = size;
|
|
|
|
bp.byte_align = PAGE_SIZE;
|
|
|
|
bp.domain = AMDGPU_GEM_DOMAIN_VRAM;
|
|
|
|
bp.flags = 0;
|
|
|
|
bp.type = ttm_bo_type_kernel;
|
|
|
|
bp.resv = NULL;
|
2015-04-21 03:55:21 +07:00
|
|
|
|
2018-04-16 17:27:50 +07:00
|
|
|
r = amdgpu_bo_create(adev, &bp, &vram_obj);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to create VRAM object\n");
|
|
|
|
goto out_cleanup;
|
|
|
|
}
|
|
|
|
r = amdgpu_bo_reserve(vram_obj, false);
|
|
|
|
if (unlikely(r != 0))
|
|
|
|
goto out_unref;
|
2018-06-25 11:51:14 +07:00
|
|
|
r = amdgpu_bo_pin(vram_obj, AMDGPU_GEM_DOMAIN_VRAM);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to pin VRAM object\n");
|
|
|
|
goto out_unres;
|
|
|
|
}
|
2018-06-25 11:51:14 +07:00
|
|
|
vram_addr = amdgpu_bo_gpu_offset(vram_obj);
|
2015-04-21 03:55:21 +07:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
void *gtt_map, *vram_map;
|
2017-07-07 16:56:59 +07:00
|
|
|
void **gart_start, **gart_end;
|
2015-04-21 03:55:21 +07:00
|
|
|
void **vram_start, **vram_end;
|
2016-10-25 19:00:45 +07:00
|
|
|
struct dma_fence *fence = NULL;
|
2015-04-21 03:55:21 +07:00
|
|
|
|
2018-04-16 17:27:50 +07:00
|
|
|
bp.domain = AMDGPU_GEM_DOMAIN_GTT;
|
|
|
|
r = amdgpu_bo_create(adev, &bp, gtt_obj + i);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to create GTT object %d\n", i);
|
|
|
|
goto out_lclean;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = amdgpu_bo_reserve(gtt_obj[i], false);
|
|
|
|
if (unlikely(r != 0))
|
|
|
|
goto out_lclean_unref;
|
2018-06-25 11:51:14 +07:00
|
|
|
r = amdgpu_bo_pin(gtt_obj[i], AMDGPU_GEM_DOMAIN_GTT);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to pin GTT object %d\n", i);
|
|
|
|
goto out_lclean_unres;
|
|
|
|
}
|
2018-06-25 12:32:24 +07:00
|
|
|
r = amdgpu_ttm_alloc_gart(>t_obj[i]->tbo);
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("%p bind failed\n", gtt_obj[i]);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
2018-06-25 11:51:14 +07:00
|
|
|
gart_addr = amdgpu_bo_gpu_offset(gtt_obj[i]);
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
r = amdgpu_bo_kmap(gtt_obj[i], >t_map);
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to map GTT object %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2017-07-07 16:56:59 +07:00
|
|
|
for (gart_start = gtt_map, gart_end = gtt_map + size;
|
|
|
|
gart_start < gart_end;
|
|
|
|
gart_start++)
|
|
|
|
*gart_start = gart_start;
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
amdgpu_bo_kunmap(gtt_obj[i]);
|
|
|
|
|
2017-07-07 16:56:59 +07:00
|
|
|
r = amdgpu_copy_buffer(ring, gart_addr, vram_addr,
|
2017-06-29 16:46:15 +07:00
|
|
|
size, NULL, &fence, false, false);
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2016-10-25 19:00:45 +07:00
|
|
|
r = dma_fence_wait(fence, false);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to wait for GTT->VRAM fence %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2016-10-25 19:00:45 +07:00
|
|
|
dma_fence_put(fence);
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
r = amdgpu_bo_kmap(vram_obj, &vram_map);
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to map VRAM object after copy %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2017-07-07 16:56:59 +07:00
|
|
|
for (gart_start = gtt_map, gart_end = gtt_map + size,
|
2015-04-21 03:55:21 +07:00
|
|
|
vram_start = vram_map, vram_end = vram_map + size;
|
|
|
|
vram_start < vram_end;
|
2017-07-07 16:56:59 +07:00
|
|
|
gart_start++, vram_start++) {
|
|
|
|
if (*vram_start != gart_start) {
|
2015-04-21 03:55:21 +07:00
|
|
|
DRM_ERROR("Incorrect GTT->VRAM copy %d: Got 0x%p, "
|
|
|
|
"expected 0x%p (GTT/VRAM offset "
|
|
|
|
"0x%16llx/0x%16llx)\n",
|
2017-07-07 16:56:59 +07:00
|
|
|
i, *vram_start, gart_start,
|
2015-04-21 03:55:21 +07:00
|
|
|
(unsigned long long)
|
2018-01-12 20:52:22 +07:00
|
|
|
(gart_addr - adev->gmc.gart_start +
|
2017-07-07 16:56:59 +07:00
|
|
|
(void*)gart_start - gtt_map),
|
2015-04-21 03:55:21 +07:00
|
|
|
(unsigned long long)
|
2018-01-12 20:52:22 +07:00
|
|
|
(vram_addr - adev->gmc.vram_start +
|
2017-07-07 16:56:59 +07:00
|
|
|
(void*)gart_start - gtt_map));
|
2015-04-21 03:55:21 +07:00
|
|
|
amdgpu_bo_kunmap(vram_obj);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
*vram_start = vram_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
amdgpu_bo_kunmap(vram_obj);
|
|
|
|
|
2017-07-07 16:56:59 +07:00
|
|
|
r = amdgpu_copy_buffer(ring, vram_addr, gart_addr,
|
2017-06-29 16:46:15 +07:00
|
|
|
size, NULL, &fence, false, false);
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2016-10-25 19:00:45 +07:00
|
|
|
r = dma_fence_wait(fence, false);
|
2015-04-21 03:55:21 +07:00
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to wait for VRAM->GTT fence %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2016-10-25 19:00:45 +07:00
|
|
|
dma_fence_put(fence);
|
2015-04-21 03:55:21 +07:00
|
|
|
|
|
|
|
r = amdgpu_bo_kmap(gtt_obj[i], >t_map);
|
|
|
|
if (r) {
|
|
|
|
DRM_ERROR("Failed to map GTT object after copy %d\n", i);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
|
2017-07-07 16:56:59 +07:00
|
|
|
for (gart_start = gtt_map, gart_end = gtt_map + size,
|
2015-04-21 03:55:21 +07:00
|
|
|
vram_start = vram_map, vram_end = vram_map + size;
|
2017-07-07 16:56:59 +07:00
|
|
|
gart_start < gart_end;
|
|
|
|
gart_start++, vram_start++) {
|
|
|
|
if (*gart_start != vram_start) {
|
2015-04-21 03:55:21 +07:00
|
|
|
DRM_ERROR("Incorrect VRAM->GTT copy %d: Got 0x%p, "
|
|
|
|
"expected 0x%p (VRAM/GTT offset "
|
|
|
|
"0x%16llx/0x%16llx)\n",
|
2017-07-07 16:56:59 +07:00
|
|
|
i, *gart_start, vram_start,
|
2015-04-21 03:55:21 +07:00
|
|
|
(unsigned long long)
|
2018-01-12 20:52:22 +07:00
|
|
|
(vram_addr - adev->gmc.vram_start +
|
2015-04-21 03:55:21 +07:00
|
|
|
(void*)vram_start - vram_map),
|
|
|
|
(unsigned long long)
|
2018-01-12 20:52:22 +07:00
|
|
|
(gart_addr - adev->gmc.gart_start +
|
2015-04-21 03:55:21 +07:00
|
|
|
(void*)vram_start - vram_map));
|
|
|
|
amdgpu_bo_kunmap(gtt_obj[i]);
|
|
|
|
goto out_lclean_unpin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
amdgpu_bo_kunmap(gtt_obj[i]);
|
|
|
|
|
|
|
|
DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
|
2018-01-12 20:52:22 +07:00
|
|
|
gart_addr - adev->gmc.gart_start);
|
2015-04-21 03:55:21 +07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
out_lclean_unpin:
|
|
|
|
amdgpu_bo_unpin(gtt_obj[i]);
|
|
|
|
out_lclean_unres:
|
|
|
|
amdgpu_bo_unreserve(gtt_obj[i]);
|
|
|
|
out_lclean_unref:
|
|
|
|
amdgpu_bo_unref(>t_obj[i]);
|
|
|
|
out_lclean:
|
|
|
|
for (--i; i >= 0; --i) {
|
|
|
|
amdgpu_bo_unpin(gtt_obj[i]);
|
|
|
|
amdgpu_bo_unreserve(gtt_obj[i]);
|
|
|
|
amdgpu_bo_unref(>t_obj[i]);
|
|
|
|
}
|
|
|
|
if (fence)
|
2016-10-25 19:00:45 +07:00
|
|
|
dma_fence_put(fence);
|
2015-04-21 03:55:21 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
amdgpu_bo_unpin(vram_obj);
|
|
|
|
out_unres:
|
|
|
|
amdgpu_bo_unreserve(vram_obj);
|
|
|
|
out_unref:
|
|
|
|
amdgpu_bo_unref(&vram_obj);
|
|
|
|
out_cleanup:
|
|
|
|
kfree(gtt_obj);
|
|
|
|
if (r) {
|
2017-02-28 19:55:52 +07:00
|
|
|
pr_warn("Error while testing BO move\n");
|
2015-04-21 03:55:21 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void amdgpu_test_moves(struct amdgpu_device *adev)
|
|
|
|
{
|
|
|
|
if (adev->mman.buffer_funcs)
|
|
|
|
amdgpu_do_test_moves(adev);
|
|
|
|
}
|