Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

accel/habanalabs: dump the EQ entries headers on EQ heartbeat failure

Add a dump of the EQ entries headers upon a EQ heartbeat failure.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Ofir Bitton <obitton@habana.ai>
Signed-off-by: Ofir Bitton <obitton@habana.ai>

authored by

Tomer Tayar and committed by
Ofir Bitton
c4548eee 795f93e6

+31
+2
drivers/accel/habanalabs/common/device.c
··· 1082 1082 atomic_read(&hdev->kernel_queues[cpu_q_id].ci), 1083 1083 atomic_read(&hdev->kernel_queues[cpu_q_id].ci) & pq_pi_mask); 1084 1084 1085 + hl_eq_dump(hdev, &hdev->event_queue); 1086 + 1085 1087 return false; 1086 1088 } 1087 1089
+1
drivers/accel/habanalabs/common/habanalabs.h
··· 3754 3754 void hl_eq_fini(struct hl_device *hdev, struct hl_eq *q); 3755 3755 void hl_cq_reset(struct hl_device *hdev, struct hl_cq *q); 3756 3756 void hl_eq_reset(struct hl_device *hdev, struct hl_eq *q); 3757 + void hl_eq_dump(struct hl_device *hdev, struct hl_eq *q); 3757 3758 irqreturn_t hl_irq_handler_cq(int irq, void *arg); 3758 3759 irqreturn_t hl_irq_handler_eq(int irq, void *arg); 3759 3760 irqreturn_t hl_irq_handler_dec_abnrm(int irq, void *arg);
+25
drivers/accel/habanalabs/common/irq.c
··· 697 697 698 698 memset(q->kernel_address, 0, q->size); 699 699 } 700 + 701 + void hl_eq_dump(struct hl_device *hdev, struct hl_eq *q) 702 + { 703 + u32 eq_length, eqe_size, ctl, ready, mode, type, index; 704 + struct hl_eq_header *hdr; 705 + u8 *ptr; 706 + int i; 707 + 708 + eq_length = HL_EQ_LENGTH; 709 + eqe_size = q->size / HL_EQ_LENGTH; 710 + 711 + dev_info(hdev->dev, "Contents of EQ entries headers:\n"); 712 + 713 + for (i = 0, ptr = q->kernel_address ; i < eq_length ; ++i, ptr += eqe_size) { 714 + hdr = (struct hl_eq_header *) ptr; 715 + ctl = le32_to_cpu(hdr->ctl); 716 + ready = FIELD_GET(EQ_CTL_READY_MASK, ctl); 717 + mode = FIELD_GET(EQ_CTL_EVENT_MODE_MASK, ctl); 718 + type = FIELD_GET(EQ_CTL_EVENT_TYPE_MASK, ctl); 719 + index = FIELD_GET(EQ_CTL_INDEX_MASK, ctl); 720 + 721 + dev_info(hdev->dev, "%02u: %#010x [ready: %u, mode %u, type %04u, index %05u]\n", 722 + i, ctl, ready, mode, type, index); 723 + } 724 + }
+3
include/linux/habanalabs/cpucp_if.h
··· 397 397 #define EQ_CTL_READY_SHIFT 31 398 398 #define EQ_CTL_READY_MASK 0x80000000 399 399 400 + #define EQ_CTL_EVENT_MODE_SHIFT 28 401 + #define EQ_CTL_EVENT_MODE_MASK 0x70000000 402 + 400 403 #define EQ_CTL_EVENT_TYPE_SHIFT 16 401 404 #define EQ_CTL_EVENT_TYPE_MASK 0x0FFF0000 402 405