From nobody Mon Jun 8 04:20:40 2026 Received: from mail-dy1-f196.google.com (mail-dy1-f196.google.com [74.125.82.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 650E354654 for ; Mon, 8 Jun 2026 00:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780877501; cv=none; b=SFMQrT4L0kXg1Q0cZxY1mPGOSuJ+DcMkgATk/osICs+DpdHLchOm2zN2g1MXQif23jQvC9JD3MHdRJrPqUVnzfC1FEShn4W92k/AKO4rtX2NIw/IG2LMPoJ/lPLINLpre10jxLMzZ1sNzThdycRFBfy3GQNG0zQCHKCUIrg/7Uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780877501; c=relaxed/simple; bh=vOOayBGohK0QwvzYe3v0W8+80VsNtvUxtjNMIUanpho=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Yt5O8P7MxL8VSoTZ0HhNN5mTQ8e+UfZkm0TSSL+d+Nq5KaeMi99IwME68ND23+mP7DA+OpYt/RMSvypcKeu00Iy+iJXU+DZxhUHaQsro2tt8r6xo0phVs5prjCwrhSpojll0ESu5X7QR6m9eea4HLhHyYVginJutudnkMR/X3fM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rCBPgTFq; arc=none smtp.client-ip=74.125.82.196 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.b="rCBPgTFq" Received: by mail-dy1-f196.google.com with SMTP id 5a478bee46e88-304f0039c02so6776400eec.1 for ; Sun, 07 Jun 2026 17:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780877499; x=1781482299; 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; bh=oi4kLzuZyCKw08FN9wJbFhp23jSNbW+hFaRRXMRqEt8=; b=rCBPgTFqO1vo4GhfaZc00r4zmZUsxfaE24zncPAO+vDECojQZxRoN3SJK38ddji80/ j95U8h3JiQrKP1/iNFh59zVM3E+lmFRs3mLiDstzqOrRlhB39vR2OSaOeaXrDl9GSUSO trxVA4p+niqHsT1/Z59Htj4z/TNz+S5ArtspU6Yv9MYq/0hR0KIPjzRevdgpKVLe15SB 1YlNwljJ26qGRxpQSDlnWBDltZwbHu5qrOlq1M9ByJ05j/DPq6lusKgliqknAly5Xl2O TvIw1sq1vrxk9gBU3+yKHt4kAd9zFfNtY9JhkuBmb9Xft7gnFsyLwoip6qAgpKMaiotW Wj8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780877499; x=1781482299; 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; bh=oi4kLzuZyCKw08FN9wJbFhp23jSNbW+hFaRRXMRqEt8=; b=oIQyIW46uAlT+4k5SkWZ/+q+PwkXchaoEiFRRjuQNRIQDeGruLv07Naneh3xGCyp4F iYhVmMmLsV7ye30KajZ5Zz9KYR2+V4ruKgC9FN3qpl8OOQX12CJiJ4StSPk27T6DjQKn HyW3ucGcaUeT2gPQAwdTq+IrJerxpq/SbMiR6i8JTFCV/H4Z9XI6rdQoyRQPKM2y3Vky 2cvH3i/8oEmxfcW50Mtj2kHi24cRnyXK1VI3wPOndu3PLoG/YSbfbtZX3c7/pAHsydWe 7jxLtQq2mkEYyIYi1ohi+Vhbl6XuMSWIO/G1fE73rYo5wMLIvZLcmpBVHV9scwToZmtK HPGg== X-Forwarded-Encrypted: i=1; AFNElJ9cxeOqjooZ+lK/k/uHjfB67W84g0totvY36Ou4DHEt8HcUDojSjH+dHTwYHAwL2yh6XJ3yNlznGrWOMzU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8Ws3+iUeWw6yqflwSGA5Uu/FjLZzUulOaLFk2DSo4ca+dlvQ/ GY0/c8/ZI13/6tuFW8SgO2Cjr0lHxVnGoNFc/3Ldb8ZEpe9TPCeVLKXC X-Gm-Gg: Acq92OFvck30RYjXc4KtbIfYnqq4z4NrXNboppuusuHn9iOi0AJ+MIBAp3EpU1IZ0Gl J7NhmoOzEcKbkRqq10irYqCTaCWZrcuyKkfFsjSM6gY9QzDwpOPvrPLt6mS0Xv2+hWvCbSbK+id 6UzhzH81QE8JOCYTIPa91XPi8+K7cDOye5I0qPRxR0wfOk/WKNu+AIMsj2zsUSey1E4nMljS/IZ wbbFHxu6jQQkNDtCxV6NcQW4RoMXCdHGB1syHsireYPHcBt1qZ1QHMakikNNYiteiuefk9QTI2y 6/Qk28k1UlwXLl2BMjZW+gsJKyNUmqgN2UqHnEbIU2z1+RO6fHw67fF9YY1WF02+54iOlyTuuXb lrSVIHORiUjm+8BI1bp49U1b1HDs19W/32jn1esuIRGgE1i0ePUSt1YkBEtshNV4amQcuwl04/Y vsUyh5Y9XW6B2ShEJzA79dxHGKsp0Rcos1U9N3gyScIra6aNGzkmjHebCAK0wrUTUdLw== X-Received: by 2002:a05:7300:f193:b0:304:de28:1b16 with SMTP id 5a478bee46e88-3077b7830aemr7591327eec.28.1780877499460; Sun, 07 Jun 2026 17:11:39 -0700 (PDT) Received: from localhost.localdomain ([76.32.119.210]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3074df3b234sm19713471eec.23.2026.06.07.17.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 17:11:39 -0700 (PDT) From: Hungyu Lin To: linux-media@vger.kernel.org Cc: vikash.garodia@oss.qualcomm.com, dikshita.agarwal@oss.qualcomm.com, abhinav.kumar@linux.dev, bod@kernel.org, mchehab@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Hungyu Lin Subject: [PATCH v4] media: qcom: iris: guard IRQ handler with runtime PM check Date: Mon, 8 Jun 2026 00:11:28 +0000 Message-Id: <20260608001128.80090-1-dennylin0707@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Guard hardware register access in the threaded IRQ handler with pm_runtime_get_if_active(). A possible ordering exists where the top-half IRQ handler returns IRQ_WAKE_THREAD, runtime PM suspend powers down the VPU, and the threaded IRQ handler subsequently runs and accesses hardware registers through iris_vpu_clear_interrupt(). Avoid touching registers when the device is no longer active by skipping interrupt processing when runtime PM indicates that the device is suspended. Signed-off-by: Hungyu Lin --- v4: - Clarify the possible ordering between IRQ_WAKE_THREAD, runtime PM suspend, and the threaded IRQ handler. - Describe the race condition motivating the runtime PM check. v3: - Remove the early enable_irq() from the PM-inactive early-return path. - IRQ re-enablement is already handled by iris_vpu_power_on() after power-o= n. v2: - Use pm_runtime_get_if_active() instead of pm_runtime_get_if_in_use(). - Handle negative runtime PM return values correctly. - Return IRQ_NONE when interrupt processing is skipped. drivers/media/platform/qcom/iris/iris_hfi_common.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.c b/drivers/m= edia/platform/qcom/iris/iris_hfi_common.c index 621c66593d88..ab2ec1e75309 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_common.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.c @@ -100,10 +100,17 @@ irqreturn_t iris_hfi_isr(int irq, void *data) irqreturn_t iris_hfi_isr_handler(int irq, void *data) { struct iris_core *core =3D data; + int ret; =20 if (!core) return IRQ_NONE; =20 + if (IS_ENABLED(CONFIG_PM)) { + ret =3D pm_runtime_get_if_active(core->dev); + if (ret <=3D 0) + return IRQ_NONE; + } + mutex_lock(&core->lock); pm_runtime_mark_last_busy(core->dev); iris_vpu_clear_interrupt(core); @@ -111,6 +118,8 @@ irqreturn_t iris_hfi_isr_handler(int irq, void *data) =20 core->hfi_response_ops->hfi_response_handler(core); =20 + pm_runtime_put_autosuspend(core->dev); + if (!iris_vpu_watchdog(core, core->intr_status)) enable_irq(irq); =20 --=20 2.34.1