drm/amdgpu: consolidate atom scratch reg handling for hangs
Subsystems (2)
PATCH 1/1 drm/amdgpu: consolidate atom scratch reg handling for hangs
Move from asic specific code to common atom code.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h | 2 ++ drivers/gpu/drm/amd/amdgpu/cik.c | 17 +++-------------- drivers/gpu/drm/amd/amdgpu/vi.c | 16 ++-------------- 4 files changed, 20 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +13 -0
@@ -1784,6 +1784,19 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)WREG32 (mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); } +void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev, +bool hung) +{ +u32 tmp =RREG32 (mmBIOS_SCRATCH_3); + +if (hung) + tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; +else + tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; + +WREG32 (mmBIOS_SCRATCH_3, tmp); +} +/* Atom needs data in little endian format * so swap as appropriate when copying data to * or from atom. Note that atom operates on
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h +2 -0
@@ -206,6 +206,8 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock);void amdgpu_atombios_scratch_regs_init (struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_save (struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_restore (struct amdgpu_device *adev); +void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev, +bool hung);void amdgpu_atombios_copy_swap (u8 *dst,u8 *src,u8 num_bytes,bool to_le); int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type,
drivers/gpu/drm/amd/amdgpu/cik.c +3 -14
@@ -1189,18 +1189,6 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev)return r; } -static void cik_set_bios_scratch_engine_hung (struct amdgpu_device *adev,bool hung) -{ -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); - -if (hung) - tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -else - tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; - -WREG32 (mmBIOS_SCRATCH_3, tmp); -} -/** * cik_asic_reset - soft reset GPU *
@@ -1213,11 +1201,12 @@ static void cik_set_bios_scratch_engine_hung(struct amdgpu_device *adev, bool hustatic int cik_asic_reset (struct amdgpu_device *adev) {int r; -cik_set_bios_scratch_engine_hung (adev, true); + +amdgpu_atombios_scratch_regs_engine_hung (adev, true); r =cik_gpu_pci_config_reset (adev); -cik_set_bios_scratch_engine_hung (adev, false); +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r; }
drivers/gpu/drm/amd/amdgpu/vi.c +2 -14
@@ -729,18 +729,6 @@ static int vi_gpu_pci_config_reset(struct amdgpu_device *adev)return -EINVAL ; } -static void vi_set_bios_scratch_engine_hung (struct amdgpu_device *adev,bool hung) -{ -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); - -if (hung) - tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -else - tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; - -WREG32 (mmBIOS_SCRATCH_3, tmp); -} -/** * vi_asic_reset - soft reset GPU *
@@ -754,11 +742,11 @@ static int vi_asic_reset(struct amdgpu_device *adev) {int r; -vi_set_bios_scratch_engine_hung (adev, true); +amdgpu_atombios_scratch_regs_engine_hung (adev, true); r =vi_gpu_pci_config_reset (adev); -vi_set_bios_scratch_engine_hung (adev, false); +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r; }
Signature · 6 lines
2.5.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1477079193-32725-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Christian König
Reviewed-byAm 21.10.2016 um 21:46 schrieb Alex Deucher:
Quoted 3 lines
Move from asic specific code to common atom code.
Signed-off-by Alex Deucher <[email protected]>
Reviewed-by Christian König <[email protected]>.
Quoted 109 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h | 2 ++ drivers/gpu/drm/amd/amdgpu/cik.c | 17 +++-------------- drivers/gpu/drm/amd/amdgpu/vi.c | 16 ++-------------- 4 files changed, 20 insertions(+), 28 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +13
-0@@ -1784,6 +1784,19 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)WREG32 (mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]); } +void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev, +bool hung) +{ +u32 tmp =RREG32 (mmBIOS_SCRATCH_3); + +if (hung) + tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; +else + tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; + +WREG32 (mmBIOS_SCRATCH_3, tmp); +} +/* Atom needs data in little endian format * so swap as appropriate when copying data to * or from atom. Note that atom operates on drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.h +2
-0@@ -206,6 +206,8 @@ void amdgpu_atombios_scratch_regs_lock(struct amdgpu_device *adev, bool lock);void amdgpu_atombios_scratch_regs_init (struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_save (struct amdgpu_device *adev);void amdgpu_atombios_scratch_regs_restore (struct amdgpu_device *adev); +void amdgpu_atombios_scratch_regs_engine_hung (struct amdgpu_device *adev, +bool hung);void amdgpu_atombios_copy_swap (u8 *dst,u8 *src,u8 num_bytes,bool to_le); int amdgpu_atombios_get_max_vddc(struct amdgpu_device *adev, u8 voltage_type,drivers/gpu/drm/amd/amdgpu/cik.c +3
-14@@ -1189,18 +1189,6 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev)return r; } -static void cik_set_bios_scratch_engine_hung (struct amdgpu_device *adev,bool hung) -{ -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); - -if (hung) - tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -else - tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; - -WREG32 (mmBIOS_SCRATCH_3, tmp); -} -/** * cik_asic_reset - soft reset GPU * @@ -1213,11 +1201,12 @@ static void cik_set_bios_scratch_engine_hung(struct amdgpu_device *adev, bool hustatic int cik_asic_reset (struct amdgpu_device *adev) {int r; -cik_set_bios_scratch_engine_hung (adev, true); + +amdgpu_atombios_scratch_regs_engine_hung (adev, true); r =cik_gpu_pci_config_reset (adev); -cik_set_bios_scratch_engine_hung (adev, false); +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r; }drivers/gpu/drm/amd/amdgpu/vi.c +0
-12@@ -729,18 +729,6 @@ static int vi_gpu_pci_config_reset(struct amdgpu_device *adev)return -EINVAL ; } -static void vi_set_bios_scratch_engine_hung (struct amdgpu_device *adev,bool hung) -{ -u32 tmp =RREG32 (mmBIOS_SCRATCH_3); - -if (hung) - tmp |=ATOM_S3_ASIC_GUI_ENGINE_HUNG ; -else - tmp &= ~ATOM_S3_ASIC_GUI_ENGINE_HUNG ; - -WREG32 (mmBIOS_SCRATCH_3, tmp); -} -/** * vi_asic_reset - soft reset GPU * @@ -754,11 +742,11 @@ static int vi_asic_reset(struct amdgpu_device *adev) {int r;
drivers/gpu/drm/amd/amdgpu/vi.c static int vi_asic_reset(struct amdgpu_device *adev) · line 752
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vi.c +2
-2-vi_set_bios_scratch_engine_hung (adev, true); +amdgpu_atombios_scratch_regs_engine_hung (adev, true); r =vi_gpu_pci_config_reset (adev); -vi_set_bios_scratch_engine_hung (adev, false); +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx