1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright (c) 2016-2017 Hisilicon Limited. */
6 static const struct hclge_hw_error hclge_imp_tcm_ecc_int[] = {
9 .msg = "imp_itcm0_ecc_mbit_err",
10 .reset_level = HNAE3_NONE_RESET
13 .msg = "imp_itcm1_ecc_mbit_err",
14 .reset_level = HNAE3_NONE_RESET
17 .msg = "imp_itcm2_ecc_mbit_err",
18 .reset_level = HNAE3_NONE_RESET
21 .msg = "imp_itcm3_ecc_mbit_err",
22 .reset_level = HNAE3_NONE_RESET
25 .msg = "imp_dtcm0_mem0_ecc_mbit_err",
26 .reset_level = HNAE3_NONE_RESET
29 .msg = "imp_dtcm0_mem1_ecc_mbit_err",
30 .reset_level = HNAE3_NONE_RESET
33 .msg = "imp_dtcm1_mem0_ecc_mbit_err",
34 .reset_level = HNAE3_NONE_RESET
37 .msg = "imp_dtcm1_mem1_ecc_mbit_err",
38 .reset_level = HNAE3_NONE_RESET
41 .msg = "imp_itcm4_ecc_mbit_err",
42 .reset_level = HNAE3_NONE_RESET
48 static const struct hclge_hw_error hclge_cmdq_nic_mem_ecc_int[] = {
51 .msg = "cmdq_nic_rx_depth_ecc_mbit_err",
52 .reset_level = HNAE3_NONE_RESET
55 .msg = "cmdq_nic_tx_depth_ecc_mbit_err",
56 .reset_level = HNAE3_NONE_RESET
59 .msg = "cmdq_nic_rx_tail_ecc_mbit_err",
60 .reset_level = HNAE3_NONE_RESET
63 .msg = "cmdq_nic_tx_tail_ecc_mbit_err",
64 .reset_level = HNAE3_NONE_RESET
67 .msg = "cmdq_nic_rx_head_ecc_mbit_err",
68 .reset_level = HNAE3_NONE_RESET
71 .msg = "cmdq_nic_tx_head_ecc_mbit_err",
72 .reset_level = HNAE3_NONE_RESET
75 .msg = "cmdq_nic_rx_addr_ecc_mbit_err",
76 .reset_level = HNAE3_NONE_RESET
79 .msg = "cmdq_nic_tx_addr_ecc_mbit_err",
80 .reset_level = HNAE3_NONE_RESET
83 .msg = "cmdq_rocee_rx_depth_ecc_mbit_err",
84 .reset_level = HNAE3_NONE_RESET
87 .msg = "cmdq_rocee_tx_depth_ecc_mbit_err",
88 .reset_level = HNAE3_NONE_RESET
91 .msg = "cmdq_rocee_rx_tail_ecc_mbit_err",
92 .reset_level = HNAE3_NONE_RESET
95 .msg = "cmdq_rocee_tx_tail_ecc_mbit_err",
96 .reset_level = HNAE3_NONE_RESET
99 .msg = "cmdq_rocee_rx_head_ecc_mbit_err",
100 .reset_level = HNAE3_NONE_RESET
103 .msg = "cmdq_rocee_tx_head_ecc_mbit_err",
104 .reset_level = HNAE3_NONE_RESET
107 .msg = "cmdq_rocee_rx_addr_ecc_mbit_err",
108 .reset_level = HNAE3_NONE_RESET
111 .msg = "cmdq_rocee_tx_addr_ecc_mbit_err",
112 .reset_level = HNAE3_NONE_RESET
118 static const struct hclge_hw_error hclge_tqp_int_ecc_int[] = {
121 .msg = "tqp_int_cfg_even_ecc_mbit_err",
122 .reset_level = HNAE3_NONE_RESET
125 .msg = "tqp_int_cfg_odd_ecc_mbit_err",
126 .reset_level = HNAE3_NONE_RESET
129 .msg = "tqp_int_ctrl_even_ecc_mbit_err",
130 .reset_level = HNAE3_NONE_RESET
133 .msg = "tqp_int_ctrl_odd_ecc_mbit_err",
134 .reset_level = HNAE3_NONE_RESET
137 .msg = "tx_que_scan_int_ecc_mbit_err",
138 .reset_level = HNAE3_NONE_RESET
141 .msg = "rx_que_scan_int_ecc_mbit_err",
142 .reset_level = HNAE3_NONE_RESET
148 static const struct hclge_hw_error hclge_msix_sram_ecc_int[] = {
151 .msg = "msix_nic_ecc_mbit_err",
152 .reset_level = HNAE3_NONE_RESET
155 .msg = "msix_rocee_ecc_mbit_err",
156 .reset_level = HNAE3_NONE_RESET
162 static const struct hclge_hw_error hclge_igu_int[] = {
165 .msg = "igu_rx_buf0_ecc_mbit_err",
166 .reset_level = HNAE3_GLOBAL_RESET
169 .msg = "igu_rx_buf1_ecc_mbit_err",
170 .reset_level = HNAE3_GLOBAL_RESET
176 static const struct hclge_hw_error hclge_igu_egu_tnl_int[] = {
179 .msg = "rx_buf_overflow",
180 .reset_level = HNAE3_GLOBAL_RESET
183 .msg = "rx_stp_fifo_overflow",
184 .reset_level = HNAE3_GLOBAL_RESET
187 .msg = "rx_stp_fifo_underflow",
188 .reset_level = HNAE3_GLOBAL_RESET
191 .msg = "tx_buf_overflow",
192 .reset_level = HNAE3_GLOBAL_RESET
195 .msg = "tx_buf_underrun",
196 .reset_level = HNAE3_GLOBAL_RESET
199 .msg = "rx_stp_buf_overflow",
200 .reset_level = HNAE3_GLOBAL_RESET
206 static const struct hclge_hw_error hclge_ncsi_err_int[] = {
209 .msg = "ncsi_tx_ecc_mbit_err",
210 .reset_level = HNAE3_NONE_RESET
216 static const struct hclge_hw_error hclge_ppp_mpf_abnormal_int_st1[] = {
219 .msg = "vf_vlan_ad_mem_ecc_mbit_err",
220 .reset_level = HNAE3_GLOBAL_RESET
223 .msg = "umv_mcast_group_mem_ecc_mbit_err",
224 .reset_level = HNAE3_GLOBAL_RESET
227 .msg = "umv_key_mem0_ecc_mbit_err",
228 .reset_level = HNAE3_GLOBAL_RESET
231 .msg = "umv_key_mem1_ecc_mbit_err",
232 .reset_level = HNAE3_GLOBAL_RESET
235 .msg = "umv_key_mem2_ecc_mbit_err",
236 .reset_level = HNAE3_GLOBAL_RESET
239 .msg = "umv_key_mem3_ecc_mbit_err",
240 .reset_level = HNAE3_GLOBAL_RESET
243 .msg = "umv_ad_mem_ecc_mbit_err",
244 .reset_level = HNAE3_GLOBAL_RESET
247 .msg = "rss_tc_mode_mem_ecc_mbit_err",
248 .reset_level = HNAE3_GLOBAL_RESET
251 .msg = "rss_idt_mem0_ecc_mbit_err",
252 .reset_level = HNAE3_GLOBAL_RESET
255 .msg = "rss_idt_mem1_ecc_mbit_err",
256 .reset_level = HNAE3_GLOBAL_RESET
259 .msg = "rss_idt_mem2_ecc_mbit_err",
260 .reset_level = HNAE3_GLOBAL_RESET
263 .msg = "rss_idt_mem3_ecc_mbit_err",
264 .reset_level = HNAE3_GLOBAL_RESET
267 .msg = "rss_idt_mem4_ecc_mbit_err",
268 .reset_level = HNAE3_GLOBAL_RESET
271 .msg = "rss_idt_mem5_ecc_mbit_err",
272 .reset_level = HNAE3_GLOBAL_RESET
275 .msg = "rss_idt_mem6_ecc_mbit_err",
276 .reset_level = HNAE3_GLOBAL_RESET
279 .msg = "rss_idt_mem7_ecc_mbit_err",
280 .reset_level = HNAE3_GLOBAL_RESET
283 .msg = "rss_idt_mem8_ecc_mbit_err",
284 .reset_level = HNAE3_GLOBAL_RESET
287 .msg = "rss_idt_mem9_ecc_mbit_err",
288 .reset_level = HNAE3_GLOBAL_RESET
291 .msg = "rss_idt_mem10_ecc_mbit_err",
292 .reset_level = HNAE3_GLOBAL_RESET
295 .msg = "rss_idt_mem11_ecc_mbit_err",
296 .reset_level = HNAE3_GLOBAL_RESET
299 .msg = "rss_idt_mem12_ecc_mbit_err",
300 .reset_level = HNAE3_GLOBAL_RESET
303 .msg = "rss_idt_mem13_ecc_mbit_err",
304 .reset_level = HNAE3_GLOBAL_RESET
307 .msg = "rss_idt_mem14_ecc_mbit_err",
308 .reset_level = HNAE3_GLOBAL_RESET
311 .msg = "rss_idt_mem15_ecc_mbit_err",
312 .reset_level = HNAE3_GLOBAL_RESET
315 .msg = "port_vlan_mem_ecc_mbit_err",
316 .reset_level = HNAE3_GLOBAL_RESET
319 .msg = "mcast_linear_table_mem_ecc_mbit_err",
320 .reset_level = HNAE3_GLOBAL_RESET
323 .msg = "mcast_result_mem_ecc_mbit_err",
324 .reset_level = HNAE3_GLOBAL_RESET
327 .msg = "flow_director_ad_mem0_ecc_mbit_err",
328 .reset_level = HNAE3_GLOBAL_RESET
331 .msg = "flow_director_ad_mem1_ecc_mbit_err",
332 .reset_level = HNAE3_GLOBAL_RESET
335 .msg = "rx_vlan_tag_memory_ecc_mbit_err",
336 .reset_level = HNAE3_GLOBAL_RESET
339 .msg = "Tx_UP_mapping_config_mem_ecc_mbit_err",
340 .reset_level = HNAE3_GLOBAL_RESET
346 static const struct hclge_hw_error hclge_ppp_pf_abnormal_int[] = {
349 .msg = "tx_vlan_tag_err",
350 .reset_level = HNAE3_NONE_RESET
353 .msg = "rss_list_tc_unassigned_queue_err",
354 .reset_level = HNAE3_NONE_RESET
360 static const struct hclge_hw_error hclge_ppp_mpf_abnormal_int_st3[] = {
363 .msg = "hfs_fifo_mem_ecc_mbit_err",
364 .reset_level = HNAE3_GLOBAL_RESET
367 .msg = "rslt_descr_fifo_mem_ecc_mbit_err",
368 .reset_level = HNAE3_GLOBAL_RESET
371 .msg = "tx_vlan_tag_mem_ecc_mbit_err",
372 .reset_level = HNAE3_GLOBAL_RESET
375 .msg = "FD_CN0_memory_ecc_mbit_err",
376 .reset_level = HNAE3_GLOBAL_RESET
379 .msg = "FD_CN1_memory_ecc_mbit_err",
380 .reset_level = HNAE3_GLOBAL_RESET
383 .msg = "GRO_AD_memory_ecc_mbit_err",
384 .reset_level = HNAE3_GLOBAL_RESET
390 static const struct hclge_hw_error hclge_tm_sch_rint[] = {
393 .msg = "tm_sch_ecc_mbit_err",
394 .reset_level = HNAE3_GLOBAL_RESET
397 .msg = "tm_sch_port_shap_sub_fifo_wr_err",
398 .reset_level = HNAE3_GLOBAL_RESET
401 .msg = "tm_sch_port_shap_sub_fifo_rd_err",
402 .reset_level = HNAE3_GLOBAL_RESET
405 .msg = "tm_sch_pg_pshap_sub_fifo_wr_err",
406 .reset_level = HNAE3_GLOBAL_RESET
409 .msg = "tm_sch_pg_pshap_sub_fifo_rd_err",
410 .reset_level = HNAE3_GLOBAL_RESET
413 .msg = "tm_sch_pg_cshap_sub_fifo_wr_err",
414 .reset_level = HNAE3_GLOBAL_RESET
417 .msg = "tm_sch_pg_cshap_sub_fifo_rd_err",
418 .reset_level = HNAE3_GLOBAL_RESET
421 .msg = "tm_sch_pri_pshap_sub_fifo_wr_err",
422 .reset_level = HNAE3_GLOBAL_RESET
425 .msg = "tm_sch_pri_pshap_sub_fifo_rd_err",
426 .reset_level = HNAE3_GLOBAL_RESET
429 .msg = "tm_sch_pri_cshap_sub_fifo_wr_err",
430 .reset_level = HNAE3_GLOBAL_RESET
433 .msg = "tm_sch_pri_cshap_sub_fifo_rd_err",
434 .reset_level = HNAE3_GLOBAL_RESET
437 .msg = "tm_sch_port_shap_offset_fifo_wr_err",
438 .reset_level = HNAE3_GLOBAL_RESET
441 .msg = "tm_sch_port_shap_offset_fifo_rd_err",
442 .reset_level = HNAE3_GLOBAL_RESET
445 .msg = "tm_sch_pg_pshap_offset_fifo_wr_err",
446 .reset_level = HNAE3_GLOBAL_RESET
449 .msg = "tm_sch_pg_pshap_offset_fifo_rd_err",
450 .reset_level = HNAE3_GLOBAL_RESET
453 .msg = "tm_sch_pg_cshap_offset_fifo_wr_err",
454 .reset_level = HNAE3_GLOBAL_RESET
457 .msg = "tm_sch_pg_cshap_offset_fifo_rd_err",
458 .reset_level = HNAE3_GLOBAL_RESET
461 .msg = "tm_sch_pri_pshap_offset_fifo_wr_err",
462 .reset_level = HNAE3_GLOBAL_RESET
465 .msg = "tm_sch_pri_pshap_offset_fifo_rd_err",
466 .reset_level = HNAE3_GLOBAL_RESET
469 .msg = "tm_sch_pri_cshap_offset_fifo_wr_err",
470 .reset_level = HNAE3_GLOBAL_RESET
473 .msg = "tm_sch_pri_cshap_offset_fifo_rd_err",
474 .reset_level = HNAE3_GLOBAL_RESET
477 .msg = "tm_sch_rq_fifo_wr_err",
478 .reset_level = HNAE3_GLOBAL_RESET
481 .msg = "tm_sch_rq_fifo_rd_err",
482 .reset_level = HNAE3_GLOBAL_RESET
485 .msg = "tm_sch_nq_fifo_wr_err",
486 .reset_level = HNAE3_GLOBAL_RESET
489 .msg = "tm_sch_nq_fifo_rd_err",
490 .reset_level = HNAE3_GLOBAL_RESET
493 .msg = "tm_sch_roce_up_fifo_wr_err",
494 .reset_level = HNAE3_GLOBAL_RESET
497 .msg = "tm_sch_roce_up_fifo_rd_err",
498 .reset_level = HNAE3_GLOBAL_RESET
501 .msg = "tm_sch_rcb_byte_fifo_wr_err",
502 .reset_level = HNAE3_GLOBAL_RESET
505 .msg = "tm_sch_rcb_byte_fifo_rd_err",
506 .reset_level = HNAE3_GLOBAL_RESET
509 .msg = "tm_sch_ssu_byte_fifo_wr_err",
510 .reset_level = HNAE3_GLOBAL_RESET
513 .msg = "tm_sch_ssu_byte_fifo_rd_err",
514 .reset_level = HNAE3_GLOBAL_RESET
520 static const struct hclge_hw_error hclge_qcn_fifo_rint[] = {
523 .msg = "qcn_shap_gp0_sch_fifo_rd_err",
524 .reset_level = HNAE3_GLOBAL_RESET
527 .msg = "qcn_shap_gp0_sch_fifo_wr_err",
528 .reset_level = HNAE3_GLOBAL_RESET
531 .msg = "qcn_shap_gp1_sch_fifo_rd_err",
532 .reset_level = HNAE3_GLOBAL_RESET
535 .msg = "qcn_shap_gp1_sch_fifo_wr_err",
536 .reset_level = HNAE3_GLOBAL_RESET
539 .msg = "qcn_shap_gp2_sch_fifo_rd_err",
540 .reset_level = HNAE3_GLOBAL_RESET
543 .msg = "qcn_shap_gp2_sch_fifo_wr_err",
544 .reset_level = HNAE3_GLOBAL_RESET
547 .msg = "qcn_shap_gp3_sch_fifo_rd_err",
548 .reset_level = HNAE3_GLOBAL_RESET
551 .msg = "qcn_shap_gp3_sch_fifo_wr_err",
552 .reset_level = HNAE3_GLOBAL_RESET
555 .msg = "qcn_shap_gp0_offset_fifo_rd_err",
556 .reset_level = HNAE3_GLOBAL_RESET
559 .msg = "qcn_shap_gp0_offset_fifo_wr_err",
560 .reset_level = HNAE3_GLOBAL_RESET
563 .msg = "qcn_shap_gp1_offset_fifo_rd_err",
564 .reset_level = HNAE3_GLOBAL_RESET
567 .msg = "qcn_shap_gp1_offset_fifo_wr_err",
568 .reset_level = HNAE3_GLOBAL_RESET
571 .msg = "qcn_shap_gp2_offset_fifo_rd_err",
572 .reset_level = HNAE3_GLOBAL_RESET
575 .msg = "qcn_shap_gp2_offset_fifo_wr_err",
576 .reset_level = HNAE3_GLOBAL_RESET
579 .msg = "qcn_shap_gp3_offset_fifo_rd_err",
580 .reset_level = HNAE3_GLOBAL_RESET
583 .msg = "qcn_shap_gp3_offset_fifo_wr_err",
584 .reset_level = HNAE3_GLOBAL_RESET
587 .msg = "qcn_byte_info_fifo_rd_err",
588 .reset_level = HNAE3_GLOBAL_RESET
591 .msg = "qcn_byte_info_fifo_wr_err",
592 .reset_level = HNAE3_GLOBAL_RESET
598 static const struct hclge_hw_error hclge_qcn_ecc_rint[] = {
601 .msg = "qcn_byte_mem_ecc_mbit_err",
602 .reset_level = HNAE3_GLOBAL_RESET
605 .msg = "qcn_time_mem_ecc_mbit_err",
606 .reset_level = HNAE3_GLOBAL_RESET
609 .msg = "qcn_fb_mem_ecc_mbit_err",
610 .reset_level = HNAE3_GLOBAL_RESET
613 .msg = "qcn_link_mem_ecc_mbit_err",
614 .reset_level = HNAE3_GLOBAL_RESET
617 .msg = "qcn_rate_mem_ecc_mbit_err",
618 .reset_level = HNAE3_GLOBAL_RESET
621 .msg = "qcn_tmplt_mem_ecc_mbit_err",
622 .reset_level = HNAE3_GLOBAL_RESET
625 .msg = "qcn_shap_cfg_mem_ecc_mbit_err",
626 .reset_level = HNAE3_GLOBAL_RESET
629 .msg = "qcn_gp0_barrel_mem_ecc_mbit_err",
630 .reset_level = HNAE3_GLOBAL_RESET
633 .msg = "qcn_gp1_barrel_mem_ecc_mbit_err",
634 .reset_level = HNAE3_GLOBAL_RESET
637 .msg = "qcn_gp2_barrel_mem_ecc_mbit_err",
638 .reset_level = HNAE3_GLOBAL_RESET
641 .msg = "qcn_gp3_barral_mem_ecc_mbit_err",
642 .reset_level = HNAE3_GLOBAL_RESET
648 static const struct hclge_hw_error hclge_mac_afifo_tnl_int[] = {
651 .msg = "egu_cge_afifo_ecc_1bit_err",
652 .reset_level = HNAE3_NONE_RESET
655 .msg = "egu_cge_afifo_ecc_mbit_err",
656 .reset_level = HNAE3_GLOBAL_RESET
659 .msg = "egu_lge_afifo_ecc_1bit_err",
660 .reset_level = HNAE3_NONE_RESET
663 .msg = "egu_lge_afifo_ecc_mbit_err",
664 .reset_level = HNAE3_GLOBAL_RESET
667 .msg = "cge_igu_afifo_ecc_1bit_err",
668 .reset_level = HNAE3_NONE_RESET
671 .msg = "cge_igu_afifo_ecc_mbit_err",
672 .reset_level = HNAE3_GLOBAL_RESET
675 .msg = "lge_igu_afifo_ecc_1bit_err",
676 .reset_level = HNAE3_NONE_RESET
679 .msg = "lge_igu_afifo_ecc_mbit_err",
680 .reset_level = HNAE3_GLOBAL_RESET
683 .msg = "cge_igu_afifo_overflow_err",
684 .reset_level = HNAE3_GLOBAL_RESET
687 .msg = "lge_igu_afifo_overflow_err",
688 .reset_level = HNAE3_GLOBAL_RESET
691 .msg = "egu_cge_afifo_underrun_err",
692 .reset_level = HNAE3_GLOBAL_RESET
695 .msg = "egu_lge_afifo_underrun_err",
696 .reset_level = HNAE3_GLOBAL_RESET
699 .msg = "egu_ge_afifo_underrun_err",
700 .reset_level = HNAE3_GLOBAL_RESET
703 .msg = "ge_igu_afifo_overflow_err",
704 .reset_level = HNAE3_GLOBAL_RESET
710 static const struct hclge_hw_error hclge_ppu_mpf_abnormal_int_st2[] = {
713 .msg = "rpu_rx_pkt_bit32_ecc_mbit_err",
714 .reset_level = HNAE3_GLOBAL_RESET
717 .msg = "rpu_rx_pkt_bit33_ecc_mbit_err",
718 .reset_level = HNAE3_GLOBAL_RESET
721 .msg = "rpu_rx_pkt_bit34_ecc_mbit_err",
722 .reset_level = HNAE3_GLOBAL_RESET
725 .msg = "rpu_rx_pkt_bit35_ecc_mbit_err",
726 .reset_level = HNAE3_GLOBAL_RESET
729 .msg = "rcb_tx_ring_ecc_mbit_err",
730 .reset_level = HNAE3_GLOBAL_RESET
733 .msg = "rcb_rx_ring_ecc_mbit_err",
734 .reset_level = HNAE3_GLOBAL_RESET
737 .msg = "rcb_tx_fbd_ecc_mbit_err",
738 .reset_level = HNAE3_GLOBAL_RESET
741 .msg = "rcb_rx_ebd_ecc_mbit_err",
742 .reset_level = HNAE3_GLOBAL_RESET
745 .msg = "rcb_tso_info_ecc_mbit_err",
746 .reset_level = HNAE3_GLOBAL_RESET
749 .msg = "rcb_tx_int_info_ecc_mbit_err",
750 .reset_level = HNAE3_GLOBAL_RESET
753 .msg = "rcb_rx_int_info_ecc_mbit_err",
754 .reset_level = HNAE3_GLOBAL_RESET
757 .msg = "tpu_tx_pkt_0_ecc_mbit_err",
758 .reset_level = HNAE3_GLOBAL_RESET
761 .msg = "tpu_tx_pkt_1_ecc_mbit_err",
762 .reset_level = HNAE3_GLOBAL_RESET
766 .reset_level = HNAE3_GLOBAL_RESET
770 .reset_level = HNAE3_GLOBAL_RESET
773 .msg = "reg_search_miss",
774 .reset_level = HNAE3_GLOBAL_RESET
777 .msg = "rx_q_search_miss",
778 .reset_level = HNAE3_NONE_RESET
781 .msg = "ooo_ecc_err_detect",
782 .reset_level = HNAE3_NONE_RESET
785 .msg = "ooo_ecc_err_multpl",
786 .reset_level = HNAE3_GLOBAL_RESET
792 static const struct hclge_hw_error hclge_ppu_mpf_abnormal_int_st3[] = {
795 .msg = "gro_bd_ecc_mbit_err",
796 .reset_level = HNAE3_GLOBAL_RESET
799 .msg = "gro_context_ecc_mbit_err",
800 .reset_level = HNAE3_GLOBAL_RESET
803 .msg = "rx_stash_cfg_ecc_mbit_err",
804 .reset_level = HNAE3_GLOBAL_RESET
807 .msg = "axi_rd_fbd_ecc_mbit_err",
808 .reset_level = HNAE3_GLOBAL_RESET
814 static const struct hclge_hw_error hclge_ppu_pf_abnormal_int[] = {
817 .msg = "over_8bd_no_fe",
818 .reset_level = HNAE3_FUNC_RESET
821 .msg = "tso_mss_cmp_min_err",
822 .reset_level = HNAE3_NONE_RESET
825 .msg = "tso_mss_cmp_max_err",
826 .reset_level = HNAE3_NONE_RESET
829 .msg = "tx_rd_fbd_poison",
830 .reset_level = HNAE3_FUNC_RESET
833 .msg = "rx_rd_ebd_poison",
834 .reset_level = HNAE3_FUNC_RESET
837 .msg = "buf_wait_timeout",
838 .reset_level = HNAE3_NONE_RESET
844 static const struct hclge_hw_error hclge_ssu_com_err_int[] = {
847 .msg = "buf_sum_err",
848 .reset_level = HNAE3_NONE_RESET
851 .msg = "ppp_mb_num_err",
852 .reset_level = HNAE3_NONE_RESET
855 .msg = "ppp_mbid_err",
856 .reset_level = HNAE3_GLOBAL_RESET
859 .msg = "ppp_rlt_mac_err",
860 .reset_level = HNAE3_GLOBAL_RESET
863 .msg = "ppp_rlt_host_err",
864 .reset_level = HNAE3_GLOBAL_RESET
867 .msg = "cks_edit_position_err",
868 .reset_level = HNAE3_GLOBAL_RESET
871 .msg = "cks_edit_condition_err",
872 .reset_level = HNAE3_GLOBAL_RESET
875 .msg = "vlan_edit_condition_err",
876 .reset_level = HNAE3_GLOBAL_RESET
879 .msg = "vlan_num_ot_err",
880 .reset_level = HNAE3_GLOBAL_RESET
883 .msg = "vlan_num_in_err",
884 .reset_level = HNAE3_GLOBAL_RESET
890 #define HCLGE_SSU_MEM_ECC_ERR(x) \
893 .msg = "ssu_mem" #x "_ecc_mbit_err", \
894 .reset_level = HNAE3_GLOBAL_RESET \
897 static const struct hclge_hw_error hclge_ssu_mem_ecc_err_int[] = {
898 HCLGE_SSU_MEM_ECC_ERR(0),
899 HCLGE_SSU_MEM_ECC_ERR(1),
900 HCLGE_SSU_MEM_ECC_ERR(2),
901 HCLGE_SSU_MEM_ECC_ERR(3),
902 HCLGE_SSU_MEM_ECC_ERR(4),
903 HCLGE_SSU_MEM_ECC_ERR(5),
904 HCLGE_SSU_MEM_ECC_ERR(6),
905 HCLGE_SSU_MEM_ECC_ERR(7),
906 HCLGE_SSU_MEM_ECC_ERR(8),
907 HCLGE_SSU_MEM_ECC_ERR(9),
908 HCLGE_SSU_MEM_ECC_ERR(10),
909 HCLGE_SSU_MEM_ECC_ERR(11),
910 HCLGE_SSU_MEM_ECC_ERR(12),
911 HCLGE_SSU_MEM_ECC_ERR(13),
912 HCLGE_SSU_MEM_ECC_ERR(14),
913 HCLGE_SSU_MEM_ECC_ERR(15),
914 HCLGE_SSU_MEM_ECC_ERR(16),
915 HCLGE_SSU_MEM_ECC_ERR(17),
916 HCLGE_SSU_MEM_ECC_ERR(18),
917 HCLGE_SSU_MEM_ECC_ERR(19),
918 HCLGE_SSU_MEM_ECC_ERR(20),
919 HCLGE_SSU_MEM_ECC_ERR(21),
920 HCLGE_SSU_MEM_ECC_ERR(22),
921 HCLGE_SSU_MEM_ECC_ERR(23),
922 HCLGE_SSU_MEM_ECC_ERR(24),
923 HCLGE_SSU_MEM_ECC_ERR(25),
924 HCLGE_SSU_MEM_ECC_ERR(26),
925 HCLGE_SSU_MEM_ECC_ERR(27),
926 HCLGE_SSU_MEM_ECC_ERR(28),
927 HCLGE_SSU_MEM_ECC_ERR(29),
928 HCLGE_SSU_MEM_ECC_ERR(30),
929 HCLGE_SSU_MEM_ECC_ERR(31),
933 static const struct hclge_hw_error hclge_ssu_port_based_err_int[] = {
936 .msg = "roc_pkt_without_key_port",
937 .reset_level = HNAE3_FUNC_RESET
940 .msg = "tpu_pkt_without_key_port",
941 .reset_level = HNAE3_GLOBAL_RESET
944 .msg = "igu_pkt_without_key_port",
945 .reset_level = HNAE3_GLOBAL_RESET
948 .msg = "roc_eof_mis_match_port",
949 .reset_level = HNAE3_GLOBAL_RESET
952 .msg = "tpu_eof_mis_match_port",
953 .reset_level = HNAE3_GLOBAL_RESET
956 .msg = "igu_eof_mis_match_port",
957 .reset_level = HNAE3_GLOBAL_RESET
960 .msg = "roc_sof_mis_match_port",
961 .reset_level = HNAE3_GLOBAL_RESET
964 .msg = "tpu_sof_mis_match_port",
965 .reset_level = HNAE3_GLOBAL_RESET
968 .msg = "igu_sof_mis_match_port",
969 .reset_level = HNAE3_GLOBAL_RESET
972 .msg = "ets_rd_int_rx_port",
973 .reset_level = HNAE3_GLOBAL_RESET
976 .msg = "ets_wr_int_rx_port",
977 .reset_level = HNAE3_GLOBAL_RESET
980 .msg = "ets_rd_int_tx_port",
981 .reset_level = HNAE3_GLOBAL_RESET
984 .msg = "ets_wr_int_tx_port",
985 .reset_level = HNAE3_GLOBAL_RESET
991 static const struct hclge_hw_error hclge_ssu_fifo_overflow_int[] = {
994 .msg = "ig_mac_inf_int",
995 .reset_level = HNAE3_GLOBAL_RESET
998 .msg = "ig_host_inf_int",
999 .reset_level = HNAE3_GLOBAL_RESET
1002 .msg = "ig_roc_buf_int",
1003 .reset_level = HNAE3_GLOBAL_RESET
1006 .msg = "ig_host_data_fifo_int",
1007 .reset_level = HNAE3_GLOBAL_RESET
1010 .msg = "ig_host_key_fifo_int",
1011 .reset_level = HNAE3_GLOBAL_RESET
1014 .msg = "tx_qcn_fifo_int",
1015 .reset_level = HNAE3_GLOBAL_RESET
1018 .msg = "rx_qcn_fifo_int",
1019 .reset_level = HNAE3_GLOBAL_RESET
1022 .msg = "tx_pf_rd_fifo_int",
1023 .reset_level = HNAE3_GLOBAL_RESET
1026 .msg = "rx_pf_rd_fifo_int",
1027 .reset_level = HNAE3_GLOBAL_RESET
1030 .msg = "qm_eof_fifo_int",
1031 .reset_level = HNAE3_GLOBAL_RESET
1034 .msg = "mb_rlt_fifo_int",
1035 .reset_level = HNAE3_GLOBAL_RESET
1038 .msg = "dup_uncopy_fifo_int",
1039 .reset_level = HNAE3_GLOBAL_RESET
1042 .msg = "dup_cnt_rd_fifo_int",
1043 .reset_level = HNAE3_GLOBAL_RESET
1046 .msg = "dup_cnt_drop_fifo_int",
1047 .reset_level = HNAE3_GLOBAL_RESET
1050 .msg = "dup_cnt_wrb_fifo_int",
1051 .reset_level = HNAE3_GLOBAL_RESET
1054 .msg = "host_cmd_fifo_int",
1055 .reset_level = HNAE3_GLOBAL_RESET
1058 .msg = "mac_cmd_fifo_int",
1059 .reset_level = HNAE3_GLOBAL_RESET
1062 .msg = "host_cmd_bitmap_empty_int",
1063 .reset_level = HNAE3_GLOBAL_RESET
1066 .msg = "mac_cmd_bitmap_empty_int",
1067 .reset_level = HNAE3_GLOBAL_RESET
1070 .msg = "dup_bitmap_empty_int",
1071 .reset_level = HNAE3_GLOBAL_RESET
1074 .msg = "out_queue_bitmap_empty_int",
1075 .reset_level = HNAE3_GLOBAL_RESET
1078 .msg = "bank2_bitmap_empty_int",
1079 .reset_level = HNAE3_GLOBAL_RESET
1082 .msg = "bank1_bitmap_empty_int",
1083 .reset_level = HNAE3_GLOBAL_RESET
1086 .msg = "bank0_bitmap_empty_int",
1087 .reset_level = HNAE3_GLOBAL_RESET
1093 static const struct hclge_hw_error hclge_ssu_ets_tcg_int[] = {
1096 .msg = "ets_rd_int_rx_tcg",
1097 .reset_level = HNAE3_GLOBAL_RESET
1100 .msg = "ets_wr_int_rx_tcg",
1101 .reset_level = HNAE3_GLOBAL_RESET
1104 .msg = "ets_rd_int_tx_tcg",
1105 .reset_level = HNAE3_GLOBAL_RESET
1108 .msg = "ets_wr_int_tx_tcg",
1109 .reset_level = HNAE3_GLOBAL_RESET
1115 static const struct hclge_hw_error hclge_ssu_port_based_pf_int[] = {
1118 .msg = "roc_pkt_without_key_port",
1119 .reset_level = HNAE3_FUNC_RESET
1122 .msg = "low_water_line_err_port",
1123 .reset_level = HNAE3_NONE_RESET
1126 .msg = "hi_water_line_err_port",
1127 .reset_level = HNAE3_GLOBAL_RESET
1133 static const struct hclge_hw_error hclge_rocee_qmm_ovf_err_int[] = {
1136 .msg = "rocee qmm ovf: sgid invalid err"
1139 .msg = "rocee qmm ovf: sgid ovf err"
1142 .msg = "rocee qmm ovf: smac invalid err"
1145 .msg = "rocee qmm ovf: smac ovf err"
1148 .msg = "rocee qmm ovf: cqc invalid err"
1151 .msg = "rocee qmm ovf: cqc ovf err"
1154 .msg = "rocee qmm ovf: cqc hopnum err"
1157 .msg = "rocee qmm ovf: cqc ba0 err"
1160 .msg = "rocee qmm ovf: srqc invalid err"
1163 .msg = "rocee qmm ovf: srqc ovf err"
1166 .msg = "rocee qmm ovf: srqc hopnum err"
1169 .msg = "rocee qmm ovf: srqc ba0 err"
1172 .msg = "rocee qmm ovf: mpt invalid err"
1175 .msg = "rocee qmm ovf: mpt ovf err"
1178 .msg = "rocee qmm ovf: mpt hopnum err"
1181 .msg = "rocee qmm ovf: mpt ba0 err"
1184 .msg = "rocee qmm ovf: qpc invalid err"
1187 .msg = "rocee qmm ovf: qpc ovf err"
1190 .msg = "rocee qmm ovf: qpc hopnum err"
1193 .msg = "rocee qmm ovf: qpc ba0 err"
1199 static const struct hclge_hw_module_id hclge_hw_module_id_st[] = {
1201 .module_id = MODULE_NONE,
1202 .msg = "MODULE_NONE"
1204 .module_id = MODULE_BIOS_COMMON,
1205 .msg = "MODULE_BIOS_COMMON"
1207 .module_id = MODULE_GE,
1210 .module_id = MODULE_IGU_EGU,
1211 .msg = "MODULE_IGU_EGU"
1213 .module_id = MODULE_LGE,
1216 .module_id = MODULE_NCSI,
1217 .msg = "MODULE_NCSI"
1219 .module_id = MODULE_PPP,
1222 .module_id = MODULE_QCN,
1225 .module_id = MODULE_RCB_RX,
1226 .msg = "MODULE_RCB_RX"
1228 .module_id = MODULE_RTC,
1231 .module_id = MODULE_SSU,
1234 .module_id = MODULE_TM,
1237 .module_id = MODULE_RCB_TX,
1238 .msg = "MODULE_RCB_TX"
1240 .module_id = MODULE_TXDMA,
1241 .msg = "MODULE_TXDMA"
1243 .module_id = MODULE_MASTER,
1244 .msg = "MODULE_MASTER"
1246 .module_id = MODULE_ROCEE_TOP,
1247 .msg = "MODULE_ROCEE_TOP"
1249 .module_id = MODULE_ROCEE_TIMER,
1250 .msg = "MODULE_ROCEE_TIMER"
1252 .module_id = MODULE_ROCEE_MDB,
1253 .msg = "MODULE_ROCEE_MDB"
1255 .module_id = MODULE_ROCEE_TSP,
1256 .msg = "MODULE_ROCEE_TSP"
1258 .module_id = MODULE_ROCEE_TRP,
1259 .msg = "MODULE_ROCEE_TRP"
1261 .module_id = MODULE_ROCEE_SCC,
1262 .msg = "MODULE_ROCEE_SCC"
1264 .module_id = MODULE_ROCEE_CAEP,
1265 .msg = "MODULE_ROCEE_CAEP"
1267 .module_id = MODULE_ROCEE_GEN_AC,
1268 .msg = "MODULE_ROCEE_GEN_AC"
1270 .module_id = MODULE_ROCEE_QMM,
1271 .msg = "MODULE_ROCEE_QMM"
1273 .module_id = MODULE_ROCEE_LSAN,
1274 .msg = "MODULE_ROCEE_LSAN"
1278 static const struct hclge_hw_type_id hclge_hw_type_id_st[] = {
1280 .type_id = NONE_ERROR,
1283 .type_id = FIFO_ERROR,
1286 .type_id = MEMORY_ERROR,
1287 .msg = "memory_error"
1289 .type_id = POISON_ERROR,
1290 .msg = "poison_error"
1292 .type_id = MSIX_ECC_ERROR,
1293 .msg = "msix_ecc_error"
1295 .type_id = TQP_INT_ECC_ERROR,
1296 .msg = "tqp_int_ecc_error"
1298 .type_id = PF_ABNORMAL_INT_ERROR,
1299 .msg = "pf_abnormal_int_error"
1301 .type_id = MPF_ABNORMAL_INT_ERROR,
1302 .msg = "mpf_abnormal_int_error"
1304 .type_id = COMMON_ERROR,
1305 .msg = "common_error"
1307 .type_id = PORT_ERROR,
1310 .type_id = ETS_ERROR,
1313 .type_id = NCSI_ERROR,
1316 .type_id = GLB_ERROR,
1319 .type_id = ROCEE_NORMAL_ERR,
1320 .msg = "rocee_normal_error"
1322 .type_id = ROCEE_OVF_ERR,
1323 .msg = "rocee_ovf_error"
1327 static void hclge_log_error(struct device *dev, char *reg,
1328 const struct hclge_hw_error *err,
1329 u32 err_sts, unsigned long *reset_requests)
1332 if (err->int_msk & err_sts) {
1333 dev_err(dev, "%s %s found [error status=0x%x]\n",
1334 reg, err->msg, err_sts);
1335 if (err->reset_level &&
1336 err->reset_level != HNAE3_NONE_RESET)
1337 set_bit(err->reset_level, reset_requests);
1343 /* hclge_cmd_query_error: read the error information
1344 * @hdev: pointer to struct hclge_dev
1345 * @desc: descriptor for describing the command
1346 * @cmd: command opcode
1347 * @flag: flag for extended command structure
1349 * This function query the error info from hw register/s using command
1351 static int hclge_cmd_query_error(struct hclge_dev *hdev,
1352 struct hclge_desc *desc, u32 cmd, u16 flag)
1354 struct device *dev = &hdev->pdev->dev;
1358 hclge_cmd_setup_basic_desc(&desc[0], cmd, true);
1360 desc[0].flag |= cpu_to_le16(flag);
1361 hclge_cmd_setup_basic_desc(&desc[1], cmd, true);
1365 ret = hclge_cmd_send(&hdev->hw, &desc[0], desc_num);
1367 dev_err(dev, "query error cmd failed (%d)\n", ret);
1372 static int hclge_clear_mac_tnl_int(struct hclge_dev *hdev)
1374 struct hclge_desc desc;
1376 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_CLEAR_MAC_TNL_INT, false);
1377 desc.data[0] = cpu_to_le32(HCLGE_MAC_TNL_INT_CLR);
1379 return hclge_cmd_send(&hdev->hw, &desc, 1);
1382 static int hclge_config_common_hw_err_int(struct hclge_dev *hdev, bool en)
1384 struct device *dev = &hdev->pdev->dev;
1385 struct hclge_desc desc[2];
1388 /* configure common error interrupts */
1389 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_COMMON_ECC_INT_CFG, false);
1390 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
1391 hclge_cmd_setup_basic_desc(&desc[1], HCLGE_COMMON_ECC_INT_CFG, false);
1394 desc[0].data[0] = cpu_to_le32(HCLGE_IMP_TCM_ECC_ERR_INT_EN);
1395 desc[0].data[2] = cpu_to_le32(HCLGE_CMDQ_NIC_ECC_ERR_INT_EN |
1396 HCLGE_CMDQ_ROCEE_ECC_ERR_INT_EN);
1397 desc[0].data[3] = cpu_to_le32(HCLGE_IMP_RD_POISON_ERR_INT_EN);
1398 desc[0].data[4] = cpu_to_le32(HCLGE_TQP_ECC_ERR_INT_EN |
1399 HCLGE_MSIX_SRAM_ECC_ERR_INT_EN);
1400 desc[0].data[5] = cpu_to_le32(HCLGE_IMP_ITCM4_ECC_ERR_INT_EN);
1403 desc[1].data[0] = cpu_to_le32(HCLGE_IMP_TCM_ECC_ERR_INT_EN_MASK);
1404 desc[1].data[2] = cpu_to_le32(HCLGE_CMDQ_NIC_ECC_ERR_INT_EN_MASK |
1405 HCLGE_CMDQ_ROCEE_ECC_ERR_INT_EN_MASK);
1406 desc[1].data[3] = cpu_to_le32(HCLGE_IMP_RD_POISON_ERR_INT_EN_MASK);
1407 desc[1].data[4] = cpu_to_le32(HCLGE_TQP_ECC_ERR_INT_EN_MASK |
1408 HCLGE_MSIX_SRAM_ECC_ERR_INT_EN_MASK);
1409 desc[1].data[5] = cpu_to_le32(HCLGE_IMP_ITCM4_ECC_ERR_INT_EN_MASK);
1411 ret = hclge_cmd_send(&hdev->hw, &desc[0], 2);
1414 "fail(%d) to configure common err interrupts\n", ret);
1419 static int hclge_config_ncsi_hw_err_int(struct hclge_dev *hdev, bool en)
1421 struct device *dev = &hdev->pdev->dev;
1422 struct hclge_desc desc;
1425 if (hdev->ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2)
1428 /* configure NCSI error interrupts */
1429 hclge_cmd_setup_basic_desc(&desc, HCLGE_NCSI_INT_EN, false);
1431 desc.data[0] = cpu_to_le32(HCLGE_NCSI_ERR_INT_EN);
1433 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1436 "fail(%d) to configure NCSI error interrupts\n", ret);
1441 static int hclge_config_igu_egu_hw_err_int(struct hclge_dev *hdev, bool en)
1443 struct device *dev = &hdev->pdev->dev;
1444 struct hclge_desc desc;
1447 /* configure IGU,EGU error interrupts */
1448 hclge_cmd_setup_basic_desc(&desc, HCLGE_IGU_COMMON_INT_EN, false);
1449 desc.data[0] = cpu_to_le32(HCLGE_IGU_ERR_INT_TYPE);
1451 desc.data[0] |= cpu_to_le32(HCLGE_IGU_ERR_INT_EN);
1453 desc.data[1] = cpu_to_le32(HCLGE_IGU_ERR_INT_EN_MASK);
1455 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1458 "fail(%d) to configure IGU common interrupts\n", ret);
1462 hclge_cmd_setup_basic_desc(&desc, HCLGE_IGU_EGU_TNL_INT_EN, false);
1464 desc.data[0] = cpu_to_le32(HCLGE_IGU_TNL_ERR_INT_EN);
1466 desc.data[1] = cpu_to_le32(HCLGE_IGU_TNL_ERR_INT_EN_MASK);
1468 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1471 "fail(%d) to configure IGU-EGU TNL interrupts\n", ret);
1475 ret = hclge_config_ncsi_hw_err_int(hdev, en);
1480 static int hclge_config_ppp_error_interrupt(struct hclge_dev *hdev, u32 cmd,
1483 struct device *dev = &hdev->pdev->dev;
1484 struct hclge_desc desc[2];
1487 /* configure PPP error interrupts */
1488 hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
1489 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
1490 hclge_cmd_setup_basic_desc(&desc[1], cmd, false);
1492 if (cmd == HCLGE_PPP_CMD0_INT_CMD) {
1495 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT0_EN);
1497 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT1_EN);
1498 desc[0].data[4] = cpu_to_le32(HCLGE_PPP_PF_ERR_INT_EN);
1502 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT0_EN_MASK);
1504 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT1_EN_MASK);
1505 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2)
1507 cpu_to_le32(HCLGE_PPP_PF_ERR_INT_EN_MASK);
1508 } else if (cmd == HCLGE_PPP_CMD1_INT_CMD) {
1511 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT2_EN);
1513 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT3_EN);
1517 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT2_EN_MASK);
1519 cpu_to_le32(HCLGE_PPP_MPF_ECC_ERR_INT3_EN_MASK);
1522 ret = hclge_cmd_send(&hdev->hw, &desc[0], 2);
1524 dev_err(dev, "fail(%d) to configure PPP error intr\n", ret);
1529 static int hclge_config_ppp_hw_err_int(struct hclge_dev *hdev, bool en)
1533 ret = hclge_config_ppp_error_interrupt(hdev, HCLGE_PPP_CMD0_INT_CMD,
1538 ret = hclge_config_ppp_error_interrupt(hdev, HCLGE_PPP_CMD1_INT_CMD,
1544 static int hclge_config_tm_hw_err_int(struct hclge_dev *hdev, bool en)
1546 struct device *dev = &hdev->pdev->dev;
1547 struct hclge_desc desc;
1550 /* configure TM SCH hw errors */
1551 hclge_cmd_setup_basic_desc(&desc, HCLGE_TM_SCH_ECC_INT_EN, false);
1553 desc.data[0] = cpu_to_le32(HCLGE_TM_SCH_ECC_ERR_INT_EN);
1555 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1557 dev_err(dev, "fail(%d) to configure TM SCH errors\n", ret);
1561 /* configure TM QCN hw errors */
1562 hclge_cmd_setup_basic_desc(&desc, HCLGE_TM_QCN_MEM_INT_CFG, false);
1564 desc.data[1] = cpu_to_le32(HCLGE_TM_QCN_MEM_ERR_INT_EN);
1566 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1569 "fail(%d) to configure TM QCN mem errors\n", ret);
1574 static int hclge_config_mac_err_int(struct hclge_dev *hdev, bool en)
1576 struct device *dev = &hdev->pdev->dev;
1577 struct hclge_desc desc;
1580 /* configure MAC common error interrupts */
1581 hclge_cmd_setup_basic_desc(&desc, HCLGE_MAC_COMMON_INT_EN, false);
1583 desc.data[0] = cpu_to_le32(HCLGE_MAC_COMMON_ERR_INT_EN);
1585 desc.data[1] = cpu_to_le32(HCLGE_MAC_COMMON_ERR_INT_EN_MASK);
1587 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1590 "fail(%d) to configure MAC COMMON error intr\n", ret);
1595 int hclge_config_mac_tnl_int(struct hclge_dev *hdev, bool en)
1597 struct hclge_desc desc;
1599 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_TNL_INT_EN, false);
1601 desc.data[0] = cpu_to_le32(HCLGE_MAC_TNL_INT_EN);
1605 desc.data[1] = cpu_to_le32(HCLGE_MAC_TNL_INT_EN_MASK);
1607 return hclge_cmd_send(&hdev->hw, &desc, 1);
1610 static int hclge_config_ppu_error_interrupts(struct hclge_dev *hdev, u32 cmd,
1613 struct device *dev = &hdev->pdev->dev;
1614 struct hclge_desc desc[2];
1618 /* configure PPU error interrupts */
1619 if (cmd == HCLGE_PPU_MPF_ECC_INT_CMD) {
1620 hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
1621 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
1622 hclge_cmd_setup_basic_desc(&desc[1], cmd, false);
1625 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT0_EN);
1627 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT1_EN);
1629 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT3_EN);
1631 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN);
1635 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT0_EN_MASK);
1637 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT1_EN_MASK);
1639 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN_MASK);
1641 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT3_EN_MASK);
1643 } else if (cmd == HCLGE_PPU_MPF_OTHER_INT_CMD) {
1644 hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
1647 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN2);
1650 cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN2_MASK);
1651 } else if (cmd == HCLGE_PPU_PF_OTHER_INT_CMD) {
1652 hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
1655 cpu_to_le32(HCLGE_PPU_PF_ABNORMAL_INT_EN);
1658 cpu_to_le32(HCLGE_PPU_PF_ABNORMAL_INT_EN_MASK);
1660 dev_err(dev, "Invalid cmd to configure PPU error interrupts\n");
1664 ret = hclge_cmd_send(&hdev->hw, &desc[0], desc_num);
1669 static int hclge_config_ppu_hw_err_int(struct hclge_dev *hdev, bool en)
1671 struct device *dev = &hdev->pdev->dev;
1674 ret = hclge_config_ppu_error_interrupts(hdev, HCLGE_PPU_MPF_ECC_INT_CMD,
1677 dev_err(dev, "fail(%d) to configure PPU MPF ECC error intr\n",
1682 ret = hclge_config_ppu_error_interrupts(hdev,
1683 HCLGE_PPU_MPF_OTHER_INT_CMD,
1686 dev_err(dev, "fail(%d) to configure PPU MPF other intr\n", ret);
1690 ret = hclge_config_ppu_error_interrupts(hdev,
1691 HCLGE_PPU_PF_OTHER_INT_CMD, en);
1693 dev_err(dev, "fail(%d) to configure PPU PF error interrupts\n",
1698 static int hclge_config_ssu_hw_err_int(struct hclge_dev *hdev, bool en)
1700 struct device *dev = &hdev->pdev->dev;
1701 struct hclge_desc desc[2];
1704 /* configure SSU ecc error interrupts */
1705 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_SSU_ECC_INT_CMD, false);
1706 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
1707 hclge_cmd_setup_basic_desc(&desc[1], HCLGE_SSU_ECC_INT_CMD, false);
1709 desc[0].data[0] = cpu_to_le32(HCLGE_SSU_1BIT_ECC_ERR_INT_EN);
1711 cpu_to_le32(HCLGE_SSU_MULTI_BIT_ECC_ERR_INT_EN);
1712 desc[0].data[4] = cpu_to_le32(HCLGE_SSU_BIT32_ECC_ERR_INT_EN);
1715 desc[1].data[0] = cpu_to_le32(HCLGE_SSU_1BIT_ECC_ERR_INT_EN_MASK);
1716 desc[1].data[1] = cpu_to_le32(HCLGE_SSU_MULTI_BIT_ECC_ERR_INT_EN_MASK);
1717 desc[1].data[2] = cpu_to_le32(HCLGE_SSU_BIT32_ECC_ERR_INT_EN_MASK);
1719 ret = hclge_cmd_send(&hdev->hw, &desc[0], 2);
1722 "fail(%d) to configure SSU ECC error interrupt\n", ret);
1726 /* configure SSU common error interrupts */
1727 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_SSU_COMMON_INT_CMD, false);
1728 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
1729 hclge_cmd_setup_basic_desc(&desc[1], HCLGE_SSU_COMMON_INT_CMD, false);
1732 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2)
1734 cpu_to_le32(HCLGE_SSU_COMMON_INT_EN);
1737 cpu_to_le32(HCLGE_SSU_COMMON_INT_EN & ~BIT(5));
1738 desc[0].data[1] = cpu_to_le32(HCLGE_SSU_PORT_BASED_ERR_INT_EN);
1740 cpu_to_le32(HCLGE_SSU_FIFO_OVERFLOW_ERR_INT_EN);
1743 desc[1].data[0] = cpu_to_le32(HCLGE_SSU_COMMON_INT_EN_MASK |
1744 HCLGE_SSU_PORT_BASED_ERR_INT_EN_MASK);
1745 desc[1].data[1] = cpu_to_le32(HCLGE_SSU_FIFO_OVERFLOW_ERR_INT_EN_MASK);
1747 ret = hclge_cmd_send(&hdev->hw, &desc[0], 2);
1750 "fail(%d) to configure SSU COMMON error intr\n", ret);
1755 /* hclge_query_bd_num: query number of buffer descriptors
1756 * @hdev: pointer to struct hclge_dev
1757 * @is_ras: true for ras, false for msix
1758 * @mpf_bd_num: number of main PF interrupt buffer descriptors
1759 * @pf_bd_num: number of not main PF interrupt buffer descriptors
1761 * This function querys number of mpf and pf buffer descriptors.
1763 static int hclge_query_bd_num(struct hclge_dev *hdev, bool is_ras,
1764 u32 *mpf_bd_num, u32 *pf_bd_num)
1766 struct device *dev = &hdev->pdev->dev;
1767 u32 mpf_min_bd_num, pf_min_bd_num;
1768 enum hclge_opcode_type opcode;
1769 struct hclge_desc desc_bd;
1773 opcode = HCLGE_QUERY_RAS_INT_STS_BD_NUM;
1774 mpf_min_bd_num = HCLGE_MPF_RAS_INT_MIN_BD_NUM;
1775 pf_min_bd_num = HCLGE_PF_RAS_INT_MIN_BD_NUM;
1777 opcode = HCLGE_QUERY_MSIX_INT_STS_BD_NUM;
1778 mpf_min_bd_num = HCLGE_MPF_MSIX_INT_MIN_BD_NUM;
1779 pf_min_bd_num = HCLGE_PF_MSIX_INT_MIN_BD_NUM;
1782 hclge_cmd_setup_basic_desc(&desc_bd, opcode, true);
1783 ret = hclge_cmd_send(&hdev->hw, &desc_bd, 1);
1785 dev_err(dev, "fail(%d) to query msix int status bd num\n",
1790 *mpf_bd_num = le32_to_cpu(desc_bd.data[0]);
1791 *pf_bd_num = le32_to_cpu(desc_bd.data[1]);
1792 if (*mpf_bd_num < mpf_min_bd_num || *pf_bd_num < pf_min_bd_num) {
1793 dev_err(dev, "Invalid bd num: mpf(%u), pf(%u)\n",
1794 *mpf_bd_num, *pf_bd_num);
1801 /* hclge_handle_mpf_ras_error: handle all main PF RAS errors
1802 * @hdev: pointer to struct hclge_dev
1803 * @desc: descriptor for describing the command
1804 * @num: number of extended command structures
1806 * This function handles all the main PF RAS errors in the
1807 * hw register/s using command.
1809 static int hclge_handle_mpf_ras_error(struct hclge_dev *hdev,
1810 struct hclge_desc *desc,
1813 struct hnae3_ae_dev *ae_dev = hdev->ae_dev;
1814 struct device *dev = &hdev->pdev->dev;
1819 /* query all main PF RAS errors */
1820 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_MPF_RAS_INT,
1822 ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
1824 dev_err(dev, "query all mpf ras int cmd failed (%d)\n", ret);
1828 /* log HNS common errors */
1829 status = le32_to_cpu(desc[0].data[0]);
1831 hclge_log_error(dev, "IMP_TCM_ECC_INT_STS",
1832 &hclge_imp_tcm_ecc_int[0], status,
1833 &ae_dev->hw_err_reset_req);
1835 status = le32_to_cpu(desc[0].data[1]);
1837 hclge_log_error(dev, "CMDQ_MEM_ECC_INT_STS",
1838 &hclge_cmdq_nic_mem_ecc_int[0], status,
1839 &ae_dev->hw_err_reset_req);
1841 if ((le32_to_cpu(desc[0].data[2])) & BIT(0))
1842 dev_warn(dev, "imp_rd_data_poison_err found\n");
1844 status = le32_to_cpu(desc[0].data[3]);
1846 hclge_log_error(dev, "TQP_INT_ECC_INT_STS",
1847 &hclge_tqp_int_ecc_int[0], status,
1848 &ae_dev->hw_err_reset_req);
1850 status = le32_to_cpu(desc[0].data[4]);
1852 hclge_log_error(dev, "MSIX_ECC_INT_STS",
1853 &hclge_msix_sram_ecc_int[0], status,
1854 &ae_dev->hw_err_reset_req);
1856 /* log SSU(Storage Switch Unit) errors */
1857 desc_data = (__le32 *)&desc[2];
1858 status = le32_to_cpu(*(desc_data + 2));
1860 hclge_log_error(dev, "SSU_ECC_MULTI_BIT_INT_0",
1861 &hclge_ssu_mem_ecc_err_int[0], status,
1862 &ae_dev->hw_err_reset_req);
1864 status = le32_to_cpu(*(desc_data + 3)) & BIT(0);
1866 dev_err(dev, "SSU_ECC_MULTI_BIT_INT_1 ssu_mem32_ecc_mbit_err found [error status=0x%x]\n",
1868 set_bit(HNAE3_GLOBAL_RESET, &ae_dev->hw_err_reset_req);
1871 status = le32_to_cpu(*(desc_data + 4)) & HCLGE_SSU_COMMON_ERR_INT_MASK;
1873 hclge_log_error(dev, "SSU_COMMON_ERR_INT",
1874 &hclge_ssu_com_err_int[0], status,
1875 &ae_dev->hw_err_reset_req);
1877 /* log IGU(Ingress Unit) errors */
1878 desc_data = (__le32 *)&desc[3];
1879 status = le32_to_cpu(*desc_data) & HCLGE_IGU_INT_MASK;
1881 hclge_log_error(dev, "IGU_INT_STS",
1882 &hclge_igu_int[0], status,
1883 &ae_dev->hw_err_reset_req);
1885 /* log PPP(Programmable Packet Process) errors */
1886 desc_data = (__le32 *)&desc[4];
1887 status = le32_to_cpu(*(desc_data + 1));
1889 hclge_log_error(dev, "PPP_MPF_ABNORMAL_INT_ST1",
1890 &hclge_ppp_mpf_abnormal_int_st1[0], status,
1891 &ae_dev->hw_err_reset_req);
1893 status = le32_to_cpu(*(desc_data + 3)) & HCLGE_PPP_MPF_INT_ST3_MASK;
1895 hclge_log_error(dev, "PPP_MPF_ABNORMAL_INT_ST3",
1896 &hclge_ppp_mpf_abnormal_int_st3[0], status,
1897 &ae_dev->hw_err_reset_req);
1899 /* log PPU(RCB) errors */
1900 desc_data = (__le32 *)&desc[5];
1901 status = le32_to_cpu(*(desc_data + 1));
1904 "PPU_MPF_ABNORMAL_INT_ST1 rpu_rx_pkt_ecc_mbit_err found\n");
1905 set_bit(HNAE3_GLOBAL_RESET, &ae_dev->hw_err_reset_req);
1908 status = le32_to_cpu(*(desc_data + 2));
1910 hclge_log_error(dev, "PPU_MPF_ABNORMAL_INT_ST2",
1911 &hclge_ppu_mpf_abnormal_int_st2[0], status,
1912 &ae_dev->hw_err_reset_req);
1914 status = le32_to_cpu(*(desc_data + 3)) & HCLGE_PPU_MPF_INT_ST3_MASK;
1916 hclge_log_error(dev, "PPU_MPF_ABNORMAL_INT_ST3",
1917 &hclge_ppu_mpf_abnormal_int_st3[0], status,
1918 &ae_dev->hw_err_reset_req);
1920 /* log TM(Traffic Manager) errors */
1921 desc_data = (__le32 *)&desc[6];
1922 status = le32_to_cpu(*desc_data);
1924 hclge_log_error(dev, "TM_SCH_RINT",
1925 &hclge_tm_sch_rint[0], status,
1926 &ae_dev->hw_err_reset_req);
1928 /* log QCN(Quantized Congestion Control) errors */
1929 desc_data = (__le32 *)&desc[7];
1930 status = le32_to_cpu(*desc_data) & HCLGE_QCN_FIFO_INT_MASK;
1932 hclge_log_error(dev, "QCN_FIFO_RINT",
1933 &hclge_qcn_fifo_rint[0], status,
1934 &ae_dev->hw_err_reset_req);
1936 status = le32_to_cpu(*(desc_data + 1)) & HCLGE_QCN_ECC_INT_MASK;
1938 hclge_log_error(dev, "QCN_ECC_RINT",
1939 &hclge_qcn_ecc_rint[0], status,
1940 &ae_dev->hw_err_reset_req);
1942 /* log NCSI errors */
1943 desc_data = (__le32 *)&desc[9];
1944 status = le32_to_cpu(*desc_data) & HCLGE_NCSI_ECC_INT_MASK;
1946 hclge_log_error(dev, "NCSI_ECC_INT_RPT",
1947 &hclge_ncsi_err_int[0], status,
1948 &ae_dev->hw_err_reset_req);
1950 /* clear all main PF RAS errors */
1951 hclge_cmd_reuse_desc(&desc[0], false);
1952 ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
1954 dev_err(dev, "clear all mpf ras int cmd failed (%d)\n", ret);
1959 /* hclge_handle_pf_ras_error: handle all PF RAS errors
1960 * @hdev: pointer to struct hclge_dev
1961 * @desc: descriptor for describing the command
1962 * @num: number of extended command structures
1964 * This function handles all the PF RAS errors in the
1965 * hw register/s using command.
1967 static int hclge_handle_pf_ras_error(struct hclge_dev *hdev,
1968 struct hclge_desc *desc,
1971 struct hnae3_ae_dev *ae_dev = hdev->ae_dev;
1972 struct device *dev = &hdev->pdev->dev;
1977 /* query all PF RAS errors */
1978 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_PF_RAS_INT,
1980 ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
1982 dev_err(dev, "query all pf ras int cmd failed (%d)\n", ret);
1986 /* log SSU(Storage Switch Unit) errors */
1987 status = le32_to_cpu(desc[0].data[0]);
1989 hclge_log_error(dev, "SSU_PORT_BASED_ERR_INT",
1990 &hclge_ssu_port_based_err_int[0], status,
1991 &ae_dev->hw_err_reset_req);
1993 status = le32_to_cpu(desc[0].data[1]);
1995 hclge_log_error(dev, "SSU_FIFO_OVERFLOW_INT",
1996 &hclge_ssu_fifo_overflow_int[0], status,
1997 &ae_dev->hw_err_reset_req);
1999 status = le32_to_cpu(desc[0].data[2]);
2001 hclge_log_error(dev, "SSU_ETS_TCG_INT",
2002 &hclge_ssu_ets_tcg_int[0], status,
2003 &ae_dev->hw_err_reset_req);
2005 /* log IGU(Ingress Unit) EGU(Egress Unit) TNL errors */
2006 desc_data = (__le32 *)&desc[1];
2007 status = le32_to_cpu(*desc_data) & HCLGE_IGU_EGU_TNL_INT_MASK;
2009 hclge_log_error(dev, "IGU_EGU_TNL_INT_STS",
2010 &hclge_igu_egu_tnl_int[0], status,
2011 &ae_dev->hw_err_reset_req);
2013 /* log PPU(RCB) errors */
2014 desc_data = (__le32 *)&desc[3];
2015 status = le32_to_cpu(*desc_data) & HCLGE_PPU_PF_INT_RAS_MASK;
2017 hclge_log_error(dev, "PPU_PF_ABNORMAL_INT_ST0",
2018 &hclge_ppu_pf_abnormal_int[0], status,
2019 &ae_dev->hw_err_reset_req);
2020 hclge_report_hw_error(hdev, HNAE3_PPU_POISON_ERROR);
2023 /* clear all PF RAS errors */
2024 hclge_cmd_reuse_desc(&desc[0], false);
2025 ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
2027 dev_err(dev, "clear all pf ras int cmd failed (%d)\n", ret);
2032 static int hclge_handle_all_ras_errors(struct hclge_dev *hdev)
2034 u32 mpf_bd_num, pf_bd_num, bd_num;
2035 struct hclge_desc *desc;
2038 /* query the number of registers in the RAS int status */
2039 ret = hclge_query_bd_num(hdev, true, &mpf_bd_num, &pf_bd_num);
2043 bd_num = max_t(u32, mpf_bd_num, pf_bd_num);
2044 desc = kcalloc(bd_num, sizeof(struct hclge_desc), GFP_KERNEL);
2048 /* handle all main PF RAS errors */
2049 ret = hclge_handle_mpf_ras_error(hdev, desc, mpf_bd_num);
2054 memset(desc, 0, bd_num * sizeof(struct hclge_desc));
2056 /* handle all PF RAS errors */
2057 ret = hclge_handle_pf_ras_error(hdev, desc, pf_bd_num);
2063 static int hclge_log_rocee_axi_error(struct hclge_dev *hdev)
2065 struct device *dev = &hdev->pdev->dev;
2066 struct hclge_desc desc[3];
2069 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_ROCEE_AXI_RAS_INFO_CMD,
2071 hclge_cmd_setup_basic_desc(&desc[1], HCLGE_QUERY_ROCEE_AXI_RAS_INFO_CMD,
2073 hclge_cmd_setup_basic_desc(&desc[2], HCLGE_QUERY_ROCEE_AXI_RAS_INFO_CMD,
2075 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
2076 desc[1].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
2078 ret = hclge_cmd_send(&hdev->hw, &desc[0], 3);
2080 dev_err(dev, "failed(%d) to query ROCEE AXI error sts\n", ret);
2084 dev_err(dev, "AXI1: %08X %08X %08X %08X %08X %08X\n",
2085 le32_to_cpu(desc[0].data[0]), le32_to_cpu(desc[0].data[1]),
2086 le32_to_cpu(desc[0].data[2]), le32_to_cpu(desc[0].data[3]),
2087 le32_to_cpu(desc[0].data[4]), le32_to_cpu(desc[0].data[5]));
2088 dev_err(dev, "AXI2: %08X %08X %08X %08X %08X %08X\n",
2089 le32_to_cpu(desc[1].data[0]), le32_to_cpu(desc[1].data[1]),
2090 le32_to_cpu(desc[1].data[2]), le32_to_cpu(desc[1].data[3]),
2091 le32_to_cpu(desc[1].data[4]), le32_to_cpu(desc[1].data[5]));
2092 dev_err(dev, "AXI3: %08X %08X %08X %08X\n",
2093 le32_to_cpu(desc[2].data[0]), le32_to_cpu(desc[2].data[1]),
2094 le32_to_cpu(desc[2].data[2]), le32_to_cpu(desc[2].data[3]));
2099 static int hclge_log_rocee_ecc_error(struct hclge_dev *hdev)
2101 struct device *dev = &hdev->pdev->dev;
2102 struct hclge_desc desc[2];
2105 ret = hclge_cmd_query_error(hdev, &desc[0],
2106 HCLGE_QUERY_ROCEE_ECC_RAS_INFO_CMD,
2107 HCLGE_CMD_FLAG_NEXT);
2109 dev_err(dev, "failed(%d) to query ROCEE ECC error sts\n", ret);
2113 dev_err(dev, "ECC1: %08X %08X %08X %08X %08X %08X\n",
2114 le32_to_cpu(desc[0].data[0]), le32_to_cpu(desc[0].data[1]),
2115 le32_to_cpu(desc[0].data[2]), le32_to_cpu(desc[0].data[3]),
2116 le32_to_cpu(desc[0].data[4]), le32_to_cpu(desc[0].data[5]));
2117 dev_err(dev, "ECC2: %08X %08X %08X\n", le32_to_cpu(desc[1].data[0]),
2118 le32_to_cpu(desc[1].data[1]), le32_to_cpu(desc[1].data[2]));
2123 static int hclge_log_rocee_ovf_error(struct hclge_dev *hdev)
2125 struct device *dev = &hdev->pdev->dev;
2126 struct hclge_desc desc[2];
2129 /* read overflow error status */
2130 ret = hclge_cmd_query_error(hdev, &desc[0], HCLGE_ROCEE_PF_RAS_INT_CMD,
2133 dev_err(dev, "failed(%d) to query ROCEE OVF error sts\n", ret);
2137 /* log overflow error */
2138 if (le32_to_cpu(desc[0].data[0]) & HCLGE_ROCEE_OVF_ERR_INT_MASK) {
2139 const struct hclge_hw_error *err;
2142 err = &hclge_rocee_qmm_ovf_err_int[0];
2143 err_sts = HCLGE_ROCEE_OVF_ERR_TYPE_MASK &
2144 le32_to_cpu(desc[0].data[0]);
2146 if (err->int_msk == err_sts) {
2147 dev_err(dev, "%s [error status=0x%x] found\n",
2149 le32_to_cpu(desc[0].data[0]));
2156 if (le32_to_cpu(desc[0].data[1]) & HCLGE_ROCEE_OVF_ERR_INT_MASK) {
2157 dev_err(dev, "ROCEE TSP OVF [error status=0x%x] found\n",
2158 le32_to_cpu(desc[0].data[1]));
2161 if (le32_to_cpu(desc[0].data[2]) & HCLGE_ROCEE_OVF_ERR_INT_MASK) {
2162 dev_err(dev, "ROCEE SCC OVF [error status=0x%x] found\n",
2163 le32_to_cpu(desc[0].data[2]));
2169 static enum hnae3_reset_type
2170 hclge_log_and_clear_rocee_ras_error(struct hclge_dev *hdev)
2172 enum hnae3_reset_type reset_type = HNAE3_NONE_RESET;
2173 struct device *dev = &hdev->pdev->dev;
2174 struct hclge_desc desc[2];
2175 unsigned int status;
2178 /* read RAS error interrupt status */
2179 ret = hclge_cmd_query_error(hdev, &desc[0],
2180 HCLGE_QUERY_CLEAR_ROCEE_RAS_INT, 0);
2182 dev_err(dev, "failed(%d) to query ROCEE RAS INT SRC\n", ret);
2183 /* reset everything for now */
2184 return HNAE3_GLOBAL_RESET;
2187 status = le32_to_cpu(desc[0].data[0]);
2188 if (status & HCLGE_ROCEE_AXI_ERR_INT_MASK) {
2189 if (status & HCLGE_ROCEE_RERR_INT_MASK)
2190 dev_err(dev, "ROCEE RAS AXI rresp error\n");
2192 if (status & HCLGE_ROCEE_BERR_INT_MASK)
2193 dev_err(dev, "ROCEE RAS AXI bresp error\n");
2195 reset_type = HNAE3_FUNC_RESET;
2197 hclge_report_hw_error(hdev, HNAE3_ROCEE_AXI_RESP_ERROR);
2199 ret = hclge_log_rocee_axi_error(hdev);
2201 return HNAE3_GLOBAL_RESET;
2204 if (status & HCLGE_ROCEE_ECC_INT_MASK) {
2205 dev_err(dev, "ROCEE RAS 2bit ECC error\n");
2206 reset_type = HNAE3_GLOBAL_RESET;
2208 ret = hclge_log_rocee_ecc_error(hdev);
2210 return HNAE3_GLOBAL_RESET;
2213 if (status & HCLGE_ROCEE_OVF_INT_MASK) {
2214 ret = hclge_log_rocee_ovf_error(hdev);
2216 dev_err(dev, "failed(%d) to process ovf error\n", ret);
2217 /* reset everything for now */
2218 return HNAE3_GLOBAL_RESET;
2222 /* clear error status */
2223 hclge_cmd_reuse_desc(&desc[0], false);
2224 ret = hclge_cmd_send(&hdev->hw, &desc[0], 1);
2226 dev_err(dev, "failed(%d) to clear ROCEE RAS error\n", ret);
2227 /* reset everything for now */
2228 return HNAE3_GLOBAL_RESET;
2234 int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en)
2236 struct device *dev = &hdev->pdev->dev;
2237 struct hclge_desc desc;
2240 if (hdev->ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2 ||
2241 !hnae3_dev_roce_supported(hdev))
2244 hclge_cmd_setup_basic_desc(&desc, HCLGE_CONFIG_ROCEE_RAS_INT_EN, false);
2246 /* enable ROCEE hw error interrupts */
2247 desc.data[0] = cpu_to_le32(HCLGE_ROCEE_RAS_NFE_INT_EN);
2248 desc.data[1] = cpu_to_le32(HCLGE_ROCEE_RAS_CE_INT_EN);
2250 hclge_log_and_clear_rocee_ras_error(hdev);
2252 desc.data[2] = cpu_to_le32(HCLGE_ROCEE_RAS_NFE_INT_EN_MASK);
2253 desc.data[3] = cpu_to_le32(HCLGE_ROCEE_RAS_CE_INT_EN_MASK);
2255 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2257 dev_err(dev, "failed(%d) to config ROCEE RAS interrupt\n", ret);
2262 static void hclge_handle_rocee_ras_error(struct hnae3_ae_dev *ae_dev)
2264 struct hclge_dev *hdev = ae_dev->priv;
2265 enum hnae3_reset_type reset_type;
2267 if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
2270 reset_type = hclge_log_and_clear_rocee_ras_error(hdev);
2271 if (reset_type != HNAE3_NONE_RESET)
2272 set_bit(reset_type, &ae_dev->hw_err_reset_req);
2275 static const struct hclge_hw_blk hw_blk[] = {
2279 .config_err_int = hclge_config_igu_egu_hw_err_int,
2283 .config_err_int = hclge_config_ppp_hw_err_int,
2287 .config_err_int = hclge_config_ssu_hw_err_int,
2291 .config_err_int = hclge_config_ppu_hw_err_int,
2295 .config_err_int = hclge_config_tm_hw_err_int,
2299 .config_err_int = hclge_config_common_hw_err_int,
2303 .config_err_int = hclge_config_mac_err_int,
2309 static void hclge_config_all_msix_error(struct hclge_dev *hdev, bool enable)
2313 reg_val = hclge_read_dev(&hdev->hw, HCLGE_PF_OTHER_INT_REG);
2316 reg_val |= BIT(HCLGE_VECTOR0_ALL_MSIX_ERR_B);
2318 reg_val &= ~BIT(HCLGE_VECTOR0_ALL_MSIX_ERR_B);
2320 hclge_write_dev(&hdev->hw, HCLGE_PF_OTHER_INT_REG, reg_val);
2323 int hclge_config_nic_hw_error(struct hclge_dev *hdev, bool state)
2325 const struct hclge_hw_blk *module = hw_blk;
2328 hclge_config_all_msix_error(hdev, state);
2330 while (module->name) {
2331 if (module->config_err_int) {
2332 ret = module->config_err_int(hdev, state);
2342 pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev)
2344 struct hclge_dev *hdev = ae_dev->priv;
2345 struct device *dev = &hdev->pdev->dev;
2348 if (!test_bit(HCLGE_STATE_SERVICE_INITED, &hdev->state)) {
2350 "Can't recover - RAS error reported during dev init\n");
2351 return PCI_ERS_RESULT_NONE;
2354 status = hclge_read_dev(&hdev->hw, HCLGE_RAS_PF_OTHER_INT_STS_REG);
2355 if (status & HCLGE_RAS_REG_NFE_MASK ||
2356 status & HCLGE_RAS_REG_ROCEE_ERR_MASK)
2357 ae_dev->hw_err_reset_req = 0;
2361 /* Handling Non-fatal HNS RAS errors */
2362 if (status & HCLGE_RAS_REG_NFE_MASK) {
2364 "HNS Non-Fatal RAS error(status=0x%x) identified\n",
2366 hclge_handle_all_ras_errors(hdev);
2369 /* Handling Non-fatal Rocee RAS errors */
2370 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2 &&
2371 status & HCLGE_RAS_REG_ROCEE_ERR_MASK) {
2372 dev_err(dev, "ROCEE Non-Fatal RAS error identified\n");
2373 hclge_handle_rocee_ras_error(ae_dev);
2376 if (ae_dev->hw_err_reset_req)
2377 return PCI_ERS_RESULT_NEED_RESET;
2380 return PCI_ERS_RESULT_RECOVERED;
2383 static int hclge_clear_hw_msix_error(struct hclge_dev *hdev,
2384 struct hclge_desc *desc, bool is_mpf,
2389 cpu_to_le16(HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT);
2391 desc[0].opcode = cpu_to_le16(HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT);
2393 desc[0].flag = cpu_to_le16(HCLGE_CMD_FLAG_NO_INTR | HCLGE_CMD_FLAG_IN);
2395 return hclge_cmd_send(&hdev->hw, &desc[0], bd_num);
2398 /* hclge_query_8bd_info: query information about over_8bd_nfe_err
2399 * @hdev: pointer to struct hclge_dev
2400 * @vf_id: Index of the virtual function with error
2401 * @q_id: Physical index of the queue with error
2403 * This function get specific index of queue and function which causes
2404 * over_8bd_nfe_err by using command. If vf_id is 0, it means error is
2405 * caused by PF instead of VF.
2407 static int hclge_query_over_8bd_err_info(struct hclge_dev *hdev, u16 *vf_id,
2410 struct hclge_query_ppu_pf_other_int_dfx_cmd *req;
2411 struct hclge_desc desc;
2414 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PPU_PF_OTHER_INT_DFX, true);
2415 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2419 req = (struct hclge_query_ppu_pf_other_int_dfx_cmd *)desc.data;
2420 *vf_id = le16_to_cpu(req->over_8bd_no_fe_vf_id);
2421 *q_id = le16_to_cpu(req->over_8bd_no_fe_qid);
2426 /* hclge_handle_over_8bd_err: handle MSI-X error named over_8bd_nfe_err
2427 * @hdev: pointer to struct hclge_dev
2428 * @reset_requests: reset level that we need to trigger later
2430 * over_8bd_nfe_err is a special MSI-X because it may caused by a VF, in
2431 * that case, we need to trigger VF reset. Otherwise, a PF reset is needed.
2433 static void hclge_handle_over_8bd_err(struct hclge_dev *hdev,
2434 unsigned long *reset_requests)
2436 struct device *dev = &hdev->pdev->dev;
2441 ret = hclge_query_over_8bd_err_info(hdev, &vf_id, &q_id);
2443 dev_err(dev, "fail(%d) to query over_8bd_no_fe info\n",
2448 dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vport(%u), queue_id(%u)\n",
2452 if (vf_id >= hdev->num_alloc_vport) {
2453 dev_err(dev, "invalid vport(%u)\n", vf_id);
2457 /* If we need to trigger other reset whose level is higher
2458 * than HNAE3_VF_FUNC_RESET, no need to trigger a VF reset
2461 if (*reset_requests != 0)
2464 ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]);
2466 dev_err(dev, "inform reset to vport(%u) failed %d!\n",
2469 set_bit(HNAE3_FUNC_RESET, reset_requests);
2473 /* hclge_handle_mpf_msix_error: handle all main PF MSI-X errors
2474 * @hdev: pointer to struct hclge_dev
2475 * @desc: descriptor for describing the command
2476 * @mpf_bd_num: number of extended command structures
2477 * @reset_requests: record of the reset level that we need
2479 * This function handles all the main PF MSI-X errors in the hw register/s
2482 static int hclge_handle_mpf_msix_error(struct hclge_dev *hdev,
2483 struct hclge_desc *desc,
2485 unsigned long *reset_requests)
2487 struct device *dev = &hdev->pdev->dev;
2491 /* query all main PF MSIx errors */
2492 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT,
2494 ret = hclge_cmd_send(&hdev->hw, &desc[0], mpf_bd_num);
2496 dev_err(dev, "query all mpf msix int cmd failed (%d)\n", ret);
2500 /* log MAC errors */
2501 desc_data = (__le32 *)&desc[1];
2502 status = le32_to_cpu(*desc_data);
2504 hclge_log_error(dev, "MAC_AFIFO_TNL_INT_R",
2505 &hclge_mac_afifo_tnl_int[0], status,
2508 /* log PPU(RCB) MPF errors */
2509 desc_data = (__le32 *)&desc[5];
2510 status = le32_to_cpu(*(desc_data + 2)) &
2511 HCLGE_PPU_MPF_INT_ST2_MSIX_MASK;
2513 dev_err(dev, "PPU_MPF_ABNORMAL_INT_ST2 rx_q_search_miss found [dfx status=0x%x\n]",
2516 /* clear all main PF MSIx errors */
2517 ret = hclge_clear_hw_msix_error(hdev, desc, true, mpf_bd_num);
2519 dev_err(dev, "clear all mpf msix int cmd failed (%d)\n", ret);
2524 /* hclge_handle_pf_msix_error: handle all PF MSI-X errors
2525 * @hdev: pointer to struct hclge_dev
2526 * @desc: descriptor for describing the command
2527 * @mpf_bd_num: number of extended command structures
2528 * @reset_requests: record of the reset level that we need
2530 * This function handles all the PF MSI-X errors in the hw register/s using
2533 static int hclge_handle_pf_msix_error(struct hclge_dev *hdev,
2534 struct hclge_desc *desc,
2536 unsigned long *reset_requests)
2538 struct device *dev = &hdev->pdev->dev;
2543 /* query all PF MSIx errors */
2544 hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT,
2546 ret = hclge_cmd_send(&hdev->hw, &desc[0], pf_bd_num);
2548 dev_err(dev, "query all pf msix int cmd failed (%d)\n", ret);
2552 /* log SSU PF errors */
2553 status = le32_to_cpu(desc[0].data[0]) & HCLGE_SSU_PORT_INT_MSIX_MASK;
2555 hclge_log_error(dev, "SSU_PORT_BASED_ERR_INT",
2556 &hclge_ssu_port_based_pf_int[0],
2557 status, reset_requests);
2559 /* read and log PPP PF errors */
2560 desc_data = (__le32 *)&desc[2];
2561 status = le32_to_cpu(*desc_data);
2563 hclge_log_error(dev, "PPP_PF_ABNORMAL_INT_ST0",
2564 &hclge_ppp_pf_abnormal_int[0],
2565 status, reset_requests);
2567 /* log PPU(RCB) PF errors */
2568 desc_data = (__le32 *)&desc[3];
2569 status = le32_to_cpu(*desc_data) & HCLGE_PPU_PF_INT_MSIX_MASK;
2571 hclge_log_error(dev, "PPU_PF_ABNORMAL_INT_ST",
2572 &hclge_ppu_pf_abnormal_int[0],
2573 status, reset_requests);
2575 status = le32_to_cpu(*desc_data) & HCLGE_PPU_PF_OVER_8BD_ERR_MASK;
2577 hclge_handle_over_8bd_err(hdev, reset_requests);
2579 /* clear all PF MSIx errors */
2580 ret = hclge_clear_hw_msix_error(hdev, desc, false, pf_bd_num);
2582 dev_err(dev, "clear all pf msix int cmd failed (%d)\n", ret);
2587 static int hclge_handle_all_hw_msix_error(struct hclge_dev *hdev,
2588 unsigned long *reset_requests)
2590 u32 mpf_bd_num, pf_bd_num, bd_num;
2591 struct hclge_desc *desc;
2594 /* query the number of bds for the MSIx int status */
2595 ret = hclge_query_bd_num(hdev, false, &mpf_bd_num, &pf_bd_num);
2599 bd_num = max_t(u32, mpf_bd_num, pf_bd_num);
2600 desc = kcalloc(bd_num, sizeof(struct hclge_desc), GFP_KERNEL);
2604 ret = hclge_handle_mpf_msix_error(hdev, desc, mpf_bd_num,
2609 memset(desc, 0, bd_num * sizeof(struct hclge_desc));
2610 ret = hclge_handle_pf_msix_error(hdev, desc, pf_bd_num, reset_requests);
2614 ret = hclge_handle_mac_tnl(hdev);
2622 int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
2623 unsigned long *reset_requests)
2625 struct device *dev = &hdev->pdev->dev;
2627 if (!test_bit(HCLGE_STATE_SERVICE_INITED, &hdev->state)) {
2629 "failed to handle msix error during dev init\n");
2633 return hclge_handle_all_hw_msix_error(hdev, reset_requests);
2636 int hclge_handle_mac_tnl(struct hclge_dev *hdev)
2638 struct hclge_mac_tnl_stats mac_tnl_stats;
2639 struct device *dev = &hdev->pdev->dev;
2640 struct hclge_desc desc;
2644 /* query and clear mac tnl interruptions */
2645 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_MAC_TNL_INT, true);
2646 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2648 dev_err(dev, "failed to query mac tnl int, ret = %d.\n", ret);
2652 status = le32_to_cpu(desc.data[0]);
2654 /* When mac tnl interrupt occurs, we record current time and
2655 * register status here in a fifo, then clear the status. So
2656 * that if link status changes suddenly at some time, we can
2657 * query them by debugfs.
2659 mac_tnl_stats.time = local_clock();
2660 mac_tnl_stats.status = status;
2661 kfifo_put(&hdev->mac_tnl_log, mac_tnl_stats);
2662 ret = hclge_clear_mac_tnl_int(hdev);
2664 dev_err(dev, "failed to clear mac tnl int, ret = %d.\n",
2671 void hclge_handle_all_hns_hw_errors(struct hnae3_ae_dev *ae_dev)
2673 struct hclge_dev *hdev = ae_dev->priv;
2674 struct device *dev = &hdev->pdev->dev;
2675 u32 mpf_bd_num, pf_bd_num, bd_num;
2676 struct hclge_desc *desc;
2680 ae_dev->hw_err_reset_req = 0;
2681 status = hclge_read_dev(&hdev->hw, HCLGE_RAS_PF_OTHER_INT_STS_REG);
2683 /* query the number of bds for the MSIx int status */
2684 ret = hclge_query_bd_num(hdev, false, &mpf_bd_num, &pf_bd_num);
2688 bd_num = max_t(u32, mpf_bd_num, pf_bd_num);
2689 desc = kcalloc(bd_num, sizeof(struct hclge_desc), GFP_KERNEL);
2693 /* Clear HNS hw errors reported through msix */
2694 memset(&desc[0].data[0], 0xFF, mpf_bd_num * sizeof(struct hclge_desc) -
2695 HCLGE_DESC_NO_DATA_LEN);
2696 ret = hclge_clear_hw_msix_error(hdev, desc, true, mpf_bd_num);
2698 dev_err(dev, "fail(%d) to clear mpf msix int during init\n",
2703 memset(&desc[0].data[0], 0xFF, pf_bd_num * sizeof(struct hclge_desc) -
2704 HCLGE_DESC_NO_DATA_LEN);
2705 ret = hclge_clear_hw_msix_error(hdev, desc, false, pf_bd_num);
2707 dev_err(dev, "fail(%d) to clear pf msix int during init\n",
2712 /* Handle Non-fatal HNS RAS errors */
2713 if (status & HCLGE_RAS_REG_NFE_MASK) {
2714 dev_err(dev, "HNS hw error(RAS) identified during init\n");
2715 hclge_handle_all_ras_errors(hdev);
2722 bool hclge_find_error_source(struct hclge_dev *hdev)
2724 u32 msix_src_flag, hw_err_src_flag;
2726 msix_src_flag = hclge_read_dev(&hdev->hw, HCLGE_MISC_VECTOR_INT_STS) &
2727 HCLGE_VECTOR0_REG_MSIX_MASK;
2729 hw_err_src_flag = hclge_read_dev(&hdev->hw,
2730 HCLGE_RAS_PF_OTHER_INT_STS_REG) &
2731 HCLGE_RAS_REG_ERR_MASK;
2733 return msix_src_flag || hw_err_src_flag;
2736 void hclge_handle_occurred_error(struct hclge_dev *hdev)
2738 struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev);
2740 if (hclge_find_error_source(hdev))
2741 hclge_handle_error_info_log(ae_dev);
2745 hclge_handle_error_type_reg_log(struct device *dev,
2746 struct hclge_mod_err_info *mod_info,
2747 struct hclge_type_reg_err_info *type_reg_info)
2749 #define HCLGE_ERR_TYPE_MASK 0x7F
2750 #define HCLGE_ERR_TYPE_IS_RAS_OFFSET 7
2752 u8 mod_id, total_module, type_id, total_type, i, is_ras;
2753 u8 index_module = MODULE_NONE;
2754 u8 index_type = NONE_ERROR;
2756 mod_id = mod_info->mod_id;
2757 type_id = type_reg_info->type_id & HCLGE_ERR_TYPE_MASK;
2758 is_ras = type_reg_info->type_id >> HCLGE_ERR_TYPE_IS_RAS_OFFSET;
2760 total_module = ARRAY_SIZE(hclge_hw_module_id_st);
2761 total_type = ARRAY_SIZE(hclge_hw_type_id_st);
2763 for (i = 0; i < total_module; i++) {
2764 if (mod_id == hclge_hw_module_id_st[i].module_id) {
2770 for (i = 0; i < total_type; i++) {
2771 if (type_id == hclge_hw_type_id_st[i].type_id) {
2777 if (index_module != MODULE_NONE && index_type != NONE_ERROR)
2779 "found %s %s, is %s error.\n",
2780 hclge_hw_module_id_st[index_module].msg,
2781 hclge_hw_type_id_st[index_type].msg,
2782 is_ras ? "ras" : "msix");
2785 "unknown module[%u] or type[%u].\n", mod_id, type_id);
2787 dev_err(dev, "reg_value:\n");
2788 for (i = 0; i < type_reg_info->reg_num; i++)
2789 dev_err(dev, "0x%08x\n", type_reg_info->hclge_reg[i]);
2792 static void hclge_handle_error_module_log(struct hnae3_ae_dev *ae_dev,
2793 const u32 *buf, u32 buf_size)
2795 struct hclge_type_reg_err_info *type_reg_info;
2796 struct hclge_dev *hdev = ae_dev->priv;
2797 struct device *dev = &hdev->pdev->dev;
2798 struct hclge_mod_err_info *mod_info;
2799 struct hclge_sum_err_info *sum_info;
2800 u8 mod_num, err_num, i;
2803 sum_info = (struct hclge_sum_err_info *)&buf[offset++];
2804 if (sum_info->reset_type &&
2805 sum_info->reset_type != HNAE3_NONE_RESET)
2806 set_bit(sum_info->reset_type, &ae_dev->hw_err_reset_req);
2807 mod_num = sum_info->mod_num;
2810 if (offset >= buf_size) {
2811 dev_err(dev, "The offset(%u) exceeds buf's size(%u).\n",
2815 mod_info = (struct hclge_mod_err_info *)&buf[offset++];
2816 err_num = mod_info->err_num;
2818 for (i = 0; i < err_num; i++) {
2819 if (offset >= buf_size) {
2821 "The offset(%u) exceeds buf size(%u).\n",
2826 type_reg_info = (struct hclge_type_reg_err_info *)
2828 hclge_handle_error_type_reg_log(dev, mod_info,
2831 offset += type_reg_info->reg_num;
2836 static int hclge_query_all_err_bd_num(struct hclge_dev *hdev, u32 *bd_num)
2838 struct device *dev = &hdev->pdev->dev;
2839 struct hclge_desc desc_bd;
2842 hclge_cmd_setup_basic_desc(&desc_bd, HCLGE_QUERY_ALL_ERR_BD_NUM, true);
2843 ret = hclge_cmd_send(&hdev->hw, &desc_bd, 1);
2845 dev_err(dev, "failed to query error bd_num, ret = %d.\n", ret);
2849 *bd_num = le32_to_cpu(desc_bd.data[0]);
2851 dev_err(dev, "The value of bd_num is 0!\n");
2858 static int hclge_query_all_err_info(struct hclge_dev *hdev,
2859 struct hclge_desc *desc, u32 bd_num)
2861 struct device *dev = &hdev->pdev->dev;
2864 hclge_cmd_setup_basic_desc(desc, HCLGE_QUERY_ALL_ERR_INFO, true);
2865 ret = hclge_cmd_send(&hdev->hw, desc, bd_num);
2867 dev_err(dev, "failed to query error info, ret = %d.\n", ret);
2872 int hclge_handle_error_info_log(struct hnae3_ae_dev *ae_dev)
2874 u32 bd_num, desc_len, buf_len, buf_size, i;
2875 struct hclge_dev *hdev = ae_dev->priv;
2876 struct hclge_desc *desc;
2881 ret = hclge_query_all_err_bd_num(hdev, &bd_num);
2885 desc_len = bd_num * sizeof(struct hclge_desc);
2886 desc = kzalloc(desc_len, GFP_KERNEL);
2892 ret = hclge_query_all_err_info(hdev, desc, bd_num);
2896 buf_len = bd_num * sizeof(struct hclge_desc) - HCLGE_DESC_NO_DATA_LEN;
2897 buf_size = buf_len / sizeof(u32);
2899 desc_data = kzalloc(buf_len, GFP_KERNEL);
2905 buf = kzalloc(buf_len, GFP_KERNEL);
2911 memcpy(desc_data, &desc[0].data[0], buf_len);
2912 for (i = 0; i < buf_size; i++)
2913 buf[i] = le32_to_cpu(desc_data[i]);
2915 hclge_handle_error_module_log(ae_dev, buf, buf_size);