diff options
author | Monk Liu <Monk.Liu@amd.com> | 2017-06-19 10:19:41 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-07-25 16:29:26 -0400 |
commit | 0915fdbc69f58644f437730fbc9e1f1ab426fe18 (patch) | |
tree | da3ada74fbbc639d3fabd40c39a566b069ae7c9e /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | e342610c9a9b36459c5be107cb0b7c338404fcc3 (diff) |
drm/amdgpu:fix gfx fence allocate size
1, for sriov, we need 8dw for the gfx fence due to CP
behaviour
2, cleanup wrong logic in wptr/rptr wb alloc and free
Change-Id: Ifbfed17a4621dae57244942ffac7de1743de0294
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a9eeaad49d18..15f55865fcfb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -602,6 +602,21 @@ int amdgpu_wb_get_64bit(struct amdgpu_device *adev, u32 *wb) | |||
602 | } | 602 | } |
603 | } | 603 | } |
604 | 604 | ||
605 | int amdgpu_wb_get_256Bit(struct amdgpu_device *adev, u32 *wb) | ||
606 | { | ||
607 | int i = 0; | ||
608 | unsigned long offset = bitmap_find_next_zero_area_off(adev->wb.used, | ||
609 | adev->wb.num_wb, 0, 8, 63, 0); | ||
610 | if ((offset + 7) < adev->wb.num_wb) { | ||
611 | for (i = 0; i < 8; i++) | ||
612 | __set_bit(offset + i, adev->wb.used); | ||
613 | *wb = offset; | ||
614 | return 0; | ||
615 | } else { | ||
616 | return -EINVAL; | ||
617 | } | ||
618 | } | ||
619 | |||
605 | /** | 620 | /** |
606 | * amdgpu_wb_free - Free a wb entry | 621 | * amdgpu_wb_free - Free a wb entry |
607 | * | 622 | * |
@@ -633,6 +648,23 @@ void amdgpu_wb_free_64bit(struct amdgpu_device *adev, u32 wb) | |||
633 | } | 648 | } |
634 | 649 | ||
635 | /** | 650 | /** |
651 | * amdgpu_wb_free_256bit - Free a wb entry | ||
652 | * | ||
653 | * @adev: amdgpu_device pointer | ||
654 | * @wb: wb index | ||
655 | * | ||
656 | * Free a wb slot allocated for use by the driver (all asics) | ||
657 | */ | ||
658 | void amdgpu_wb_free_256bit(struct amdgpu_device *adev, u32 wb) | ||
659 | { | ||
660 | int i = 0; | ||
661 | |||
662 | if ((wb + 7) < adev->wb.num_wb) | ||
663 | for (i = 0; i < 8; i++) | ||
664 | __clear_bit(wb + i, adev->wb.used); | ||
665 | } | ||
666 | |||
667 | /** | ||
636 | * amdgpu_vram_location - try to find VRAM location | 668 | * amdgpu_vram_location - try to find VRAM location |
637 | * @adev: amdgpu device structure holding all necessary informations | 669 | * @adev: amdgpu device structure holding all necessary informations |
638 | * @mc: memory controller structure holding memory informations | 670 | * @mc: memory controller structure holding memory informations |