History

habanalabs/gaudi: add razwi notify event

Each time razwi (read-only zero, write ignore) happens, besides capturing its data, also notify the user about it.

Dani Liberman committed 4 years ago

Commit cb5fb661 parent 841cd2d4 files · +31 −18Browse files

Unified · Split

4 files
  1. drivers/misc/habanalabs/common/device.c +8 −0
  2. drivers/misc/habanalabs/common/habanalabs.h +2 −0
  3. drivers/misc/habanalabs/gaudi/gaudi.c +19 −18
  4. include/uapi/misc/habanalabs.h +2 −0
drivers/misc/habanalabs/common/device.c+8−0
@@ -2409,6 +2409,14 @@ void hl_capture_razwi(struct hl_device *hdev, u64 addr, u16 *engine_id, u16 num_ · 2408 unmodified lines
2409 num_of_engines * sizeof(u16));2409 num_of_engines * sizeof(u16));
2410 hdev->captured_err_info.razwi.flags = flags;2410 hdev->captured_err_info.razwi.flags = flags;
2411}2411}
2412
2413void hl_handle_razwi(struct hl_device *hdev, u64 addr, u16 *engine_id, u16 num_of_engines,
2414 u8 flags, u64 *event_mask)
2415{
2416 hl_capture_razwi(hdev, addr, engine_id, num_of_engines, flags);
2417 *event_mask |= HL_NOTIFIER_EVENT_RAZWI;
2418}
2419
2412static void hl_capture_user_mappings(struct hl_device *hdev, bool is_pmmu)2420static void hl_capture_user_mappings(struct hl_device *hdev, bool is_pmmu)
2413{2421{
2414 struct page_fault_info *pgf_info = &hdev->captured_err_info.pgf_info;2422 struct page_fault_info *pgf_info = &hdev->captured_err_info.pgf_info;
drivers/misc/habanalabs/common/habanalabs.h+2−0
@@ -3812,6 +3812,8 @@ hl_mmap_mem_buf_alloc(struct hl_mem_mgr *mmg, · 3811 unmodified lines
3812__printf(2, 3) void hl_engine_data_sprintf(struct engines_data *e, const char *fmt, ...);3812__printf(2, 3) void hl_engine_data_sprintf(struct engines_data *e, const char *fmt, ...);
3813void hl_capture_razwi(struct hl_device *hdev, u64 addr, u16 *engine_id, u16 num_of_engines,3813void hl_capture_razwi(struct hl_device *hdev, u64 addr, u16 *engine_id, u16 num_of_engines,
3814 u8 flags);3814 u8 flags);
3815void hl_handle_razwi(struct hl_device *hdev, u64 addr, u16 *engine_id, u16 num_of_engines,
3816 u8 flags, u64 *event_mask);
3815void hl_capture_page_fault(struct hl_device *hdev, u64 addr, u16 eng_id, bool is_pmmu);3817void hl_capture_page_fault(struct hl_device *hdev, u64 addr, u16 eng_id, bool is_pmmu);
3816 3818
3817#ifdef CONFIG_DEBUG_FS3819#ifdef CONFIG_DEBUG_FS
drivers/misc/habanalabs/gaudi/gaudi.c+19−18
@@ -7301,7 +7301,7 @@ static void gaudi_handle_qman_err(struct hl_device *hdev, u16 event_type, u64 *e · 7300 unmodified lines
7301}7301}
7302 7302
7303static void gaudi_print_irq_info(struct hl_device *hdev, u16 event_type,7303static void gaudi_print_irq_info(struct hl_device *hdev, u16 event_type,
7304 bool razwi)7304 bool razwi, u64 *event_mask)
7305{7305{
7306 bool is_read = false, is_write = false;7306 bool is_read = false, is_write = false;
7307 u16 engine_id[2], num_of_razwi_eng = 0;7307 u16 engine_id[2], num_of_razwi_eng = 0;
@@ -7337,7 +7337,8 @@ static void gaudi_print_irq_info(struct hl_device *hdev, u16 event_type, · 29 unmodified lines
7337 num_of_razwi_eng = 1;7337 num_of_razwi_eng = 1;
7338 }7338 }
7339 7339
7340 hl_capture_razwi(hdev, razwi_addr, engine_id, num_of_razwi_eng, razwi_flags);7340 hl_handle_razwi(hdev, razwi_addr, engine_id, num_of_razwi_eng, razwi_flags,
7341 event_mask);
7341 }7342 }
7342}7343}
7343 7344
@@ -7675,7 +7676,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 331 unmodified lines
7675 case GAUDI_EVENT_HBM_0_DERR ... GAUDI_EVENT_HBM_3_DERR:7676 case GAUDI_EVENT_HBM_0_DERR ... GAUDI_EVENT_HBM_3_DERR:
7676 case GAUDI_EVENT_MMU_DERR:7677 case GAUDI_EVENT_MMU_DERR:
7677 case GAUDI_EVENT_NIC0_CS_DBG_DERR ... GAUDI_EVENT_NIC4_CS_DBG_DERR:7678 case GAUDI_EVENT_NIC0_CS_DBG_DERR ... GAUDI_EVENT_NIC4_CS_DBG_DERR:
7678 gaudi_print_irq_info(hdev, event_type, true);7679 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7679 gaudi_handle_ecc_event(hdev, event_type, &eq_entry->ecc_data);7680 gaudi_handle_ecc_event(hdev, event_type, &eq_entry->ecc_data);
7680 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7681 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7681 fw_fatal_err_flag = HL_DRV_RESET_FW_FATAL_ERR;7682 fw_fatal_err_flag = HL_DRV_RESET_FW_FATAL_ERR;
@@ -7685,7 +7686,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 3 unmodified lines
7685 case GAUDI_EVENT_AXI_ECC:7686 case GAUDI_EVENT_AXI_ECC:
7686 case GAUDI_EVENT_L2_RAM_ECC:7687 case GAUDI_EVENT_L2_RAM_ECC:
7687 case GAUDI_EVENT_PLL0 ... GAUDI_EVENT_PLL17:7688 case GAUDI_EVENT_PLL0 ... GAUDI_EVENT_PLL17:
7688 gaudi_print_irq_info(hdev, event_type, false);7689 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7689 fw_fatal_err_flag = HL_DRV_RESET_FW_FATAL_ERR;7690 fw_fatal_err_flag = HL_DRV_RESET_FW_FATAL_ERR;
7690 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7691 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7691 goto reset_device;7692 goto reset_device;
@@ -7694,7 +7695,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 2 unmodified lines
7694 case GAUDI_EVENT_HBM1_SPI_0:7695 case GAUDI_EVENT_HBM1_SPI_0:
7695 case GAUDI_EVENT_HBM2_SPI_0:7696 case GAUDI_EVENT_HBM2_SPI_0:
7696 case GAUDI_EVENT_HBM3_SPI_0:7697 case GAUDI_EVENT_HBM3_SPI_0:
7697 gaudi_print_irq_info(hdev, event_type, false);7698 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7698 gaudi_hbm_read_interrupts(hdev,7699 gaudi_hbm_read_interrupts(hdev,
7699 gaudi_hbm_event_to_dev(event_type),7700 gaudi_hbm_event_to_dev(event_type),
7700 &eq_entry->hbm_ecc_data);7701 &eq_entry->hbm_ecc_data);
@@ -7706,7 +7707,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 5 unmodified lines
7706 case GAUDI_EVENT_HBM1_SPI_1:7707 case GAUDI_EVENT_HBM1_SPI_1:
7707 case GAUDI_EVENT_HBM2_SPI_1:7708 case GAUDI_EVENT_HBM2_SPI_1:
7708 case GAUDI_EVENT_HBM3_SPI_1:7709 case GAUDI_EVENT_HBM3_SPI_1:
7709 gaudi_print_irq_info(hdev, event_type, false);7710 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7710 gaudi_hbm_read_interrupts(hdev,7711 gaudi_hbm_read_interrupts(hdev,
7711 gaudi_hbm_event_to_dev(event_type),7712 gaudi_hbm_event_to_dev(event_type),
7712 &eq_entry->hbm_ecc_data);7713 &eq_entry->hbm_ecc_data);
@@ -7728,7 +7729,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 15 unmodified lines
7728 * if the event is a TPC Assertion or a "real" TPC DEC.7729 * if the event is a TPC Assertion or a "real" TPC DEC.
7729 */7730 */
7730 event_mask |= HL_NOTIFIER_EVENT_TPC_ASSERT;7731 event_mask |= HL_NOTIFIER_EVENT_TPC_ASSERT;
7731 gaudi_print_irq_info(hdev, event_type, true);7732 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7732 reset_required = gaudi_tpc_read_interrupts(hdev,7733 reset_required = gaudi_tpc_read_interrupts(hdev,
7733 tpc_dec_event_to_tpc_id(event_type),7734 tpc_dec_event_to_tpc_id(event_type),
7734 "AXI_SLV_DEC_Error");7735 "AXI_SLV_DEC_Error");
@@ -7753,7 +7754,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 18 unmodified lines
7753 case GAUDI_EVENT_TPC5_KRN_ERR:7754 case GAUDI_EVENT_TPC5_KRN_ERR:
7754 case GAUDI_EVENT_TPC6_KRN_ERR:7755 case GAUDI_EVENT_TPC6_KRN_ERR:
7755 case GAUDI_EVENT_TPC7_KRN_ERR:7756 case GAUDI_EVENT_TPC7_KRN_ERR:
7756 gaudi_print_irq_info(hdev, event_type, true);7757 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7757 reset_required = gaudi_tpc_read_interrupts(hdev,7758 reset_required = gaudi_tpc_read_interrupts(hdev,
7758 tpc_krn_event_to_tpc_id(event_type),7759 tpc_krn_event_to_tpc_id(event_type),
7759 "KRN_ERR");7760 "KRN_ERR");
@@ -7792,7 +7793,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 32 unmodified lines
7792 case GAUDI_EVENT_HBM_0_SERR ... GAUDI_EVENT_HBM_3_SERR:7793 case GAUDI_EVENT_HBM_0_SERR ... GAUDI_EVENT_HBM_3_SERR:
7793 fallthrough;7794 fallthrough;
7794 case GAUDI_EVENT_MMU_SERR:7795 case GAUDI_EVENT_MMU_SERR:
7795 gaudi_print_irq_info(hdev, event_type, true);7796 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7796 gaudi_handle_ecc_event(hdev, event_type, &eq_entry->ecc_data);7797 gaudi_handle_ecc_event(hdev, event_type, &eq_entry->ecc_data);
7797 hl_fw_unmask_irq(hdev, event_type);7798 hl_fw_unmask_irq(hdev, event_type);
7798 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7799 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
@@ -7802,14 +7803,14 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 3 unmodified lines
7802 case GAUDI_EVENT_CPU_AXI_SPLITTER:7803 case GAUDI_EVENT_CPU_AXI_SPLITTER:
7803 case GAUDI_EVENT_PSOC_AXI_DEC:7804 case GAUDI_EVENT_PSOC_AXI_DEC:
7804 case GAUDI_EVENT_PSOC_PRSTN_FALL:7805 case GAUDI_EVENT_PSOC_PRSTN_FALL:
7805 gaudi_print_irq_info(hdev, event_type, true);7806 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7806 hl_fw_unmask_irq(hdev, event_type);7807 hl_fw_unmask_irq(hdev, event_type);
7807 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7808 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7808 break;7809 break;
7809 7810
7810 case GAUDI_EVENT_MMU_PAGE_FAULT:7811 case GAUDI_EVENT_MMU_PAGE_FAULT:
7811 case GAUDI_EVENT_MMU_WR_PERM:7812 case GAUDI_EVENT_MMU_WR_PERM:
7812 gaudi_print_irq_info(hdev, event_type, true);7813 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7813 hl_fw_unmask_irq(hdev, event_type);7814 hl_fw_unmask_irq(hdev, event_type);
7814 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;7815 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;
7815 break;7816 break;
@@ -7838,14 +7839,14 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 22 unmodified lines
7838 case GAUDI_EVENT_NIC4_QM1:7839 case GAUDI_EVENT_NIC4_QM1:
7839 case GAUDI_EVENT_DMA0_CORE ... GAUDI_EVENT_DMA7_CORE:7840 case GAUDI_EVENT_DMA0_CORE ... GAUDI_EVENT_DMA7_CORE:
7840 case GAUDI_EVENT_TPC0_QM ... GAUDI_EVENT_TPC7_QM:7841 case GAUDI_EVENT_TPC0_QM ... GAUDI_EVENT_TPC7_QM:
7841 gaudi_print_irq_info(hdev, event_type, true);7842 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7842 gaudi_handle_qman_err(hdev, event_type, &event_mask);7843 gaudi_handle_qman_err(hdev, event_type, &event_mask);
7843 hl_fw_unmask_irq(hdev, event_type);7844 hl_fw_unmask_irq(hdev, event_type);
7844 event_mask |= (HL_NOTIFIER_EVENT_USER_ENGINE_ERR | HL_NOTIFIER_EVENT_DEVICE_RESET);7845 event_mask |= (HL_NOTIFIER_EVENT_USER_ENGINE_ERR | HL_NOTIFIER_EVENT_DEVICE_RESET);
7845 break;7846 break;
7846 7847
7847 case GAUDI_EVENT_RAZWI_OR_ADC_SW:7848 case GAUDI_EVENT_RAZWI_OR_ADC_SW:
7848 gaudi_print_irq_info(hdev, event_type, true);7849 gaudi_print_irq_info(hdev, event_type, true, &event_mask);
7849 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;7850 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;
7850 goto reset_device;7851 goto reset_device;
7851 7852
@@ -7858,7 +7859,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 6 unmodified lines
7858 case GAUDI_EVENT_TPC6_BMON_SPMU:7859 case GAUDI_EVENT_TPC6_BMON_SPMU:
7859 case GAUDI_EVENT_TPC7_BMON_SPMU:7860 case GAUDI_EVENT_TPC7_BMON_SPMU:
7860 case GAUDI_EVENT_DMA_BM_CH0 ... GAUDI_EVENT_DMA_BM_CH7:7861 case GAUDI_EVENT_DMA_BM_CH0 ... GAUDI_EVENT_DMA_BM_CH7:
7861 gaudi_print_irq_info(hdev, event_type, false);7862 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7862 hl_fw_unmask_irq(hdev, event_type);7863 hl_fw_unmask_irq(hdev, event_type);
7863 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;7864 event_mask |= HL_NOTIFIER_EVENT_USER_ENGINE_ERR;
7864 break;7865 break;
@@ -7870,7 +7871,7 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 5 unmodified lines
7870 break;7871 break;
7871 7872
7872 case GAUDI_EVENT_DMA_IF_SEI_0 ... GAUDI_EVENT_DMA_IF_SEI_3:7873 case GAUDI_EVENT_DMA_IF_SEI_0 ... GAUDI_EVENT_DMA_IF_SEI_3:
7873 gaudi_print_irq_info(hdev, event_type, false);7874 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7874 gaudi_print_sm_sei_info(hdev, event_type,7875 gaudi_print_sm_sei_info(hdev, event_type,
7875 &eq_entry->sm_sei_data);7876 &eq_entry->sm_sei_data);
7876 rc = hl_state_dump(hdev);7877 rc = hl_state_dump(hdev);
@@ -7899,18 +7900,18 @@ static void gaudi_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entr · 22 unmodified lines
7899 break;7900 break;
7900 7901
7901 case GAUDI_EVENT_DEV_RESET_REQ:7902 case GAUDI_EVENT_DEV_RESET_REQ:
7902 gaudi_print_irq_info(hdev, event_type, false);7903 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7903 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7904 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7904 goto reset_device;7905 goto reset_device;
7905 7906
7906 case GAUDI_EVENT_PKT_QUEUE_OUT_SYNC:7907 case GAUDI_EVENT_PKT_QUEUE_OUT_SYNC:
7907 gaudi_print_irq_info(hdev, event_type, false);7908 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7908 gaudi_print_out_of_sync_info(hdev, &eq_entry->pkt_sync_err);7909 gaudi_print_out_of_sync_info(hdev, &eq_entry->pkt_sync_err);
7909 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7910 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7910 goto reset_device;7911 goto reset_device;
7911 7912
7912 case GAUDI_EVENT_FW_ALIVE_S:7913 case GAUDI_EVENT_FW_ALIVE_S:
7913 gaudi_print_irq_info(hdev, event_type, false);7914 gaudi_print_irq_info(hdev, event_type, false, &event_mask);
7914 gaudi_print_fw_alive_info(hdev, &eq_entry->fw_alive);7915 gaudi_print_fw_alive_info(hdev, &eq_entry->fw_alive);
7915 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;7916 event_mask |= HL_NOTIFIER_EVENT_GENERAL_HW_ERR;
7916 goto reset_device;7917 goto reset_device;
include/uapi/misc/habanalabs.h+2−0
@@ -721,6 +721,7 @@ enum hl_server_type { · 720 unmodified lines
721 * HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE - Indicates device is unavailable721 * HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE - Indicates device is unavailable
722 * HL_NOTIFIER_EVENT_USER_ENGINE_ERR - Indicates device engine in error state722 * HL_NOTIFIER_EVENT_USER_ENGINE_ERR - Indicates device engine in error state
723 * HL_NOTIFIER_EVENT_GENERAL_HW_ERR - Indicates device HW error723 * HL_NOTIFIER_EVENT_GENERAL_HW_ERR - Indicates device HW error
724 * HL_NOTIFIER_EVENT_RAZWI - Indicates razwi happened
724 */725 */
725#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)726#define HL_NOTIFIER_EVENT_TPC_ASSERT (1ULL << 0)
726#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)727#define HL_NOTIFIER_EVENT_UNDEFINED_OPCODE (1ULL << 1)
@@ -729,6 +730,7 @@ enum hl_server_type { · 2 unmodified lines
729#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)730#define HL_NOTIFIER_EVENT_DEVICE_UNAVAILABLE (1ULL << 4)
730#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)731#define HL_NOTIFIER_EVENT_USER_ENGINE_ERR (1ULL << 5)
731#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)732#define HL_NOTIFIER_EVENT_GENERAL_HW_ERR (1ULL << 6)
733#define HL_NOTIFIER_EVENT_RAZWI (1ULL << 7)
732 734
733/* Opcode for management ioctl735/* Opcode for management ioctl
734 *736 *