From: Irui Wang <irui.wang@mediatek.com>
To: <hverkuil@xs4all.nl>, <acourbot@chromium.org>,
<mchehab@kernel.org>, <matthias.bgg@gmail.com>
Cc: <linux-media@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <Maoguang.Meng@mediatek.com>,
<Longfei.Wang@mediatek.com>, <Yunfei.Dong@mediatek.com>,
<Andrew-CT.Chen@mediatek.com>, <erin.lo@mediatek.com>,
<PoChun.Lin@mediatek.com>, <houlong.wei@mediatek.com>,
<hsinyi@google.com>, <irui.wang@mediatek.com>,
<srv_heupstream@mediatek.com>
Subject: [PATCH 2/2] media: mtk-vpu: dump VPU status when IPI times out
Date: Thu, 29 Oct 2020 09:17:21 +0800 [thread overview]
Message-ID: <20201029011721.6705-2-irui.wang@mediatek.com> (raw)
In-Reply-To: <20201029011721.6705-1-irui.wang@mediatek.com>
when IPI time out, dump VPU status to get more debug information
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
drivers/media/platform/mtk-vpu/mtk_vpu.c | 33 +++++++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c
index 86ab808ba877..043894f7188c 100644
--- a/drivers/media/platform/mtk-vpu/mtk_vpu.c
+++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
@@ -61,6 +61,8 @@
#define VPU_IDLE_REG 0x002C
#define VPU_INT_STATUS 0x0034
#define VPU_PC_REG 0x0060
+#define VPU_SP_REG 0x0064
+#define VPU_RA_REG 0x0068
#define VPU_WDT_REG 0x0084
/* vpu inter-processor communication interrupt */
@@ -268,6 +270,20 @@ static int vpu_clock_enable(struct mtk_vpu *vpu)
return ret;
}
+static void vpu_dump_status(struct mtk_vpu *vpu)
+{
+ dev_info(vpu->dev,
+ "vpu: run %x, pc = 0x%x, ra = 0x%x, sp = 0x%x, idle = 0x%x\n"
+ "vpu: int %x, hv = 0x%x, vh = 0x%x, wdt = 0x%x\n",
+ vpu_running(vpu), vpu_cfg_readl(vpu, VPU_PC_REG),
+ vpu_cfg_readl(vpu, VPU_RA_REG), vpu_cfg_readl(vpu, VPU_SP_REG),
+ vpu_cfg_readl(vpu, VPU_IDLE_REG),
+ vpu_cfg_readl(vpu, VPU_INT_STATUS),
+ vpu_cfg_readl(vpu, HOST_TO_VPU),
+ vpu_cfg_readl(vpu, VPU_TO_HOST),
+ vpu_cfg_readl(vpu, VPU_WDT_REG));
+}
+
int vpu_ipi_register(struct platform_device *pdev,
enum ipi_id id, ipi_handler_t handler,
const char *name, void *priv)
@@ -328,6 +344,7 @@ int vpu_ipi_send(struct platform_device *pdev,
if (time_after(jiffies, timeout)) {
dev_err(vpu->dev, "vpu_ipi_send: IPI timeout!\n");
ret = -EIO;
+ vpu_dump_status(vpu);
goto mut_unlock;
}
} while (vpu_cfg_readl(vpu, HOST_TO_VPU));
@@ -347,8 +364,9 @@ int vpu_ipi_send(struct platform_device *pdev,
ret = wait_event_timeout(vpu->ack_wq, vpu->ipi_id_ack[id], timeout);
vpu->ipi_id_ack[id] = false;
if (ret == 0) {
- dev_err(vpu->dev, "vpu ipi %d ack time out !", id);
+ dev_err(vpu->dev, "vpu ipi %d ack time out !\n", id);
ret = -EIO;
+ vpu_dump_status(vpu);
goto clock_disable;
}
vpu_clock_disable(vpu);
@@ -633,7 +651,7 @@ static ssize_t vpu_debug_read(struct file *file, char __user *user_buf,
{
char buf[256];
unsigned int len;
- unsigned int running, pc, vpu_to_host, host_to_vpu, wdt;
+ unsigned int running, pc, vpu_to_host, host_to_vpu, wdt, idle, ra, sp;
int ret;
struct device *dev = file->private_data;
struct mtk_vpu *vpu = dev_get_drvdata(dev);
@@ -650,6 +668,10 @@ static ssize_t vpu_debug_read(struct file *file, char __user *user_buf,
wdt = vpu_cfg_readl(vpu, VPU_WDT_REG);
host_to_vpu = vpu_cfg_readl(vpu, HOST_TO_VPU);
vpu_to_host = vpu_cfg_readl(vpu, VPU_TO_HOST);
+ ra = vpu_cfg_readl(vpu, VPU_RA_REG);
+ sp = vpu_cfg_readl(vpu, VPU_SP_REG);
+ idle = vpu_cfg_readl(vpu, VPU_IDLE_REG);
+
vpu_clock_disable(vpu);
if (running) {
@@ -658,9 +680,12 @@ static ssize_t vpu_debug_read(struct file *file, char __user *user_buf,
"PC: 0x%x\n"
"WDT: 0x%x\n"
"Host to VPU: 0x%x\n"
- "VPU to Host: 0x%x\n",
+ "VPU to Host: 0x%x\n"
+ "SP: 0x%x\n"
+ "RA: 0x%x\n"
+ "idle: 0x%x\n",
vpu->run.fw_ver, pc, wdt,
- host_to_vpu, vpu_to_host);
+ host_to_vpu, vpu_to_host, sp, ra, idle);
} else {
len = snprintf(buf, sizeof(buf), "VPU not running\n");
}
--
2.25.1
next prev parent reply other threads:[~2020-10-29 1:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 1:17 [PATCH 1/2] media: mtk-vpu: VPU should be in idle state before system is suspended Irui Wang
2020-10-29 1:17 ` Irui Wang [this message]
2020-11-25 2:46 ` [PATCH 2/2] media: mtk-vpu: dump VPU status when IPI times out Alexandre Courbot
2020-11-25 2:46 ` [PATCH 1/2] media: mtk-vpu: VPU should be in idle state before system is suspended Alexandre Courbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029011721.6705-2-irui.wang@mediatek.com \
--to=irui.wang@mediatek.com \
--cc=Andrew-CT.Chen@mediatek.com \
--cc=Longfei.Wang@mediatek.com \
--cc=Maoguang.Meng@mediatek.com \
--cc=PoChun.Lin@mediatek.com \
--cc=Yunfei.Dong@mediatek.com \
--cc=acourbot@chromium.org \
--cc=erin.lo@mediatek.com \
--cc=houlong.wei@mediatek.com \
--cc=hsinyi@google.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=srv_heupstream@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®