diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-10-21 15:45:22 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-25 14:38:56 -0400 |
commit | 72a57438d1b4a17dc2f3743fcbb8f0b473a63373 (patch) | |
tree | f91b6c8067ee01d05f29225f9b44a295541de42c | |
parent | a76ed485c57e37d22c7f47eb63120b3618930297 (diff) |
drm/amdgpu: consolidate atom scratch reg handling for hangs
Move from asic specific code to common atom code.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cik.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vi.c | 16 |
4 files changed, 20 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c index 8e6bf548d689..76cbb1d08bce 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | |||
@@ -1784,6 +1784,19 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev) | |||
1784 | WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); | 1784 | WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev, | ||
1788 | bool hung) | ||
1789 | { | ||
1790 | u32 tmp = RREG32(mmBIOS_SCRATCH_3); | ||
1791 | |||
1792 | if (hung) | ||
1793 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
1794 | else | ||
1795 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
1796 | |||
1797 | WREG32(mmBIOS_SCRATCH_3, tmp); | ||
1798 | } | ||
1799 | |||
1787 | /* Atom needs data in little endian format | 1800 | /* Atom needs data in little endian format |
1788 | * so swap as appropriate when copying data to | 1801 | * so swap as appropriate when copying data to |
1789 | * or from atom. Note that atom operates on | 1802 | * or from atom. Note that atom operates on |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h index 17356151db38..e4afb1652fde 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h | |||
@@ -206,6 +206,8 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock); | |||
206 | void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev); | 206 | void amdgpu_atombios_scratch_regs_init(struct amdgpu_device *adev); |
207 | void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev); | 207 | void amdgpu_atombios_scratch_regs_save(struct amdgpu_device *adev); |
208 | void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev); | 208 | void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev); |
209 | void amdgpu_atombios_scratch_regs_engine_hung(struct amdgpu_device *adev, | ||
210 | bool hung); | ||
209 | 211 | ||
210 | void amdgpu_atombios_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); | 212 | void amdgpu_atombios_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); |
211 | int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type, | 213 | int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index 1b70f8fa4280..302df85893ab 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
@@ -1189,18 +1189,6 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev) | |||
1189 | return r; | 1189 | return r; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | static void cik_set_bios_scratch_engine_hung(struct amdgpu_device *adev, bool hung) | ||
1193 | { | ||
1194 | u32 tmp = RREG32(mmBIOS_SCRATCH_3); | ||
1195 | |||
1196 | if (hung) | ||
1197 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
1198 | else | ||
1199 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
1200 | |||
1201 | WREG32(mmBIOS_SCRATCH_3, tmp); | ||
1202 | } | ||
1203 | |||
1204 | /** | 1192 | /** |
1205 | * cik_asic_reset - soft reset GPU | 1193 | * cik_asic_reset - soft reset GPU |
1206 | * | 1194 | * |
@@ -1213,11 +1201,12 @@ static void cik_set_bios_scratch_engine_hung(struct amdgpu_device *adev, bool hu | |||
1213 | static int cik_asic_reset(struct amdgpu_device *adev) | 1201 | static int cik_asic_reset(struct amdgpu_device *adev) |
1214 | { | 1202 | { |
1215 | int r; | 1203 | int r; |
1216 | cik_set_bios_scratch_engine_hung(adev, true); | 1204 | |
1205 | amdgpu_atombios_scratch_regs_engine_hung(adev, true); | ||
1217 | 1206 | ||
1218 | r = cik_gpu_pci_config_reset(adev); | 1207 | r = cik_gpu_pci_config_reset(adev); |
1219 | 1208 | ||
1220 | cik_set_bios_scratch_engine_hung(adev, false); | 1209 | amdgpu_atombios_scratch_regs_engine_hung(adev, false); |
1221 | 1210 | ||
1222 | return r; | 1211 | return r; |
1223 | } | 1212 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index e33399cd1376..25c0a71b257d 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -729,18 +729,6 @@ static int vi_gpu_pci_config_reset(struct amdgpu_device *adev) | |||
729 | return -EINVAL; | 729 | return -EINVAL; |
730 | } | 730 | } |
731 | 731 | ||
732 | static void vi_set_bios_scratch_engine_hung(struct amdgpu_device *adev, bool hung) | ||
733 | { | ||
734 | u32 tmp = RREG32(mmBIOS_SCRATCH_3); | ||
735 | |||
736 | if (hung) | ||
737 | tmp |= ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
738 | else | ||
739 | tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG; | ||
740 | |||
741 | WREG32(mmBIOS_SCRATCH_3, tmp); | ||
742 | } | ||
743 | |||
744 | /** | 732 | /** |
745 | * vi_asic_reset - soft reset GPU | 733 | * vi_asic_reset - soft reset GPU |
746 | * | 734 | * |
@@ -754,11 +742,11 @@ static int vi_asic_reset(struct amdgpu_device *adev) | |||
754 | { | 742 | { |
755 | int r; | 743 | int r; |
756 | 744 | ||
757 | vi_set_bios_scratch_engine_hung(adev, true); | 745 | amdgpu_atombios_scratch_regs_engine_hung(adev, true); |
758 | 746 | ||
759 | r = vi_gpu_pci_config_reset(adev); | 747 | r = vi_gpu_pci_config_reset(adev); |
760 | 748 | ||
761 | vi_set_bios_scratch_engine_hung(adev, false); | 749 | amdgpu_atombios_scratch_regs_engine_hung(adev, false); |
762 | 750 | ||
763 | return r; | 751 | return r; |
764 | } | 752 | } |