[PATCH] drm/amdgpu/test: convert amdgpu_test.c to use dev_info
Alex Deucher
alexander.deucher at amd.com
Mon Feb 21 22:29:22 UTC 2022
Rather than the old DRM_INFO/ERROR macros. This makes it
easier to differentiate the output when there are multiple
GPUs in a system.
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 69 ++++++++++++------------
1 file changed, 35 insertions(+), 34 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index 909d830b513e..2c212b740a17 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -51,7 +51,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
if (!gtt_obj) {
- DRM_ERROR("Failed to allocate %d pointers\n", n);
+ dev_info(adev->dev, "Failed to allocate %d pointers\n", n);
r = 1;
goto out_cleanup;
}
@@ -66,7 +66,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
r = amdgpu_bo_create(adev, &bp, &vram_obj);
if (r) {
- DRM_ERROR("Failed to create VRAM object\n");
+ dev_info(adev->dev, "Failed to create VRAM object\n");
goto out_cleanup;
}
r = amdgpu_bo_reserve(vram_obj, false);
@@ -74,7 +74,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
goto out_unref;
r = amdgpu_bo_pin(vram_obj, AMDGPU_GEM_DOMAIN_VRAM);
if (r) {
- DRM_ERROR("Failed to pin VRAM object\n");
+ dev_info(adev->dev, "Failed to pin VRAM object\n");
goto out_unres;
}
vram_addr = amdgpu_bo_gpu_offset(vram_obj);
@@ -87,7 +87,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
bp.domain = AMDGPU_GEM_DOMAIN_GTT;
r = amdgpu_bo_create(adev, &bp, gtt_obj + i);
if (r) {
- DRM_ERROR("Failed to create GTT object %d\n", i);
+ dev_info(adev->dev, "Failed to create GTT object %d\n", i);
goto out_lclean;
}
@@ -96,19 +96,19 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
goto out_lclean_unref;
r = amdgpu_bo_pin(gtt_obj[i], AMDGPU_GEM_DOMAIN_GTT);
if (r) {
- DRM_ERROR("Failed to pin GTT object %d\n", i);
+ dev_info(adev->dev, "Failed to pin GTT object %d\n", i);
goto out_lclean_unres;
}
r = amdgpu_ttm_alloc_gart(>t_obj[i]->tbo);
if (r) {
- DRM_ERROR("%p bind failed\n", gtt_obj[i]);
+ dev_info(adev->dev, "%p bind failed\n", gtt_obj[i]);
goto out_lclean_unpin;
}
gart_addr = amdgpu_bo_gpu_offset(gtt_obj[i]);
r = amdgpu_bo_kmap(gtt_obj[i], >t_map);
if (r) {
- DRM_ERROR("Failed to map GTT object %d\n", i);
+ dev_info(adev->dev, "Failed to map GTT object %d\n", i);
goto out_lclean_unpin;
}
@@ -123,13 +123,13 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
size, NULL, &fence, false, false, false);
if (r) {
- DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
+ dev_info(adev->dev, "Failed GTT->VRAM copy %d\n", i);
goto out_lclean_unpin;
}
r = dma_fence_wait(fence, false);
if (r) {
- DRM_ERROR("Failed to wait for GTT->VRAM fence %d\n", i);
+ dev_info(adev->dev, "Failed to wait for GTT->VRAM fence %d\n", i);
goto out_lclean_unpin;
}
@@ -138,7 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
r = amdgpu_bo_kmap(vram_obj, &vram_map);
if (r) {
- DRM_ERROR("Failed to map VRAM object after copy %d\n", i);
+ dev_info(adev->dev, "Failed to map VRAM object after copy %d\n", i);
goto out_lclean_unpin;
}
@@ -147,16 +147,16 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
vram_start < vram_end;
gart_start++, vram_start++) {
if (*vram_start != gart_start) {
- DRM_ERROR("Incorrect GTT->VRAM copy %d: Got 0x%p, "
- "expected 0x%p (GTT/VRAM offset "
- "0x%16llx/0x%16llx)\n",
- i, *vram_start, gart_start,
- (unsigned long long)
- (gart_addr - adev->gmc.gart_start +
- (void *)gart_start - gtt_map),
- (unsigned long long)
- (vram_addr - adev->gmc.vram_start +
- (void *)gart_start - gtt_map));
+ dev_info(adev->dev, "Incorrect GTT->VRAM copy %d: Got 0x%p, "
+ "expected 0x%p (GTT/VRAM offset "
+ "0x%16llx/0x%16llx)\n",
+ i, *vram_start, gart_start,
+ (unsigned long long)
+ (gart_addr - adev->gmc.gart_start +
+ (void *)gart_start - gtt_map),
+ (unsigned long long)
+ (vram_addr - adev->gmc.vram_start +
+ (void *)gart_start - gtt_map));
amdgpu_bo_kunmap(vram_obj);
goto out_lclean_unpin;
}
@@ -169,13 +169,13 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
size, NULL, &fence, false, false, false);
if (r) {
- DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
+ dev_info(adev->dev, "Failed VRAM->GTT copy %d\n", i);
goto out_lclean_unpin;
}
r = dma_fence_wait(fence, false);
if (r) {
- DRM_ERROR("Failed to wait for VRAM->GTT fence %d\n", i);
+ dev_info(adev->dev, "Failed to wait for VRAM->GTT fence %d\n", i);
goto out_lclean_unpin;
}
@@ -184,7 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
r = amdgpu_bo_kmap(gtt_obj[i], >t_map);
if (r) {
- DRM_ERROR("Failed to map GTT object after copy %d\n", i);
+ dev_info(adev->dev, "Failed to map GTT object after copy %d\n", i);
goto out_lclean_unpin;
}
@@ -193,16 +193,16 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
gart_start < gart_end;
gart_start++, vram_start++) {
if (*gart_start != vram_start) {
- DRM_ERROR("Incorrect VRAM->GTT copy %d: Got 0x%p, "
- "expected 0x%p (VRAM/GTT offset "
- "0x%16llx/0x%16llx)\n",
- i, *gart_start, vram_start,
- (unsigned long long)
- (vram_addr - adev->gmc.vram_start +
- (void *)vram_start - vram_map),
- (unsigned long long)
- (gart_addr - adev->gmc.gart_start +
- (void *)vram_start - vram_map));
+ dev_info(adev->dev, "Incorrect VRAM->GTT copy %d: Got 0x%p, "
+ "expected 0x%p (VRAM/GTT offset "
+ "0x%16llx/0x%16llx)\n",
+ i, *gart_start, vram_start,
+ (unsigned long long)
+ (vram_addr - adev->gmc.vram_start +
+ (void *)vram_start - vram_map),
+ (unsigned long long)
+ (gart_addr - adev->gmc.gart_start +
+ (void *)vram_start - vram_map));
amdgpu_bo_kunmap(gtt_obj[i]);
goto out_lclean_unpin;
}
@@ -210,7 +210,8 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
amdgpu_bo_kunmap(gtt_obj[i]);
- DRM_INFO("Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
+ dev_info(adev->dev,
+ "Tested GTT->VRAM and VRAM->GTT copy for GTT offset 0x%llx\n",
gart_addr - adev->gmc.gart_start);
continue;
--
2.35.1
More information about the amd-gfx
mailing list