157 lines
6.0 KiB
Diff
157 lines
6.0 KiB
Diff
From bf00d98f8515cd28149d450a8255c6826a696fa1 Mon Sep 17 00:00:00 2001
|
|
From: tangdaoyong <tangdaoyong@eswincomputing.com>
|
|
Date: Fri, 11 Oct 2024 09:37:19 +0800
|
|
Subject: [PATCH 185/219] fix:sdk mc linstener thread cannot exit
|
|
|
|
Changelogs:
|
|
1. sdk mc linstener thread cannot exit.
|
|
|
|
Signed-off-by: tangdaoyong <tangdaoyong@eswincomputing.com>
|
|
---
|
|
.../staging/media/eswin/vdec/hantro_vcmd.c | 37 ++++++++++++-------
|
|
1 file changed, 23 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/drivers/staging/media/eswin/vdec/hantro_vcmd.c b/drivers/staging/media/eswin/vdec/hantro_vcmd.c
|
|
index 80b75ffc9d78..7fd375c41006 100644
|
|
--- a/drivers/staging/media/eswin/vdec/hantro_vcmd.c
|
|
+++ b/drivers/staging/media/eswin/vdec/hantro_vcmd.c
|
|
@@ -1602,12 +1602,17 @@ static long release_cmdbuf(struct file *filp, u16 cmdbuf_id)
|
|
fp_priv = (struct filp_priv *)filp->private_data;
|
|
|
|
/*get cmdbuf object according to cmdbuf_id*/
|
|
+ LOCK_CMDBUF_NODE(cmdbuf_id, flags);
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
+ UNLOCK_CMDBUF_NODE(cmdbuf_id, flags);
|
|
//should not happen
|
|
LOG_ERR("ERROR cmdbuf_id !!\n");
|
|
return -1;
|
|
}
|
|
+ global_cmdbuf_node[cmdbuf_id] = NULL;
|
|
+ UNLOCK_CMDBUF_NODE(cmdbuf_id, flags);
|
|
+
|
|
cmdbuf_obj = (struct cmdbuf_obj *)new_cmdbuf_node->data;
|
|
if (cmdbuf_obj->filp != filp) {
|
|
//should not happen
|
|
@@ -2002,6 +2007,7 @@ static unsigned int wait_cmdbuf_ready(struct file *filp, u16 cmdbuf_id,
|
|
struct cmdbuf_obj *cmdbuf_obj = NULL;
|
|
bi_list_node *new_cmdbuf_node = NULL;
|
|
struct hantrovcmd_dev *dev = NULL;
|
|
+ unsigned int ret = 0;
|
|
|
|
if (cmdbuf_id != ANY_CMDBUF_ID) {
|
|
LOG_DBG("wait_cmdbuf_ready\n");
|
|
@@ -2089,13 +2095,16 @@ static unsigned int wait_cmdbuf_ready(struct file *filp, u16 cmdbuf_id,
|
|
}
|
|
if (check_mc_cmdbuf_irq(filp, cmdbuf_obj, irq_status_ret))
|
|
return 0;
|
|
- if (wait_event_interruptible(
|
|
+ ret = wait_event_interruptible_timeout(
|
|
mc_wait_queue,
|
|
- check_mc_cmdbuf_irq(filp, cmdbuf_obj,
|
|
- irq_status_ret))) {
|
|
- LOG_DBG("multicore wait queue interrupted\n");
|
|
+ check_mc_cmdbuf_irq(filp, cmdbuf_obj, irq_status_ret),
|
|
+ msecs_to_jiffies(600));
|
|
+
|
|
+ if (ret <= 0) {
|
|
+ LOG_DBG("multicore wait queue interrupted or timeout, ret = %u\n", ret);
|
|
return -ERESTARTSYS;
|
|
}
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -2310,7 +2319,7 @@ long hantrovcmd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
__put_user(cmdbuf_id, (u16 __user *)arg);
|
|
return tmp; //return core_id
|
|
}
|
|
- __put_user(0, (u16 __user *)arg);
|
|
+ //__put_user(0, (u16 __user *)arg);
|
|
return -1;
|
|
|
|
break;
|
|
@@ -4471,7 +4480,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
dev->reg_mirror,
|
|
HWIF_VCMD_CMDBUF_EXECUTING_ID);
|
|
if (cmdbuf_id >= TOTAL_DISCRETE_CMDBUF_NUM) {
|
|
- LOG_ERR("isr error cmdbuf_id greater than the ceiling !!\n");
|
|
+ LOG_ERR("isr error cmdbuf_id greater than the ceiling !! %d\n", __LINE__);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4497,7 +4506,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
cmdbuf_id = *(dev->vcmd_reg_mem_virtual_address +
|
|
EXECUTING_CMDBUF_ID_ADDR);
|
|
if (cmdbuf_id >= TOTAL_DISCRETE_CMDBUF_NUM) {
|
|
- LOG_ERR("isr error cmdbuf_id greater than the ceiling !!\n");
|
|
+ LOG_ERR("isr error cmdbuf_id greater than the ceiling !! %d\n", __LINE__);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4540,7 +4549,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (dev->hw_version_id > HW_ID_1_0_C) {
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4603,7 +4612,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (dev->hw_version_id > HW_ID_1_0_C) {
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4674,7 +4683,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (dev->hw_version_id > HW_ID_1_0_C) {
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4742,7 +4751,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (dev->hw_version_id > HW_ID_1_0_C) {
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4816,7 +4825,7 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (dev->hw_version_id > HW_ID_1_0_C) {
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
@@ -4871,14 +4880,14 @@ static irqreturn_t hantrovcmd_isr(int irq, void *dev_id)
|
|
if (cmdbuf_id) {
|
|
if (dev->hw_version_id <= HW_ID_1_0_C) {
|
|
if (cmdbuf_id >= TOTAL_DISCRETE_CMDBUF_NUM) {
|
|
- LOG_ERR("isr error cmdbuf_id greater than the ceiling !!\n");
|
|
+ LOG_ERR("isr error cmdbuf_id greater than the ceiling !! %d\n", __LINE__);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
}
|
|
new_cmdbuf_node = global_cmdbuf_node[cmdbuf_id];
|
|
if (!new_cmdbuf_node) {
|
|
- LOG_ERR("isr error cmdbuf_id !!\n");
|
|
+ LOG_ERR("ERROR cmdbuf_id line=%d, cmdbuf_id=%u!!\n", __LINE__, cmdbuf_id);
|
|
spin_unlock_irqrestore(dev->spinlock, flags);
|
|
return IRQ_HANDLED;
|
|
}
|
|
--
|
|
2.47.0
|
|
|