diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2017-05-15 02:20:00 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-24 18:10:06 -0400 |
commit | 0c49e0b8a43c8addb0498cd32390f4ef08b5dd27 (patch) | |
tree | 154439f0b20cba71463f67ccaf5913a29ebf30d8 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | e0ec45063609b4a583e7f4d843275888f2480321 (diff) |
drm/amdgpu: check if vram is lost v2
backup first 64 byte of gart table as reset magic, check if magic is same
after gpu hw reset.
v2: use memcmp instead of manual innovation.
Signed-off-by: Chunming Zhou <David1.Zhou@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 | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 8eb162509c84..5a170071702a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1658,6 +1658,17 @@ static int amdgpu_init(struct amdgpu_device *adev) | |||
1658 | return 0; | 1658 | return 0; |
1659 | } | 1659 | } |
1660 | 1660 | ||
1661 | static void amdgpu_fill_reset_magic(struct amdgpu_device *adev) | ||
1662 | { | ||
1663 | memcpy(adev->reset_magic, adev->gart.ptr, AMDGPU_RESET_MAGIC_NUM); | ||
1664 | } | ||
1665 | |||
1666 | static bool amdgpu_check_vram_lost(struct amdgpu_device *adev) | ||
1667 | { | ||
1668 | return !!memcmp(adev->gart.ptr, adev->reset_magic, | ||
1669 | AMDGPU_RESET_MAGIC_NUM); | ||
1670 | } | ||
1671 | |||
1661 | static int amdgpu_late_init(struct amdgpu_device *adev) | 1672 | static int amdgpu_late_init(struct amdgpu_device *adev) |
1662 | { | 1673 | { |
1663 | int i = 0, r; | 1674 | int i = 0, r; |
@@ -1688,6 +1699,8 @@ static int amdgpu_late_init(struct amdgpu_device *adev) | |||
1688 | } | 1699 | } |
1689 | } | 1700 | } |
1690 | 1701 | ||
1702 | amdgpu_fill_reset_magic(adev); | ||
1703 | |||
1691 | return 0; | 1704 | return 0; |
1692 | } | 1705 | } |
1693 | 1706 | ||
@@ -2762,7 +2775,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) | |||
2762 | { | 2775 | { |
2763 | int i, r; | 2776 | int i, r; |
2764 | int resched; | 2777 | int resched; |
2765 | bool need_full_reset; | 2778 | bool need_full_reset, vram_lost = false; |
2766 | 2779 | ||
2767 | if (!amdgpu_check_soft_reset(adev)) { | 2780 | if (!amdgpu_check_soft_reset(adev)) { |
2768 | DRM_INFO("No hardware hang detected. Did some blocks stall?\n"); | 2781 | DRM_INFO("No hardware hang detected. Did some blocks stall?\n"); |
@@ -2825,12 +2838,17 @@ retry: | |||
2825 | r = amdgpu_resume_phase1(adev); | 2838 | r = amdgpu_resume_phase1(adev); |
2826 | if (r) | 2839 | if (r) |
2827 | goto out; | 2840 | goto out; |
2841 | vram_lost = amdgpu_check_vram_lost(adev); | ||
2842 | if (vram_lost) | ||
2843 | DRM_ERROR("VRAM is lost!\n"); | ||
2828 | r = amdgpu_ttm_recover_gart(adev); | 2844 | r = amdgpu_ttm_recover_gart(adev); |
2829 | if (r) | 2845 | if (r) |
2830 | goto out; | 2846 | goto out; |
2831 | r = amdgpu_resume_phase2(adev); | 2847 | r = amdgpu_resume_phase2(adev); |
2832 | if (r) | 2848 | if (r) |
2833 | goto out; | 2849 | goto out; |
2850 | if (vram_lost) | ||
2851 | amdgpu_fill_reset_magic(adev); | ||
2834 | } | 2852 | } |
2835 | } | 2853 | } |
2836 | out: | 2854 | out: |