diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 75 |
2 files changed, 76 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index a59c07590cee..54be18b1ac94 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -968,6 +968,7 @@ struct amdgpu_gfx { | |||
968 | struct amdgpu_irq_src eop_irq; | 968 | struct amdgpu_irq_src eop_irq; |
969 | struct amdgpu_irq_src priv_reg_irq; | 969 | struct amdgpu_irq_src priv_reg_irq; |
970 | struct amdgpu_irq_src priv_inst_irq; | 970 | struct amdgpu_irq_src priv_inst_irq; |
971 | struct amdgpu_irq_src cp_ecc_error_irq; | ||
971 | /* gfx status */ | 972 | /* gfx status */ |
972 | uint32_t gfx_current_status; | 973 | uint32_t gfx_current_status; |
973 | /* ce ram size*/ | 974 | /* ce ram size*/ |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 61452c7c4024..dbc47a727fe7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -2055,6 +2055,12 @@ static int gfx_v8_0_sw_init(void *handle) | |||
2055 | if (r) | 2055 | if (r) |
2056 | return r; | 2056 | return r; |
2057 | 2057 | ||
2058 | /* Add CP EDC/ECC irq */ | ||
2059 | r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 197, | ||
2060 | &adev->gfx.cp_ecc_error_irq); | ||
2061 | if (r) | ||
2062 | return r; | ||
2063 | |||
2058 | adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; | 2064 | adev->gfx.gfx_current_status = AMDGPU_GFX_NORMAL_MODE; |
2059 | 2065 | ||
2060 | gfx_v8_0_scratch_init(adev); | 2066 | gfx_v8_0_scratch_init(adev); |
@@ -5118,6 +5124,8 @@ static int gfx_v8_0_hw_fini(void *handle) | |||
5118 | amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0); | 5124 | amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0); |
5119 | amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0); | 5125 | amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0); |
5120 | 5126 | ||
5127 | amdgpu_irq_put(adev, &adev->gfx.cp_ecc_error_irq, 0); | ||
5128 | |||
5121 | /* disable KCQ to avoid CPC touch memory not valid anymore */ | 5129 | /* disable KCQ to avoid CPC touch memory not valid anymore */ |
5122 | for (i = 0; i < adev->gfx.num_compute_rings; i++) | 5130 | for (i = 0; i < adev->gfx.num_compute_rings; i++) |
5123 | gfx_v8_0_kcq_disable(&adev->gfx.kiq.ring, &adev->gfx.compute_ring[i]); | 5131 | gfx_v8_0_kcq_disable(&adev->gfx.kiq.ring, &adev->gfx.compute_ring[i]); |
@@ -5549,6 +5557,12 @@ static int gfx_v8_0_late_init(void *handle) | |||
5549 | if (r) | 5557 | if (r) |
5550 | return r; | 5558 | return r; |
5551 | 5559 | ||
5560 | r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); | ||
5561 | if (r) { | ||
5562 | DRM_ERROR("amdgpu_irq_get() failed to get IRQ for EDC, r: %d.\n", r); | ||
5563 | return r; | ||
5564 | } | ||
5565 | |||
5552 | amdgpu_device_ip_set_powergating_state(adev, | 5566 | amdgpu_device_ip_set_powergating_state(adev, |
5553 | AMD_IP_BLOCK_TYPE_GFX, | 5567 | AMD_IP_BLOCK_TYPE_GFX, |
5554 | AMD_PG_STATE_GATE); | 5568 | AMD_PG_STATE_GATE); |
@@ -6794,6 +6808,51 @@ static int gfx_v8_0_set_eop_interrupt_state(struct amdgpu_device *adev, | |||
6794 | return 0; | 6808 | return 0; |
6795 | } | 6809 | } |
6796 | 6810 | ||
6811 | static int gfx_v8_0_set_cp_ecc_int_state(struct amdgpu_device *adev, | ||
6812 | struct amdgpu_irq_src *source, | ||
6813 | unsigned int type, | ||
6814 | enum amdgpu_interrupt_state state) | ||
6815 | { | ||
6816 | int enable_flag; | ||
6817 | |||
6818 | switch (state) { | ||
6819 | case AMDGPU_IRQ_STATE_DISABLE: | ||
6820 | enable_flag = 0; | ||
6821 | break; | ||
6822 | |||
6823 | case AMDGPU_IRQ_STATE_ENABLE: | ||
6824 | enable_flag = 1; | ||
6825 | break; | ||
6826 | |||
6827 | default: | ||
6828 | return -EINVAL; | ||
6829 | } | ||
6830 | |||
6831 | WREG32_FIELD(CP_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, enable_flag); | ||
6832 | WREG32_FIELD(CP_INT_CNTL_RING0, CP_ECC_ERROR_INT_ENABLE, enable_flag); | ||
6833 | WREG32_FIELD(CP_INT_CNTL_RING1, CP_ECC_ERROR_INT_ENABLE, enable_flag); | ||
6834 | WREG32_FIELD(CP_INT_CNTL_RING2, CP_ECC_ERROR_INT_ENABLE, enable_flag); | ||
6835 | WREG32_FIELD(CPC_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, enable_flag); | ||
6836 | WREG32_FIELD(CP_ME1_PIPE0_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6837 | enable_flag); | ||
6838 | WREG32_FIELD(CP_ME1_PIPE1_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6839 | enable_flag); | ||
6840 | WREG32_FIELD(CP_ME1_PIPE2_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6841 | enable_flag); | ||
6842 | WREG32_FIELD(CP_ME1_PIPE3_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6843 | enable_flag); | ||
6844 | WREG32_FIELD(CP_ME2_PIPE0_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6845 | enable_flag); | ||
6846 | WREG32_FIELD(CP_ME2_PIPE1_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6847 | enable_flag); | ||
6848 | WREG32_FIELD(CP_ME2_PIPE2_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6849 | enable_flag); | ||
6850 | WREG32_FIELD(CP_ME2_PIPE3_INT_CNTL, CP_ECC_ERROR_INT_ENABLE, | ||
6851 | enable_flag); | ||
6852 | |||
6853 | return 0; | ||
6854 | } | ||
6855 | |||
6797 | static int gfx_v8_0_eop_irq(struct amdgpu_device *adev, | 6856 | static int gfx_v8_0_eop_irq(struct amdgpu_device *adev, |
6798 | struct amdgpu_irq_src *source, | 6857 | struct amdgpu_irq_src *source, |
6799 | struct amdgpu_iv_entry *entry) | 6858 | struct amdgpu_iv_entry *entry) |
@@ -6844,6 +6903,14 @@ static int gfx_v8_0_priv_inst_irq(struct amdgpu_device *adev, | |||
6844 | return 0; | 6903 | return 0; |
6845 | } | 6904 | } |
6846 | 6905 | ||
6906 | static int gfx_v8_0_cp_ecc_error_irq(struct amdgpu_device *adev, | ||
6907 | struct amdgpu_irq_src *source, | ||
6908 | struct amdgpu_iv_entry *entry) | ||
6909 | { | ||
6910 | DRM_ERROR("ECC error detected."); | ||
6911 | return 0; | ||
6912 | } | ||
6913 | |||
6847 | static int gfx_v8_0_kiq_set_interrupt_state(struct amdgpu_device *adev, | 6914 | static int gfx_v8_0_kiq_set_interrupt_state(struct amdgpu_device *adev, |
6848 | struct amdgpu_irq_src *src, | 6915 | struct amdgpu_irq_src *src, |
6849 | unsigned int type, | 6916 | unsigned int type, |
@@ -7044,6 +7111,11 @@ static const struct amdgpu_irq_src_funcs gfx_v8_0_kiq_irq_funcs = { | |||
7044 | .process = gfx_v8_0_kiq_irq, | 7111 | .process = gfx_v8_0_kiq_irq, |
7045 | }; | 7112 | }; |
7046 | 7113 | ||
7114 | static const struct amdgpu_irq_src_funcs gfx_v8_0_cp_ecc_error_irq_funcs = { | ||
7115 | .set = gfx_v8_0_set_cp_ecc_int_state, | ||
7116 | .process = gfx_v8_0_cp_ecc_error_irq, | ||
7117 | }; | ||
7118 | |||
7047 | static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) | 7119 | static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) |
7048 | { | 7120 | { |
7049 | adev->gfx.eop_irq.num_types = AMDGPU_CP_IRQ_LAST; | 7121 | adev->gfx.eop_irq.num_types = AMDGPU_CP_IRQ_LAST; |
@@ -7057,6 +7129,9 @@ static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) | |||
7057 | 7129 | ||
7058 | adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST; | 7130 | adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST; |
7059 | adev->gfx.kiq.irq.funcs = &gfx_v8_0_kiq_irq_funcs; | 7131 | adev->gfx.kiq.irq.funcs = &gfx_v8_0_kiq_irq_funcs; |
7132 | |||
7133 | adev->gfx.cp_ecc_error_irq.num_types = 1; | ||
7134 | adev->gfx.cp_ecc_error_irq.funcs = &gfx_v8_0_cp_ecc_error_irq_funcs; | ||
7060 | } | 7135 | } |
7061 | 7136 | ||
7062 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev) | 7137 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev) |