aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorJim Qu <Jim.Qu@amd.com>2017-02-10 02:59:59 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-02-17 16:12:58 -0500
commitc836fec5ce8eb0d0c08fa0ea5fb71df3290d1601 (patch)
tree9c2a020087a83f67d2d41c456343f0361d776f68 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent9ca70356a9260403c1bda40d942935e55d00c11c (diff)
drm/amd/amdgpu: post card if there is real hw resetting performed
Check whether we need to post rather than whether the asic is posted. There are some cases (e.g., GPU reset or resume from hibernate) where we need to force post even if the asic has been posted. Signed-off-by: Jim Qu <Jim.Qu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@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.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 944ba0d3874a..6abb238b25c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -619,25 +619,29 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)
619 * GPU helpers function. 619 * GPU helpers function.
620 */ 620 */
621/** 621/**
622 * amdgpu_card_posted - check if the hw has already been initialized 622 * amdgpu_need_post - check if the hw need post or not
623 * 623 *
624 * @adev: amdgpu_device pointer 624 * @adev: amdgpu_device pointer
625 * 625 *
626 * Check if the asic has been initialized (all asics). 626 * Check if the asic has been initialized (all asics) at driver startup
627 * Used at driver startup. 627 * or post is needed if hw reset is performed.
628 * Returns true if initialized or false if not. 628 * Returns true if need or false if not.
629 */ 629 */
630bool amdgpu_card_posted(struct amdgpu_device *adev) 630bool amdgpu_need_post(struct amdgpu_device *adev)
631{ 631{
632 uint32_t reg; 632 uint32_t reg;
633 633
634 if (adev->has_hw_reset) {
635 adev->has_hw_reset = false;
636 return true;
637 }
634 /* then check MEM_SIZE, in case the crtcs are off */ 638 /* then check MEM_SIZE, in case the crtcs are off */
635 reg = RREG32(mmCONFIG_MEMSIZE); 639 reg = RREG32(mmCONFIG_MEMSIZE);
636 640
637 if (reg) 641 if (reg)
638 return true; 642 return false;
639 643
640 return false; 644 return true;
641 645
642} 646}
643 647
@@ -665,7 +669,7 @@ static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
665 return true; 669 return true;
666 } 670 }
667 } 671 }
668 return !amdgpu_card_posted(adev); 672 return amdgpu_need_post(adev);
669} 673}
670 674
671/** 675/**
@@ -2071,7 +2075,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
2071 amdgpu_atombios_scratch_regs_restore(adev); 2075 amdgpu_atombios_scratch_regs_restore(adev);
2072 2076
2073 /* post card */ 2077 /* post card */
2074 if (!amdgpu_card_posted(adev) || !resume) { 2078 if (amdgpu_need_post(adev)) {
2075 r = amdgpu_atom_asic_init(adev->mode_info.atom_context); 2079 r = amdgpu_atom_asic_init(adev->mode_info.atom_context);
2076 if (r) 2080 if (r)
2077 DRM_ERROR("amdgpu asic init failed\n"); 2081 DRM_ERROR("amdgpu asic init failed\n");