Lines Matching refs:adev
27 static int amdgpu_umc_convert_error_address(struct amdgpu_device *adev, in amdgpu_umc_convert_error_address() argument
31 switch (adev->ip_versions[UMC_HWIP][0]) { in amdgpu_umc_convert_error_address()
33 umc_v6_7_convert_error_address(adev, in amdgpu_umc_convert_error_address()
37 dev_warn(adev->dev, in amdgpu_umc_convert_error_address()
45 int amdgpu_umc_page_retirement_mca(struct amdgpu_device *adev, in amdgpu_umc_page_retirement_mca() argument
52 kcalloc(adev->umc.max_ras_err_cnt_per_query, in amdgpu_umc_page_retirement_mca()
55 dev_warn(adev->dev, in amdgpu_umc_page_retirement_mca()
63 ret = amdgpu_umc_convert_error_address(adev, &err_data, err_addr, in amdgpu_umc_page_retirement_mca()
69 amdgpu_ras_add_bad_pages(adev, err_data.err_addr, in amdgpu_umc_page_retirement_mca()
71 amdgpu_ras_save_bad_pages(adev, NULL); in amdgpu_umc_page_retirement_mca()
79 static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, in amdgpu_umc_do_page_retirement() argument
85 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); in amdgpu_umc_do_page_retirement()
88 kgd2kfd_set_sram_ecc_flag(adev->kfd.dev); in amdgpu_umc_do_page_retirement()
89 ret = amdgpu_dpm_get_ecc_info(adev, (void *)&(con->umc_ecc)); in amdgpu_umc_do_page_retirement()
91 if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops && in amdgpu_umc_do_page_retirement()
92 adev->umc.ras->ras_block.hw_ops->query_ras_error_count) in amdgpu_umc_do_page_retirement()
93 adev->umc.ras->ras_block.hw_ops->query_ras_error_count(adev, ras_error_status); in amdgpu_umc_do_page_retirement()
95 if (adev->umc.ras && adev->umc.ras->ras_block.hw_ops && in amdgpu_umc_do_page_retirement()
96 adev->umc.ras->ras_block.hw_ops->query_ras_error_address && in amdgpu_umc_do_page_retirement()
97 adev->umc.max_ras_err_cnt_per_query) { in amdgpu_umc_do_page_retirement()
99 kcalloc(adev->umc.max_ras_err_cnt_per_query, in amdgpu_umc_do_page_retirement()
106 dev_warn(adev->dev, "Failed to alloc memory for " in amdgpu_umc_do_page_retirement()
112 adev->umc.ras->ras_block.hw_ops->query_ras_error_address(adev, ras_error_status); in amdgpu_umc_do_page_retirement()
115 if (adev->umc.ras && in amdgpu_umc_do_page_retirement()
116 adev->umc.ras->ecc_info_query_ras_error_count) in amdgpu_umc_do_page_retirement()
117 adev->umc.ras->ecc_info_query_ras_error_count(adev, ras_error_status); in amdgpu_umc_do_page_retirement()
119 if (adev->umc.ras && in amdgpu_umc_do_page_retirement()
120 adev->umc.ras->ecc_info_query_ras_error_address && in amdgpu_umc_do_page_retirement()
121 adev->umc.max_ras_err_cnt_per_query) { in amdgpu_umc_do_page_retirement()
123 kcalloc(adev->umc.max_ras_err_cnt_per_query, in amdgpu_umc_do_page_retirement()
130 dev_warn(adev->dev, "Failed to alloc memory for " in amdgpu_umc_do_page_retirement()
136 adev->umc.ras->ecc_info_query_ras_error_address(adev, ras_error_status); in amdgpu_umc_do_page_retirement()
142 dev_info(adev->dev, "%ld uncorrectable hardware errors " in amdgpu_umc_do_page_retirement()
148 amdgpu_ras_add_bad_pages(adev, err_data->err_addr, in amdgpu_umc_do_page_retirement()
150 amdgpu_ras_save_bad_pages(adev, &(err_data->ue_count)); in amdgpu_umc_do_page_retirement()
152 amdgpu_dpm_send_hbm_bad_pages_num(adev, con->eeprom_control.ras_num_recs); in amdgpu_umc_do_page_retirement()
155 amdgpu_dpm_send_hbm_bad_channel_flag(adev, con->eeprom_control.bad_channel_bitmap); in amdgpu_umc_do_page_retirement()
161 amdgpu_ras_reset_gpu(adev); in amdgpu_umc_do_page_retirement()
168 int amdgpu_umc_poison_handler(struct amdgpu_device *adev, bool reset) in amdgpu_umc_poison_handler() argument
172 if (adev->gmc.xgmi.connected_to_cpu || in amdgpu_umc_poison_handler()
173 adev->gmc.is_app_apu) { in amdgpu_umc_poison_handler()
178 kgd2kfd_set_sram_ecc_flag(adev->kfd.dev); in amdgpu_umc_poison_handler()
179 amdgpu_ras_reset_gpu(adev); in amdgpu_umc_poison_handler()
184 if (!amdgpu_sriov_vf(adev)) { in amdgpu_umc_poison_handler()
189 struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head); in amdgpu_umc_poison_handler()
191 ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset); in amdgpu_umc_poison_handler()
198 if (adev->virt.ops && adev->virt.ops->ras_poison_handler) in amdgpu_umc_poison_handler()
199 adev->virt.ops->ras_poison_handler(adev); in amdgpu_umc_poison_handler()
201 dev_warn(adev->dev, in amdgpu_umc_poison_handler()
208 int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, in amdgpu_umc_process_ras_data_cb() argument
212 return amdgpu_umc_do_page_retirement(adev, ras_error_status, entry, true); in amdgpu_umc_process_ras_data_cb()
215 int amdgpu_umc_ras_sw_init(struct amdgpu_device *adev) in amdgpu_umc_ras_sw_init() argument
220 if (!adev->umc.ras) in amdgpu_umc_ras_sw_init()
223 ras = adev->umc.ras; in amdgpu_umc_ras_sw_init()
225 err = amdgpu_ras_register_ras_block(adev, &ras->ras_block); in amdgpu_umc_ras_sw_init()
227 dev_err(adev->dev, "Failed to register umc ras block!\n"); in amdgpu_umc_ras_sw_init()
231 strcpy(adev->umc.ras->ras_block.ras_comm.name, "umc"); in amdgpu_umc_ras_sw_init()
234 adev->umc.ras_if = &ras->ras_block.ras_comm; in amdgpu_umc_ras_sw_init()
245 int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block) in amdgpu_umc_ras_late_init() argument
249 r = amdgpu_ras_block_late_init(adev, ras_block); in amdgpu_umc_ras_late_init()
253 if (amdgpu_ras_is_supported(adev, ras_block->block)) { in amdgpu_umc_ras_late_init()
254 r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); in amdgpu_umc_ras_late_init()
260 if (adev->umc.ras && in amdgpu_umc_ras_late_init()
261 adev->umc.ras->err_cnt_init) in amdgpu_umc_ras_late_init()
262 adev->umc.ras->err_cnt_init(adev); in amdgpu_umc_ras_late_init()
267 amdgpu_ras_block_late_fini(adev, ras_block); in amdgpu_umc_ras_late_init()
271 int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev, in amdgpu_umc_process_ecc_irq() argument
275 struct ras_common_if *ras_if = adev->umc.ras_if; in amdgpu_umc_process_ecc_irq()
285 amdgpu_ras_interrupt_dispatch(adev, &ih_data); in amdgpu_umc_process_ecc_irq()
310 int amdgpu_umc_loop_channels(struct amdgpu_device *adev, in amdgpu_umc_loop_channels() argument
318 if (adev->umc.node_inst_num) { in amdgpu_umc_loop_channels()
320 ret = func(adev, node_inst, umc_inst, ch_inst, data); in amdgpu_umc_loop_channels()
322 dev_err(adev->dev, "Node %d umc %d ch %d func returns %d\n", in amdgpu_umc_loop_channels()
329 ret = func(adev, 0, umc_inst, ch_inst, data); in amdgpu_umc_loop_channels()
331 dev_err(adev->dev, "Umc %d ch %d func returns %d\n", in amdgpu_umc_loop_channels()