Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796288006; b=RY06sAB36KpJPIPCo6EvFcjvSKj0ej4tVsp82u78HkN4UtWANFlf9JKcQDpM6eG4NMAY BlQcDRsODmAeG9pE8UuU12eOeqX1/igZ5S7GC5zhOMH0AHh7m3Y9bFiv1TYIdAxA0aYMp S8R4ZpcYoSTxwQ7FM4DCqPuzgg587kjRD0xVQoBdHZvqvHNskKdEFNROmXvOjhQJ71BvJ yOJb8DWy3DPyvr5f82wndwGLtktNWSulZ6Iyt0NZBIF5CAHVhs5Mp5ecsrXGavQ96C1OJ l9/I0zY8FljZMnVdEN5J/PKloESDlh2s5bO/PttZAhI4B+uZ9UISto+qaWFFUq5uK5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796288006; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=Vp3vIcLMv6vcMLombB7J7hFQ3RSyemEshG4U4HVM3kA=; b=w1AlpzPrBnKwKsACZbP/p5+IKkopE9vn/QZ2S7bMHxwe3x2Sbm5RZp8IW0sEOJNXbc8S BpMsDlm7wpiQyFO2CI6TV0W+OnVG24lI6UXOs6qqdHvMB6G72aHiromsLeaIxQNr2ns/W J06siSxbArpiUNWx0nsKnmmTkhj1R5zlsLMSkJY4k8G74pxCmpsOny6Ise4qYNHhU9L1p C8CweMWU01SY7uOl+S32m1wC9xkbDHkICimfU1EFbkes35TxZyx+KQWZQb/T19zisqXT0 iMpiQd9yT0smeULB7bF2SHwUFoCl/hOI8tksocFF0d9FK6+99Tu53Riua8z4JbV/INw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Wr7cV4Zn; arc=none smtp.remote-ip=209.85.214.177 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59CE606A322 for ; Thu, 3 Dec 2026 08:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C59CE606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Wr7cV4Zn Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2f07a960666so111007065ad.1 for ; Thu, 03 Dec 2026 00:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796288005; x=1796892805; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Vp3vIcLMv6vcMLombB7J7hFQ3RSyemEshG4U4HVM3kA=; b=Wr7cV4ZnmcgpF/sF6QTOf+apbbYMwabbYeK3Lcn2uLbBF3HC86HFp5+uuAY8BRfYFa D0z1pQEU7Cik5uVM6hOJG3oyowRftpOrE8cZ5a4PgRCAeCRTU48W1sznqLV07va1oosC HJKWruBuwmQyX84t6zqKv9WytD8llQbAMJXd+oyAqOeFpKivHa3CiATfBCVR7yNEGmZs wqh7pMMkpLzIyMvsdDWjEhmeBLFUTRQ7zIyzFuqpF9ozOPidr+1lwrMMEBdi4wPomXAL HzdNCLCT61s6fHvxNdt/LNpbiAQ8beX7QRn5LGKUVNT36f+xbLIYlC9A2nx9kSMjlfSz lizA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796288005; x=1796892805; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Vp3vIcLMv6vcMLombB7J7hFQ3RSyemEshG4U4HVM3kA=; b=v3whwglnGM5Fx98NY8wCzdAFmIif7A2uvIwB4oIDUmfpgDCvecLwZf2YO9vctXwdJJ Tzf3eUB0mEOsGvo2mUil0VLfgqkcINi775HH1ONHHBN93fFsmviocsS0xcZZ/e7I9lFB jZUYI3v8l7h0OWvMQcdpDn8wiZCO9Dldk37HFiNhwiumCqMhfbapk686RxTxOtcaX7Pc ry3ssmLvK4xg0hcG7rQWVpM8WNOJl/ZchMdsMMquavjhBlu2BGNTksZBb01BgdNNU4ar P6sLbSha++vqqRK9nOQgn3D++XyHekbSRaVpm0Edljqk10rUPzJp8WEmsLrREq/OpOhr h0gw== X-Forwarded-Encrypted: i=1; AL+hErHlMjtJnECSS7LtCUoheUpHWkGo5u7rGLwLY2PSmE+hc/4wN4DhBuccVfCdS4BBi9hlWuKu8TxeD1oGDQ==@vger.kernel.org X-Gm-Message-State: APuU4Z8FoKNm5ZgY9duoNf2qT1J9J+cs2vA7QMHpXHNtZ/i3OU16pSUZ VXNRTACqGSa095lR2yuREhLUraJkCr6kKHosvTZuIut2VxXWWEJh9RsI X-Gm-Gg: AZFdTZcPr7JGLgG8hCTTl2TcE7aEqRrG2Ycv8wqYOxkavdJm7MtY8XMS5mTVuG8+c0G QstT2WCCXTlTZlFkwJ/+J1VVP4NvvkFRn0hVspVww3VeLEggU9rVUNYXPb6K6Ak0JTKPJ581qds VX/1gs5E4OHI/D5Uru62DQMW0y0qs3KNIT2axBZiLvV/bfn4muOMKiuGTAdic2osGUr0XBpZf3c zSMs66n8fNBg+FEVyVSjVByrnMpGDTKzP2PX73vh2vims3q/QVkjAEf5yrFBCE9p+n85V15zfPO b5fbSUfotnbv8ddYvqrJGqfUI+bjU/PoTzEtf44UgZ89fX/kWBFo4aIdCQc7Ve6ywyi03+4RSLT q82r3GF+4Luk8mHRF6S8zTwKWd0v3iidnsKTExwPYwHn+kL3YiN8sAKTfdF2zEDFKBAdoep5BXV uU/UYZzdA6WrPmekwwwCBZ54ODl1x8R/fbO+4AvdQIQk1GyO7NtVdCULfd0m3bB5BcgNvNf0aap dMXvqHyW476c1aBNMzXcR1t1b5OfWSVy8WDUGKGhFEdqBPUGeDT02KsFeOPFmo/W+Z7PmfC2uhp H03PogYPBhoU/zkjlxydfDwa9mYbEFfSPOBhoEdo0olQIU1KaRU09sqE7hg4663hBiK7H42XXO0 /FaUyZhDr5xNbmgofY3nHmOIAJYQ9N1jXNFZsIUr9rapbKZ3b58QX6yjV6OyOXodqHUGp8MV+tP OZL59rnh6L+gWKBSj8sFg3XK4= X-Received: by 2002:a17:902:cece:b0:2ed:1cf0:4cda with SMTP id d9443c01a7336-2f03ef44198mr438178285ad.8.1796288004861; Thu, 03 Dec 2026 00:53:24 -0800 (PST) Received: from lwq-server.tail118c18.ts.net (ec2-52-12-158-62.us-west-2.compute.amazonaws.com. [52.12.158.62]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f04f8aca00sm205957945ad.38.2026.12.03.00.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 00:53:24 -0800 (PST) From: Yaohan Li To: Daniel Scally , Jacopo Mondi , Mauro Carvalho Chehab Cc: Hans Verkuil , 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 Message-Id: <20261203085319.2392838-1-shunsheng1218@gmail.com> X-Mailer: git-send-email 2.34.1 X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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