From: "Jackson.lee" <jackson.lee@chipsnmedia.com>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
sebastian.fricke@collabora.com, nicolas.dufresne@collabora.com,
bob.beckett@collabora.com, dafna.hirschfeld@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
jackson.lee@chipsnmedia.com, lafley.kim@chipsnmedia.com,
b-brnich@ti.com, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com
Subject: [PATCH v2 2/4] media: chips-media: wave5: Avoid race condition for interrupt handling
Date: Tue, 17 Dec 2024 13:51:23 +0900 [thread overview]
Message-ID: <20241217045125.58-3-jackson.lee@chipsnmedia.com> (raw)
In-Reply-To: <20241217045125.58-1-jackson.lee@chipsnmedia.com>
In case of multi instance, interrupts can occur for other instances as
soon as interrupt is cleared. If driver reads the instance_info after
clearing the interrupt, it is not guaranteed that the instance_info is
valid for the current interrupt.
Read the instance_info register for each interrupt before clearing the
interrupt.
Signed-off-by: Jackson.lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
drivers/media/platform/chips-media/wave5/wave5-vpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
index 6b294a2d6717..63a607d10433 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
@@ -55,12 +55,12 @@ static void wave5_vpu_handle_irq(void *dev_id)
struct vpu_device *dev = dev_id;
irq_reason = wave5_vdi_read_register(dev, W5_VPU_VINT_REASON);
+ seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO);
+ cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST);
wave5_vdi_write_register(dev, W5_VPU_VINT_REASON_CLR, irq_reason);
wave5_vdi_write_register(dev, W5_VPU_VINT_CLEAR, 0x1);
list_for_each_entry(inst, &dev->instances, list) {
- seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO);
- cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST);
if (irq_reason & BIT(INT_WAVE5_INIT_SEQ) ||
irq_reason & BIT(INT_WAVE5_ENC_SET_PARAM)) {
--
2.43.0
next prev parent reply other threads:[~2024-12-17 4:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 4:51 [PATCH v2 0/4] Fix critical bugs Jackson.lee
2024-12-17 4:51 ` [PATCH v2 1/4] media: chips-media: wave5: Fix to display gray color on screen Jackson.lee
2024-12-17 14:03 ` Nicolas Dufresne
2024-12-18 2:58 ` jackson.lee
2024-12-17 4:51 ` Jackson.lee [this message]
2024-12-17 14:04 ` [PATCH v2 2/4] media: chips-media: wave5: Avoid race condition for interrupt handling Nicolas Dufresne
2024-12-18 3:02 ` jackson.lee
2024-12-17 4:51 ` [PATCH v2 3/4] media: chips-media: wave5: Fix hang after seeking Jackson.lee
2024-12-17 14:05 ` Nicolas Dufresne
2024-12-18 3:06 ` jackson.lee
2024-12-17 4:51 ` [PATCH v2 4/4] media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster Jackson.lee
2025-01-07 1:39 ` [PATCH v2 0/4] Fix critical bugs jackson.lee
2025-02-03 0:54 ` jackson.lee
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=20241217045125.58-3-jackson.lee@chipsnmedia.com \
--to=jackson.lee@chipsnmedia.com \
--cc=b-brnich@ti.com \
--cc=bob.beckett@collabora.com \
--cc=dafna.hirschfeld@collabora.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=hverkuil@xs4all.nl \
--cc=lafley.kim@chipsnmedia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nas.chung@chipsnmedia.com \
--cc=nicolas.dufresne@collabora.com \
--cc=sebastian.fricke@collabora.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®