aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
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
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')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c22
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c1
5 files changed, 20 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index e9af03113fc3..c1b913541739 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1482,6 +1482,9 @@ struct amdgpu_device {
1482 spinlock_t gtt_list_lock; 1482 spinlock_t gtt_list_lock;
1483 struct list_head gtt_list; 1483 struct list_head gtt_list;
1484 1484
1485 /* record hw reset is performed */
1486 bool has_hw_reset;
1487
1485}; 1488};
1486 1489
1487static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev) 1490static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev)
@@ -1700,7 +1703,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
1700int amdgpu_gpu_reset(struct amdgpu_device *adev); 1703int amdgpu_gpu_reset(struct amdgpu_device *adev);
1701bool amdgpu_need_backup(struct amdgpu_device *adev); 1704bool amdgpu_need_backup(struct amdgpu_device *adev);
1702void amdgpu_pci_config_reset(struct amdgpu_device *adev); 1705void amdgpu_pci_config_reset(struct amdgpu_device *adev);
1703bool amdgpu_card_posted(struct amdgpu_device *adev); 1706bool amdgpu_need_post(struct amdgpu_device *adev);
1704void amdgpu_update_display_priority(struct amdgpu_device *adev); 1707void amdgpu_update_display_priority(struct amdgpu_device *adev);
1705 1708
1706int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data); 1709int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index d9def01f276e..821f7cc2051f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -100,7 +100,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
100 resource_size_t size = 256 * 1024; /* ??? */ 100 resource_size_t size = 256 * 1024; /* ??? */
101 101
102 if (!(adev->flags & AMD_IS_APU)) 102 if (!(adev->flags & AMD_IS_APU))
103 if (!amdgpu_card_posted(adev)) 103 if (amdgpu_need_post(adev))
104 return false; 104 return false;
105 105
106 adev->bios = NULL; 106 adev->bios = NULL;
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");
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index 7c39b538dc0e..c4d4b35e54ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1176,6 +1176,7 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev)
1176 if (RREG32(mmCONFIG_MEMSIZE) != 0xffffffff) { 1176 if (RREG32(mmCONFIG_MEMSIZE) != 0xffffffff) {
1177 /* enable BM */ 1177 /* enable BM */
1178 pci_set_master(adev->pdev); 1178 pci_set_master(adev->pdev);
1179 adev->has_hw_reset = true;
1179 r = 0; 1180 r = 0;
1180 break; 1181 break;
1181 } 1182 }
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index 4922fff08c3c..50bdb24ef8d6 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -721,6 +721,7 @@ static int vi_gpu_pci_config_reset(struct amdgpu_device *adev)
721 if (RREG32(mmCONFIG_MEMSIZE) != 0xffffffff) { 721 if (RREG32(mmCONFIG_MEMSIZE) != 0xffffffff) {
722 /* enable BM */ 722 /* enable BM */
723 pci_set_master(adev->pdev); 723 pci_set_master(adev->pdev);
724 adev->has_hw_reset = true;
724 return 0; 725 return 0;
725 } 726 }
726 udelay(1); 727 udelay(1);