From: Yaohan Li <shunsheng1218@gmail.com>
To: Daniel Scally <dan.scally@ideasonboard.com>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans Verkuil <hverkuil@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: renesas: rzv2h-ivc: stop interrupt before disabling clocks on suspend
Date: Thu, 3 Dec 2026 16:53:19 +0800 [thread overview]
Message-ID: <20261203085319.2392838-1-shunsheng1218@gmail.com> (raw)
rzv2h_ivc_runtime_resume() enables the clocks, deasserts resets, unmasks
RZV2H_IVC_REG_FM_INT_EN, and finally requests ivc->irqnum.
rzv2h_ivc_runtime_suspend() tears these down in the wrong order: it
asserts resets and disables all three clocks while RZV2H_IVC_REG_FM_INT_EN
is still enabled and before calling free_irq(). If an interrupt arrives
or is still running during that window, rzv2h_ivc_isr() can call
rzv2h_ivc_transfer_buffer() and write MMIO registers while the block is
held in reset with its clocks gated.
Mask RZV2H_IVC_REG_FM_INT_EN and free ivc->irqnum before asserting resets
and disabling the clocks, matching the resume path in reverse.
Fixes: f0b3984d821b ("media: platform: Add Renesas Input Video Control block driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>
---
Based on v7.4-rc5 (fe6ff8d5d675); applies cleanly on media-committers fixes
and next. Scoped strictly to the rzv2h_ivc_runtime_suspend() teardown
order; active-remove / V4L2 lifetime is left untouched.
I don't have physical Renesas RZ/V2H hardware, so I tested this in QEMU
(x86_64, KASAN + PROVE_LOCKING) with the in-tree rzv2h-ivc.ko bound to a
platform device backed by reserved MMIO, three CCF clk_hw clocks, and a
virtual IRQ across 5 runtime suspend/resume and system force-suspend/resume
cycles (unmodified driver disables all three clocks while FM_INT_EN is still
set and ivc->irqnum is still bound; patched clears FM_INT_EN and frees the
IRQ first with 0 KASAN or lockdep warnings). Also build-tested on x86_64
and arm64 with W=1 (0 warnings).
AI assistance: Claude and Gemini helped check the runtime PM ordering, write
the QEMU test module, and draft the changelog. I reviewed the driver code,
test logs, and final patch myself.
drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
index e2a14ebeb1141..937891e45e38b 100644
--- a/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
+++ b/drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-dev.c
@@ -164,9 +164,10 @@ static int rzv2h_ivc_runtime_suspend(struct device *dev)
{
struct rzv2h_ivc *ivc = dev_get_drvdata(dev);
+ rzv2h_ivc_write(ivc, RZV2H_IVC_REG_FM_INT_EN, 0x0);
+ free_irq(ivc->irqnum, dev);
reset_control_bulk_assert(ARRAY_SIZE(ivc->resets), ivc->resets);
clk_bulk_disable_unprepare(ARRAY_SIZE(ivc->clks), ivc->clks);
- free_irq(ivc->irqnum, dev);
return 0;
}
--
2.34.1
next reply other threads:[~2026-12-03 8:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:53 Yaohan Li [this message]
2026-12-03 9:19 ` Jacopo Mondi
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=20261203085319.2392838-1-shunsheng1218@gmail.com \
--to=shunsheng1218@gmail.com \
--cc=dan.scally@ideasonboard.com \
--cc=hverkuil@kernel.org \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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®