diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 321 |
1 files changed, 52 insertions, 269 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 2aeef2bb93a4..3d0f277a6523 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -1173,64 +1173,61 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) { | 1176 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP]; |
1177 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP]; | 1177 | info->ucode_id = AMDGPU_UCODE_ID_CP_PFP; |
1178 | info->ucode_id = AMDGPU_UCODE_ID_CP_PFP; | 1178 | info->fw = adev->gfx.pfp_fw; |
1179 | info->fw = adev->gfx.pfp_fw; | 1179 | header = (const struct common_firmware_header *)info->fw->data; |
1180 | header = (const struct common_firmware_header *)info->fw->data; | 1180 | adev->firmware.fw_size += |
1181 | adev->firmware.fw_size += | 1181 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); |
1182 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1182 | |
1183 | 1183 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME]; | |
1184 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME]; | 1184 | info->ucode_id = AMDGPU_UCODE_ID_CP_ME; |
1185 | info->ucode_id = AMDGPU_UCODE_ID_CP_ME; | 1185 | info->fw = adev->gfx.me_fw; |
1186 | info->fw = adev->gfx.me_fw; | 1186 | header = (const struct common_firmware_header *)info->fw->data; |
1187 | header = (const struct common_firmware_header *)info->fw->data; | 1187 | adev->firmware.fw_size += |
1188 | adev->firmware.fw_size += | 1188 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); |
1189 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1189 | |
1190 | 1190 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE]; | |
1191 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE]; | 1191 | info->ucode_id = AMDGPU_UCODE_ID_CP_CE; |
1192 | info->ucode_id = AMDGPU_UCODE_ID_CP_CE; | 1192 | info->fw = adev->gfx.ce_fw; |
1193 | info->fw = adev->gfx.ce_fw; | 1193 | header = (const struct common_firmware_header *)info->fw->data; |
1194 | header = (const struct common_firmware_header *)info->fw->data; | 1194 | adev->firmware.fw_size += |
1195 | adev->firmware.fw_size += | 1195 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); |
1196 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1196 | |
1197 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G]; | ||
1198 | info->ucode_id = AMDGPU_UCODE_ID_RLC_G; | ||
1199 | info->fw = adev->gfx.rlc_fw; | ||
1200 | header = (const struct common_firmware_header *)info->fw->data; | ||
1201 | adev->firmware.fw_size += | ||
1202 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | ||
1203 | |||
1204 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1]; | ||
1205 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1; | ||
1206 | info->fw = adev->gfx.mec_fw; | ||
1207 | header = (const struct common_firmware_header *)info->fw->data; | ||
1208 | adev->firmware.fw_size += | ||
1209 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | ||
1210 | |||
1211 | /* we need account JT in */ | ||
1212 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
1213 | adev->firmware.fw_size += | ||
1214 | ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2, PAGE_SIZE); | ||
1197 | 1215 | ||
1198 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G]; | 1216 | if (amdgpu_sriov_vf(adev)) { |
1199 | info->ucode_id = AMDGPU_UCODE_ID_RLC_G; | 1217 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_STORAGE]; |
1200 | info->fw = adev->gfx.rlc_fw; | 1218 | info->ucode_id = AMDGPU_UCODE_ID_STORAGE; |
1201 | header = (const struct common_firmware_header *)info->fw->data; | 1219 | info->fw = adev->gfx.mec_fw; |
1202 | adev->firmware.fw_size += | 1220 | adev->firmware.fw_size += |
1203 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1221 | ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE); |
1222 | } | ||
1204 | 1223 | ||
1205 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1]; | 1224 | if (adev->gfx.mec2_fw) { |
1206 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1; | 1225 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2]; |
1207 | info->fw = adev->gfx.mec_fw; | 1226 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2; |
1227 | info->fw = adev->gfx.mec2_fw; | ||
1208 | header = (const struct common_firmware_header *)info->fw->data; | 1228 | header = (const struct common_firmware_header *)info->fw->data; |
1209 | adev->firmware.fw_size += | 1229 | adev->firmware.fw_size += |
1210 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1230 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); |
1211 | |||
1212 | /* we need account JT in */ | ||
1213 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
1214 | adev->firmware.fw_size += | ||
1215 | ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2, PAGE_SIZE); | ||
1216 | |||
1217 | if (amdgpu_sriov_vf(adev)) { | ||
1218 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_STORAGE]; | ||
1219 | info->ucode_id = AMDGPU_UCODE_ID_STORAGE; | ||
1220 | info->fw = adev->gfx.mec_fw; | ||
1221 | adev->firmware.fw_size += | ||
1222 | ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE); | ||
1223 | } | ||
1224 | |||
1225 | if (adev->gfx.mec2_fw) { | ||
1226 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2]; | ||
1227 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2; | ||
1228 | info->fw = adev->gfx.mec2_fw; | ||
1229 | header = (const struct common_firmware_header *)info->fw->data; | ||
1230 | adev->firmware.fw_size += | ||
1231 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | ||
1232 | } | ||
1233 | |||
1234 | } | 1231 | } |
1235 | 1232 | ||
1236 | out: | 1233 | out: |
@@ -2048,11 +2045,6 @@ static int gfx_v8_0_sw_init(void *handle) | |||
2048 | adev->gfx.mec.num_pipe_per_mec = 4; | 2045 | adev->gfx.mec.num_pipe_per_mec = 4; |
2049 | adev->gfx.mec.num_queue_per_pipe = 8; | 2046 | adev->gfx.mec.num_queue_per_pipe = 8; |
2050 | 2047 | ||
2051 | /* KIQ event */ | ||
2052 | r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, VISLANDS30_IV_SRCID_CP_INT_IB2, &adev->gfx.kiq.irq); | ||
2053 | if (r) | ||
2054 | return r; | ||
2055 | |||
2056 | /* EOP Event */ | 2048 | /* EOP Event */ |
2057 | r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, VISLANDS30_IV_SRCID_CP_END_OF_PIPE, &adev->gfx.eop_irq); | 2049 | r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, VISLANDS30_IV_SRCID_CP_END_OF_PIPE, &adev->gfx.eop_irq); |
2058 | if (r) | 2050 | if (r) |
@@ -4181,45 +4173,11 @@ static void gfx_v8_0_rlc_start(struct amdgpu_device *adev) | |||
4181 | udelay(50); | 4173 | udelay(50); |
4182 | } | 4174 | } |
4183 | 4175 | ||
4184 | static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) | ||
4185 | { | ||
4186 | const struct rlc_firmware_header_v2_0 *hdr; | ||
4187 | const __le32 *fw_data; | ||
4188 | unsigned i, fw_size; | ||
4189 | |||
4190 | if (!adev->gfx.rlc_fw) | ||
4191 | return -EINVAL; | ||
4192 | |||
4193 | hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; | ||
4194 | amdgpu_ucode_print_rlc_hdr(&hdr->header); | ||
4195 | |||
4196 | fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + | ||
4197 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | ||
4198 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | ||
4199 | |||
4200 | WREG32(mmRLC_GPM_UCODE_ADDR, 0); | ||
4201 | for (i = 0; i < fw_size; i++) | ||
4202 | WREG32(mmRLC_GPM_UCODE_DATA, le32_to_cpup(fw_data++)); | ||
4203 | WREG32(mmRLC_GPM_UCODE_ADDR, adev->gfx.rlc_fw_version); | ||
4204 | |||
4205 | return 0; | ||
4206 | } | ||
4207 | |||
4208 | static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev) | 4176 | static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev) |
4209 | { | 4177 | { |
4210 | int r; | ||
4211 | |||
4212 | gfx_v8_0_rlc_stop(adev); | 4178 | gfx_v8_0_rlc_stop(adev); |
4213 | gfx_v8_0_rlc_reset(adev); | 4179 | gfx_v8_0_rlc_reset(adev); |
4214 | gfx_v8_0_init_pg(adev); | 4180 | gfx_v8_0_init_pg(adev); |
4215 | |||
4216 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) { | ||
4217 | /* legacy rlc firmware loading */ | ||
4218 | r = gfx_v8_0_rlc_load_microcode(adev); | ||
4219 | if (r) | ||
4220 | return r; | ||
4221 | } | ||
4222 | |||
4223 | gfx_v8_0_rlc_start(adev); | 4181 | gfx_v8_0_rlc_start(adev); |
4224 | 4182 | ||
4225 | return 0; | 4183 | return 0; |
@@ -4245,63 +4203,6 @@ static void gfx_v8_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable) | |||
4245 | udelay(50); | 4203 | udelay(50); |
4246 | } | 4204 | } |
4247 | 4205 | ||
4248 | static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) | ||
4249 | { | ||
4250 | const struct gfx_firmware_header_v1_0 *pfp_hdr; | ||
4251 | const struct gfx_firmware_header_v1_0 *ce_hdr; | ||
4252 | const struct gfx_firmware_header_v1_0 *me_hdr; | ||
4253 | const __le32 *fw_data; | ||
4254 | unsigned i, fw_size; | ||
4255 | |||
4256 | if (!adev->gfx.me_fw || !adev->gfx.pfp_fw || !adev->gfx.ce_fw) | ||
4257 | return -EINVAL; | ||
4258 | |||
4259 | pfp_hdr = (const struct gfx_firmware_header_v1_0 *) | ||
4260 | adev->gfx.pfp_fw->data; | ||
4261 | ce_hdr = (const struct gfx_firmware_header_v1_0 *) | ||
4262 | adev->gfx.ce_fw->data; | ||
4263 | me_hdr = (const struct gfx_firmware_header_v1_0 *) | ||
4264 | adev->gfx.me_fw->data; | ||
4265 | |||
4266 | amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); | ||
4267 | amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); | ||
4268 | amdgpu_ucode_print_gfx_hdr(&me_hdr->header); | ||
4269 | |||
4270 | gfx_v8_0_cp_gfx_enable(adev, false); | ||
4271 | |||
4272 | /* PFP */ | ||
4273 | fw_data = (const __le32 *) | ||
4274 | (adev->gfx.pfp_fw->data + | ||
4275 | le32_to_cpu(pfp_hdr->header.ucode_array_offset_bytes)); | ||
4276 | fw_size = le32_to_cpu(pfp_hdr->header.ucode_size_bytes) / 4; | ||
4277 | WREG32(mmCP_PFP_UCODE_ADDR, 0); | ||
4278 | for (i = 0; i < fw_size; i++) | ||
4279 | WREG32(mmCP_PFP_UCODE_DATA, le32_to_cpup(fw_data++)); | ||
4280 | WREG32(mmCP_PFP_UCODE_ADDR, adev->gfx.pfp_fw_version); | ||
4281 | |||
4282 | /* CE */ | ||
4283 | fw_data = (const __le32 *) | ||
4284 | (adev->gfx.ce_fw->data + | ||
4285 | le32_to_cpu(ce_hdr->header.ucode_array_offset_bytes)); | ||
4286 | fw_size = le32_to_cpu(ce_hdr->header.ucode_size_bytes) / 4; | ||
4287 | WREG32(mmCP_CE_UCODE_ADDR, 0); | ||
4288 | for (i = 0; i < fw_size; i++) | ||
4289 | WREG32(mmCP_CE_UCODE_DATA, le32_to_cpup(fw_data++)); | ||
4290 | WREG32(mmCP_CE_UCODE_ADDR, adev->gfx.ce_fw_version); | ||
4291 | |||
4292 | /* ME */ | ||
4293 | fw_data = (const __le32 *) | ||
4294 | (adev->gfx.me_fw->data + | ||
4295 | le32_to_cpu(me_hdr->header.ucode_array_offset_bytes)); | ||
4296 | fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4; | ||
4297 | WREG32(mmCP_ME_RAM_WADDR, 0); | ||
4298 | for (i = 0; i < fw_size; i++) | ||
4299 | WREG32(mmCP_ME_RAM_DATA, le32_to_cpup(fw_data++)); | ||
4300 | WREG32(mmCP_ME_RAM_WADDR, adev->gfx.me_fw_version); | ||
4301 | |||
4302 | return 0; | ||
4303 | } | ||
4304 | |||
4305 | static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev) | 4206 | static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev) |
4306 | { | 4207 | { |
4307 | u32 count = 0; | 4208 | u32 count = 0; |
@@ -4501,52 +4402,6 @@ static void gfx_v8_0_cp_compute_enable(struct amdgpu_device *adev, bool enable) | |||
4501 | udelay(50); | 4402 | udelay(50); |
4502 | } | 4403 | } |
4503 | 4404 | ||
4504 | static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) | ||
4505 | { | ||
4506 | const struct gfx_firmware_header_v1_0 *mec_hdr; | ||
4507 | const __le32 *fw_data; | ||
4508 | unsigned i, fw_size; | ||
4509 | |||
4510 | if (!adev->gfx.mec_fw) | ||
4511 | return -EINVAL; | ||
4512 | |||
4513 | gfx_v8_0_cp_compute_enable(adev, false); | ||
4514 | |||
4515 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
4516 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); | ||
4517 | |||
4518 | fw_data = (const __le32 *) | ||
4519 | (adev->gfx.mec_fw->data + | ||
4520 | le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes)); | ||
4521 | fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4; | ||
4522 | |||
4523 | /* MEC1 */ | ||
4524 | WREG32(mmCP_MEC_ME1_UCODE_ADDR, 0); | ||
4525 | for (i = 0; i < fw_size; i++) | ||
4526 | WREG32(mmCP_MEC_ME1_UCODE_DATA, le32_to_cpup(fw_data+i)); | ||
4527 | WREG32(mmCP_MEC_ME1_UCODE_ADDR, adev->gfx.mec_fw_version); | ||
4528 | |||
4529 | /* Loading MEC2 firmware is only necessary if MEC2 should run different microcode than MEC1. */ | ||
4530 | if (adev->gfx.mec2_fw) { | ||
4531 | const struct gfx_firmware_header_v1_0 *mec2_hdr; | ||
4532 | |||
4533 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; | ||
4534 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); | ||
4535 | |||
4536 | fw_data = (const __le32 *) | ||
4537 | (adev->gfx.mec2_fw->data + | ||
4538 | le32_to_cpu(mec2_hdr->header.ucode_array_offset_bytes)); | ||
4539 | fw_size = le32_to_cpu(mec2_hdr->header.ucode_size_bytes) / 4; | ||
4540 | |||
4541 | WREG32(mmCP_MEC_ME2_UCODE_ADDR, 0); | ||
4542 | for (i = 0; i < fw_size; i++) | ||
4543 | WREG32(mmCP_MEC_ME2_UCODE_DATA, le32_to_cpup(fw_data+i)); | ||
4544 | WREG32(mmCP_MEC_ME2_UCODE_ADDR, adev->gfx.mec2_fw_version); | ||
4545 | } | ||
4546 | |||
4547 | return 0; | ||
4548 | } | ||
4549 | |||
4550 | /* KIQ functions */ | 4405 | /* KIQ functions */ |
4551 | static void gfx_v8_0_kiq_setting(struct amdgpu_ring *ring) | 4406 | static void gfx_v8_0_kiq_setting(struct amdgpu_ring *ring) |
4552 | { | 4407 | { |
@@ -4872,7 +4727,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
4872 | struct vi_mqd *mqd = ring->mqd_ptr; | 4727 | struct vi_mqd *mqd = ring->mqd_ptr; |
4873 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; | 4728 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
4874 | 4729 | ||
4875 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { | 4730 | if (!adev->in_gpu_reset && !adev->in_suspend) { |
4876 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); | 4731 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); |
4877 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; | 4732 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
4878 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; | 4733 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
@@ -4980,17 +4835,6 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev) | |||
4980 | if (!(adev->flags & AMD_IS_APU)) | 4835 | if (!(adev->flags & AMD_IS_APU)) |
4981 | gfx_v8_0_enable_gui_idle_interrupt(adev, false); | 4836 | gfx_v8_0_enable_gui_idle_interrupt(adev, false); |
4982 | 4837 | ||
4983 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) { | ||
4984 | /* legacy firmware loading */ | ||
4985 | r = gfx_v8_0_cp_gfx_load_microcode(adev); | ||
4986 | if (r) | ||
4987 | return r; | ||
4988 | |||
4989 | r = gfx_v8_0_cp_compute_load_microcode(adev); | ||
4990 | if (r) | ||
4991 | return r; | ||
4992 | } | ||
4993 | |||
4994 | r = gfx_v8_0_kiq_resume(adev); | 4838 | r = gfx_v8_0_kiq_resume(adev); |
4995 | if (r) | 4839 | if (r) |
4996 | return r; | 4840 | return r; |
@@ -5142,19 +4986,12 @@ static int gfx_v8_0_hw_fini(void *handle) | |||
5142 | 4986 | ||
5143 | static int gfx_v8_0_suspend(void *handle) | 4987 | static int gfx_v8_0_suspend(void *handle) |
5144 | { | 4988 | { |
5145 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 4989 | return gfx_v8_0_hw_fini(handle); |
5146 | adev->gfx.in_suspend = true; | ||
5147 | return gfx_v8_0_hw_fini(adev); | ||
5148 | } | 4990 | } |
5149 | 4991 | ||
5150 | static int gfx_v8_0_resume(void *handle) | 4992 | static int gfx_v8_0_resume(void *handle) |
5151 | { | 4993 | { |
5152 | int r; | 4994 | return gfx_v8_0_hw_init(handle); |
5153 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | ||
5154 | |||
5155 | r = gfx_v8_0_hw_init(adev); | ||
5156 | adev->gfx.in_suspend = false; | ||
5157 | return r; | ||
5158 | } | 4995 | } |
5159 | 4996 | ||
5160 | static bool gfx_v8_0_check_soft_reset(void *handle) | 4997 | static bool gfx_v8_0_check_soft_reset(void *handle) |
@@ -7025,52 +6862,6 @@ static int gfx_v8_0_sq_irq(struct amdgpu_device *adev, | |||
7025 | return 0; | 6862 | return 0; |
7026 | } | 6863 | } |
7027 | 6864 | ||
7028 | static int gfx_v8_0_kiq_set_interrupt_state(struct amdgpu_device *adev, | ||
7029 | struct amdgpu_irq_src *src, | ||
7030 | unsigned int type, | ||
7031 | enum amdgpu_interrupt_state state) | ||
7032 | { | ||
7033 | struct amdgpu_ring *ring = &(adev->gfx.kiq.ring); | ||
7034 | |||
7035 | switch (type) { | ||
7036 | case AMDGPU_CP_KIQ_IRQ_DRIVER0: | ||
7037 | WREG32_FIELD(CPC_INT_CNTL, GENERIC2_INT_ENABLE, | ||
7038 | state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1); | ||
7039 | if (ring->me == 1) | ||
7040 | WREG32_FIELD_OFFSET(CP_ME1_PIPE0_INT_CNTL, | ||
7041 | ring->pipe, | ||
7042 | GENERIC2_INT_ENABLE, | ||
7043 | state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1); | ||
7044 | else | ||
7045 | WREG32_FIELD_OFFSET(CP_ME2_PIPE0_INT_CNTL, | ||
7046 | ring->pipe, | ||
7047 | GENERIC2_INT_ENABLE, | ||
7048 | state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1); | ||
7049 | break; | ||
7050 | default: | ||
7051 | BUG(); /* kiq only support GENERIC2_INT now */ | ||
7052 | break; | ||
7053 | } | ||
7054 | return 0; | ||
7055 | } | ||
7056 | |||
7057 | static int gfx_v8_0_kiq_irq(struct amdgpu_device *adev, | ||
7058 | struct amdgpu_irq_src *source, | ||
7059 | struct amdgpu_iv_entry *entry) | ||
7060 | { | ||
7061 | u8 me_id, pipe_id, queue_id; | ||
7062 | struct amdgpu_ring *ring = &(adev->gfx.kiq.ring); | ||
7063 | |||
7064 | me_id = (entry->ring_id & 0x0c) >> 2; | ||
7065 | pipe_id = (entry->ring_id & 0x03) >> 0; | ||
7066 | queue_id = (entry->ring_id & 0x70) >> 4; | ||
7067 | DRM_DEBUG("IH: CPC GENERIC2_INT, me:%d, pipe:%d, queue:%d\n", | ||
7068 | me_id, pipe_id, queue_id); | ||
7069 | |||
7070 | amdgpu_fence_process(ring); | ||
7071 | return 0; | ||
7072 | } | ||
7073 | |||
7074 | static const struct amd_ip_funcs gfx_v8_0_ip_funcs = { | 6865 | static const struct amd_ip_funcs gfx_v8_0_ip_funcs = { |
7075 | .name = "gfx_v8_0", | 6866 | .name = "gfx_v8_0", |
7076 | .early_init = gfx_v8_0_early_init, | 6867 | .early_init = gfx_v8_0_early_init, |
@@ -7221,11 +7012,6 @@ static const struct amdgpu_irq_src_funcs gfx_v8_0_priv_inst_irq_funcs = { | |||
7221 | .process = gfx_v8_0_priv_inst_irq, | 7012 | .process = gfx_v8_0_priv_inst_irq, |
7222 | }; | 7013 | }; |
7223 | 7014 | ||
7224 | static const struct amdgpu_irq_src_funcs gfx_v8_0_kiq_irq_funcs = { | ||
7225 | .set = gfx_v8_0_kiq_set_interrupt_state, | ||
7226 | .process = gfx_v8_0_kiq_irq, | ||
7227 | }; | ||
7228 | |||
7229 | static const struct amdgpu_irq_src_funcs gfx_v8_0_cp_ecc_error_irq_funcs = { | 7015 | static const struct amdgpu_irq_src_funcs gfx_v8_0_cp_ecc_error_irq_funcs = { |
7230 | .set = gfx_v8_0_set_cp_ecc_int_state, | 7016 | .set = gfx_v8_0_set_cp_ecc_int_state, |
7231 | .process = gfx_v8_0_cp_ecc_error_irq, | 7017 | .process = gfx_v8_0_cp_ecc_error_irq, |
@@ -7247,9 +7033,6 @@ static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev) | |||
7247 | adev->gfx.priv_inst_irq.num_types = 1; | 7033 | adev->gfx.priv_inst_irq.num_types = 1; |
7248 | adev->gfx.priv_inst_irq.funcs = &gfx_v8_0_priv_inst_irq_funcs; | 7034 | adev->gfx.priv_inst_irq.funcs = &gfx_v8_0_priv_inst_irq_funcs; |
7249 | 7035 | ||
7250 | adev->gfx.kiq.irq.num_types = AMDGPU_CP_KIQ_IRQ_LAST; | ||
7251 | adev->gfx.kiq.irq.funcs = &gfx_v8_0_kiq_irq_funcs; | ||
7252 | |||
7253 | adev->gfx.cp_ecc_error_irq.num_types = 1; | 7036 | adev->gfx.cp_ecc_error_irq.num_types = 1; |
7254 | adev->gfx.cp_ecc_error_irq.funcs = &gfx_v8_0_cp_ecc_error_irq_funcs; | 7037 | adev->gfx.cp_ecc_error_irq.funcs = &gfx_v8_0_cp_ecc_error_irq_funcs; |
7255 | 7038 | ||