From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796288006; b=jDyvvpM/4UGvzjFpt11cWQLHXmDWMboeiqPJQHetHJlTC3Fr4EPOr3T5Nxe2DpaLKYpy qZsEAlkXKSyfsvmqTXDDc//P5PGV+JxCwcTyyJZy89HsxZNWo+Ge9f6qxBFepvWAo8Wcc V2AUbJ2bs3j8oigQHI4nMJSV+YhgaMD0whtBVXDRjf/RwEKwjGxmiqHX3swoRzefLkBnx 5wMoXjHg71xlzqd4/Xu4S6h66sGmbI7YxtCYwDcNmgeT7ogd+BSsY43g5DrwOqWyt6udo TPT2o3zX7iHOG2BoGvoviynPVOh0Sz1KKargsWuM1Y2pj4zT7mFobcb3k6iRXEpuT8g== 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=P8SQZSnRxVlom1z84Yhf28B3w4Um49FnCO8PmjeX95haIdqJaPagwvf+GkuYiZNAyo0T tbvzH+94LnME18yqnCUuQg5ihAuQpon0hkOePHLGU9v0hoRAn+0qgzoAoT+7SjExNwh/T ii76qtVwdRUwfi+WvHh3UafAFes4dC16kIQMqmpBID2E04rHpk9HoJPVveEEFu8a2loV4 7CCPi0nBgh++zbeNh84ZiaCGEaJSbzoKGfPnkjmSGC0DjTwZimjW01TyzpHqdvmTZ3neS 1Pp/jkOBMav8h7rGsVDOtXLAsJbhSG5kNP3YBMN6aim95SVBMILlTjUcdTkqIl2xMBg== 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.174 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 D2470606A32C for ; Thu, 3 Dec 2026 08:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D2470606A32C 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-f174.google.com with SMTP id d9443c01a7336-2f03920c477so116580435ad.2 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=Ciqqj4dTTcFvSGA4/xSFg3Z6THDYIY2Qn0qO0wgq52SZYGU2d7nFKsUV2FNE5wlt00 rcWU4PURsCJ5GY3NEC4w7bWR7uVuA4odtGYdM42J7xOHHMxMJYH+SMmzfGgWsHIFEu0f /Fk+PQCzQ/neEYVYCreaZ1cF9m2C4U7FDkIk6kOAwFuU357UVmYihhaIKKPurC8ielxt qD5J0QEeYxoPyUpl9xg62FYipbrzzcMKE+c89Qx/wmxF/weqkQn54UYiwcvJhcaP+ucn c65oubJD5Lju2BYa2bEYNXLTM7ziVKzo6d4DemGHnXJzPbIkEhmlD69TwdOlYLZ+sMAv BgaA== X-Forwarded-Encrypted: i=1; AL+hErHdot7rTgrvwwBI9RVI0lGDZjkcyigC9qFE1VknDFfo937C25u+DYPFAhCpDq+EUteAv9sal9uXaykS8zQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+6EXHqbtX7rtrawl89Ux2zq+Jt2JXAdWKJNGfjyd/YBwSoFgwF 3bAcY3qQPTu2qdMVAs997FKN00bKKy3DHtjzfEyjZlfxg3bJYaILfO1H X-Gm-Gg: AZFdTZe49HMbaUSw9IMswIUxOpokmvRjk9GlqoFp+KWe07qCGfh0qfII5uKahmDgV41 B7HmHu+dVhdZ2JdiwE6sWrBgH3Oq8LLe+CKro+X/ACdN6HSjBYnRDnF1hebOdzX5xE0NM219SUr dqty5ZhUcQaM6wPEQ7ccCS1IrAf5qjkopTjjqEuNeb7EwN3Fbxwm9szAw8SbLbW9UjVsBfFAU1S uCN6WmUk087thBM3OAssD0342JYfHe/w11+HTtZlDqnQNhIztEAqPLBeT3Mo7MVQUxrsZJB53n5 hiod3zPryX5RzmAPHwyLNAabDZ7DanwMxVmsFWVlcsvm6QHgGBLwTM7m7dgjr23eKUmIORapdv6 LYWinLX3NrwnRDSVcrvXJWxMB2SRmA6Sdqub0Ul1OFXRzNb45J6TOPgpYqXKRDuOT8+htwrmRQS 2P956hUzf7BXDqu1auYwmXFTmM1Q0rd5uz1sEyDJsntQgx2yy/doRKxW4YB71xbpEJKUGWpL0T/ ctQma2dOkx/tIki3z7VvC1T3z7KrsTjFep1IXOIZOgj+lei1mu77n7MAHq2dpOJ8OlueZLefEmr dO2MCFu9exOIPEhM8S0t7/jxvYaJICbYxoizJqW7aTjx8TiMqzIuy97SUa+V41zKbqVsMhWGQfA 0DT6+66IBnhvmtGiKtj3G3v3VhTs5N5ELkqlU5LdhYdg502xn4Lrxr/YExT8BcFNs/5s7K2kK1I xVCqTP5P5JcnxkEmvsHMjIzvI= 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-kernel@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