aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2017-12-29 04:06:41 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-02-28 15:19:03 -0500
commitf812dec57d55719f5fe1f6fce193561015369363 (patch)
treea645eb8482c1ed6b32f005fc17d6177de55a4e35
parent8d333fe0ad9dcb9651b9b450424a960bac040f96 (diff)
drm/amdgpu: fix&cleanups for wb_clear
fix: should do right shift on wb before clearing cleanups: 1,should memset all wb buffer 2,set max wb number to 128 (total 4KB) is big enough Signed-off-by: Monk Liu <Monk.Liu@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index d5a2eefd6c3e..74edba18b159 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1156,7 +1156,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p,
1156/* 1156/*
1157 * Writeback 1157 * Writeback
1158 */ 1158 */
1159#define AMDGPU_MAX_WB 512 /* Reserve at most 512 WB slots for amdgpu-owned rings. */ 1159#define AMDGPU_MAX_WB 128 /* Reserve at most 128 WB slots for amdgpu-owned rings. */
1160 1160
1161struct amdgpu_wb { 1161struct amdgpu_wb {
1162 struct amdgpu_bo *wb_obj; 1162 struct amdgpu_bo *wb_obj;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index d9f3d54e228f..af1b879a9ee9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -492,7 +492,7 @@ static int amdgpu_device_wb_init(struct amdgpu_device *adev)
492 memset(&adev->wb.used, 0, sizeof(adev->wb.used)); 492 memset(&adev->wb.used, 0, sizeof(adev->wb.used));
493 493
494 /* clear wb memory */ 494 /* clear wb memory */
495 memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t)); 495 memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8);
496 } 496 }
497 497
498 return 0; 498 return 0;
@@ -530,8 +530,9 @@ int amdgpu_device_wb_get(struct amdgpu_device *adev, u32 *wb)
530 */ 530 */
531void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb) 531void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb)
532{ 532{
533 wb >>= 3;
533 if (wb < adev->wb.num_wb) 534 if (wb < adev->wb.num_wb)
534 __clear_bit(wb >> 3, adev->wb.used); 535 __clear_bit(wb, adev->wb.used);
535} 536}
536 537
537/** 538/**