Commit 1a6609cd authored by Ofir Bitton's avatar Ofir Bitton Committed by Oded Gabbay

habanalabs: naming refactor of user interrupt flow

Current naming convention can be misleading. Hence renaming some
variables and defines in order to be more explicit.
Signed-off-by: default avatarOfir Bitton <obitton@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 2b9e583d
...@@ -1080,7 +1080,7 @@ void hl_release_pending_user_interrupts(struct hl_device *hdev) ...@@ -1080,7 +1080,7 @@ void hl_release_pending_user_interrupts(struct hl_device *hdev)
wake_pending_user_interrupt_threads(interrupt); wake_pending_user_interrupt_threads(interrupt);
} }
interrupt = &hdev->common_user_interrupt; interrupt = &hdev->common_user_cq_interrupt;
wake_pending_user_interrupt_threads(interrupt); wake_pending_user_interrupt_threads(interrupt);
} }
...@@ -3373,8 +3373,8 @@ static int hl_interrupt_wait_ioctl(struct hl_fpriv *hpriv, void *data) ...@@ -3373,8 +3373,8 @@ static int hl_interrupt_wait_ioctl(struct hl_fpriv *hpriv, void *data)
int_idx = interrupt_id - first_interrupt + prop->user_dec_intr_count; int_idx = interrupt_id - first_interrupt + prop->user_dec_intr_count;
interrupt = &hdev->user_interrupt[int_idx]; interrupt = &hdev->user_interrupt[int_idx];
} else if (interrupt_id == HL_COMMON_USER_INTERRUPT_ID) { } else if (interrupt_id == HL_COMMON_USER_CQ_INTERRUPT_ID) {
interrupt = &hdev->common_user_interrupt; interrupt = &hdev->common_user_cq_interrupt;
} else { } else {
dev_err(hdev->dev, "invalid user interrupt %u", interrupt_id); dev_err(hdev->dev, "invalid user interrupt %u", interrupt_id);
return -EINVAL; return -EINVAL;
......
...@@ -76,7 +76,7 @@ struct hl_fpriv; ...@@ -76,7 +76,7 @@ struct hl_fpriv;
#define HL_INVALID_QUEUE UINT_MAX #define HL_INVALID_QUEUE UINT_MAX
#define HL_COMMON_USER_INTERRUPT_ID 0xFFF #define HL_COMMON_USER_CQ_INTERRUPT_ID 0xFFF
#define HL_STATE_DUMP_HIST_LEN 5 #define HL_STATE_DUMP_HIST_LEN 5
...@@ -2952,8 +2952,8 @@ struct hl_reset_info { ...@@ -2952,8 +2952,8 @@ struct hl_reset_info {
* @user_interrupt: array of hl_user_interrupt. upon the corresponding user * @user_interrupt: array of hl_user_interrupt. upon the corresponding user
* interrupt, driver will monitor the list of fences * interrupt, driver will monitor the list of fences
* registered to this interrupt. * registered to this interrupt.
* @common_user_interrupt: common user interrupt for all user interrupts. * @common_user_cq_interrupt: common user CQ interrupt for all user CQ interrupts.
* upon any user interrupt, driver will monitor the * upon any user CQ interrupt, driver will monitor the
* list of fences registered to this common structure. * list of fences registered to this common structure.
* @shadow_cs_queue: pointer to a shadow queue that holds pointers to * @shadow_cs_queue: pointer to a shadow queue that holds pointers to
* outstanding command submissions. * outstanding command submissions.
...@@ -3118,7 +3118,7 @@ struct hl_device { ...@@ -3118,7 +3118,7 @@ struct hl_device {
enum hl_asic_type asic_type; enum hl_asic_type asic_type;
struct hl_cq *completion_queue; struct hl_cq *completion_queue;
struct hl_user_interrupt *user_interrupt; struct hl_user_interrupt *user_interrupt;
struct hl_user_interrupt common_user_interrupt; struct hl_user_interrupt common_user_cq_interrupt;
struct hl_cs **shadow_cs_queue; struct hl_cs **shadow_cs_queue;
struct workqueue_struct **cq_wq; struct workqueue_struct **cq_wq;
struct workqueue_struct *eq_wq; struct workqueue_struct *eq_wq;
......
...@@ -269,7 +269,7 @@ static int handle_registration_node(struct hl_device *hdev, struct hl_user_pendi ...@@ -269,7 +269,7 @@ static int handle_registration_node(struct hl_device *hdev, struct hl_user_pendi
return 0; return 0;
} }
static void handle_user_cq(struct hl_device *hdev, struct hl_user_interrupt *user_cq) static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interrupt *intr)
{ {
struct hl_user_pending_interrupt *pend, *temp_pend; struct hl_user_pending_interrupt *pend, *temp_pend;
struct list_head *ts_reg_free_list_head = NULL; struct list_head *ts_reg_free_list_head = NULL;
...@@ -291,8 +291,8 @@ static void handle_user_cq(struct hl_device *hdev, struct hl_user_interrupt *use ...@@ -291,8 +291,8 @@ static void handle_user_cq(struct hl_device *hdev, struct hl_user_interrupt *use
if (!job) if (!job)
return; return;
spin_lock(&user_cq->wait_list_lock); spin_lock(&intr->wait_list_lock);
list_for_each_entry_safe(pend, temp_pend, &user_cq->wait_list_head, wait_list_node) { list_for_each_entry_safe(pend, temp_pend, &intr->wait_list_head, wait_list_node) {
if ((pend->cq_kernel_addr && *(pend->cq_kernel_addr) >= pend->cq_target_value) || if ((pend->cq_kernel_addr && *(pend->cq_kernel_addr) >= pend->cq_target_value) ||
!pend->cq_kernel_addr) { !pend->cq_kernel_addr) {
if (pend->ts_reg_info.buf) { if (pend->ts_reg_info.buf) {
...@@ -309,7 +309,7 @@ static void handle_user_cq(struct hl_device *hdev, struct hl_user_interrupt *use ...@@ -309,7 +309,7 @@ static void handle_user_cq(struct hl_device *hdev, struct hl_user_interrupt *use
} }
} }
} }
spin_unlock(&user_cq->wait_list_lock); spin_unlock(&intr->wait_list_lock);
if (ts_reg_free_list_head) { if (ts_reg_free_list_head) {
INIT_WORK(&job->free_obj, hl_ts_free_objects); INIT_WORK(&job->free_obj, hl_ts_free_objects);
...@@ -339,10 +339,10 @@ irqreturn_t hl_irq_handler_user_interrupt(int irq, void *arg) ...@@ -339,10 +339,10 @@ irqreturn_t hl_irq_handler_user_interrupt(int irq, void *arg)
*/ */
if (!user_int->is_decoder) if (!user_int->is_decoder)
/* Handle user cq interrupts registered on all interrupts */ /* Handle user cq interrupts registered on all interrupts */
handle_user_cq(hdev, &hdev->common_user_interrupt); handle_user_interrupt(hdev, &hdev->common_user_cq_interrupt);
/* Handle user cq or decoder interrupts registered on this specific irq */ /* Handle user cq or decoder interrupts registered on this specific irq */
handle_user_cq(hdev, user_int); handle_user_interrupt(hdev, user_int);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -2891,9 +2891,9 @@ static void gaudi2_user_interrupt_setup(struct hl_device *hdev) ...@@ -2891,9 +2891,9 @@ static void gaudi2_user_interrupt_setup(struct hl_device *hdev)
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
int i, j, k; int i, j, k;
/* Initialize common user interrupt */ /* Initialize common user CQ interrupt */
HL_USR_INTR_STRUCT_INIT(hdev->common_user_interrupt, hdev, HL_COMMON_USER_INTERRUPT_ID, HL_USR_INTR_STRUCT_INIT(hdev->common_user_cq_interrupt, hdev,
false); HL_COMMON_USER_CQ_INTERRUPT_ID, false);
/* User interrupts structure holds both decoder and user interrupts from various engines. /* User interrupts structure holds both decoder and user interrupts from various engines.
* We first initialize the decoder interrupts and then we add the user interrupts. * We first initialize the decoder interrupts and then we add the user interrupts.
......
...@@ -1442,6 +1442,7 @@ union hl_cs_args { ...@@ -1442,6 +1442,7 @@ union hl_cs_args {
#define HL_WAIT_CS_FLAGS_INTERRUPT 0x2 #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
#define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000 #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
#define HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT 0xFFF00000
#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4 #define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
#define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10 #define HL_WAIT_CS_FLAGS_INTERRUPT_KERNEL_CQ 0x10
#define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20 #define HL_WAIT_CS_FLAGS_REGISTER_INTERRUPT 0x20
...@@ -1491,8 +1492,10 @@ struct hl_wait_cs_in { ...@@ -1491,8 +1492,10 @@ struct hl_wait_cs_in {
/* HL_WAIT_CS_FLAGS_* /* HL_WAIT_CS_FLAGS_*
* If HL_WAIT_CS_FLAGS_INTERRUPT is set, this field should include * If HL_WAIT_CS_FLAGS_INTERRUPT is set, this field should include
* interrupt id according to HL_WAIT_CS_FLAGS_INTERRUPT_MASK, in order * interrupt id according to HL_WAIT_CS_FLAGS_INTERRUPT_MASK
* not to specify an interrupt id ,set mask to all 1s. *
* in order to wait for any CQ interrupt, set interrupt value to
* HL_WAIT_CS_FLAGS_ANY_CQ_INTERRUPT.
*/ */
__u32 flags; __u32 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment