From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 373593E49D4 for ; Fri, 31 Jul 2026 13:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785502952; cv=none; b=J4azX1vRlw3n2OFTfHwAgAdVuMyA2ATCKMmLLZHSwFo5jsAxG/5EsRY2UbsKRw8iv3ALoCeoD5AYQUp5HCZ/ZXj6xm0ExBh8eUIsuj8CNUCw5oG29Lp2UKC3+nu8aMKGtovbEJ+9w25nPbtMjNUlqTfHk2xjsMpa4G9vWPKCBDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785502952; c=relaxed/simple; bh=/VPicFvwqV3PSVa791yCxMtyqTa/S3HZd0klqQkMpiA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YL/Y+eE7VMnk7i42oSf6MMV4Uija1UDg0XZhnRAyZa1VsWv9LXQbks0mfyE/ipUM5j5dGtCZjrS+6p4Qb6U6odSh9RNcZJJ+oYLqOcROD9Hn1pZBhENfQ/A/kKPqGNLCPdlv1Ale+ltyqsdKsp92e+RzbT2sjkxzYd493gTMRHc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Joc5h5Ra; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=NEjobKlN; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Joc5h5Ra"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="NEjobKlN" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66VBjiat4054763 for ; Fri, 31 Jul 2026 13:02:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=RbHVJKnoJBfoVpSGbz5JOoAG 1iCGRO07TfeCjHQsqyU=; b=Joc5h5RaWbLIUvb4MG1Z5Qjg+jFsQkKG9Qk5A/4J ogmIIIzwmohg4Jmb3HYfLZ1qOVpB688Jdmn1EL/GZmWdTdvjyRXhWf51VnNK2srQ deQ2D4OnVbNMSyByYnrvqi9NxSJkh7nQSNL0KtLuVrv0CXzNUzbfUPGUoGvcw58P fhci6jCWXeIi5TrKkayxymSzOMq25318YuR5XCNJoqk0Dc4cZlw71sURCNf9QRHD EzzGl1TkUhHRNOVO40qji2sLWm24NEQaC1zsyIGqxproan7dX2cKfgyLTKo1vRW6 Y8VJxmZXPrqIQ7YlafrKpCtr+snywc6/nIPnwmtLuziM0g== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fru4808g4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 31 Jul 2026 13:02:28 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c9fe4c5eb39so680973a12.1 for ; Fri, 31 Jul 2026 06:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785502948; x=1786107748; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=RbHVJKnoJBfoVpSGbz5JOoAG1iCGRO07TfeCjHQsqyU=; b=NEjobKlN0JAogr15N6McTcDFUZDo6lO5XL7Ak+luPK7FeraiEG4xBYawSM+Uadu2F0 rhJv4vp9Hiitiu12sxbuFAi5lPK4eVIPWSDQXYYAQIeoSPqxWXtGncIbfHBknHJ65+s9 /vD9zwtSODjdSbQ2T3uT2GP2r4xmZdjrNSJ8xTfLoV5jht0RaMaF4PjXDAMUAG77Ybbs U3wZGJ4ef4FQUhWIMVLrmaNoPIQFL1rnQ2smSZHjClJhBC64zX+6hbtRhEkNbTmJ0ttv cTRdyiQMyzGAbhNcg/djvrJRdZ9G/FhEJdhTX8NN3ZNmo4Mp53W47Lhsi25r69VRb3M8 rFKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785502948; x=1786107748; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RbHVJKnoJBfoVpSGbz5JOoAG1iCGRO07TfeCjHQsqyU=; b=Uasq/YTGVfyKdeCCRDQnuX8OmXx1EpArQtgqpt6VzhQfstJJvvvnZvB/6pmVDfSTen Rg4vSeZ35rXHMQDCc6wGzRBJ596JGA6/EWHy2dDHX13nR0EybJHh3nSGLcjilDFd8BNl QUtqDuQssEfQceJ9MbiXT8Z9OpTRncpsT88WlGj3SI/Yg9DVncJfoPbkYFs89G4mhVmH ZOj1zAKqHAhetrkU6JN/aBvYpnKQESnf1E3QLQsvRC+meExEM7TNNg/iPEqfeAJi/9dW DP9QZNU7WU5AXhQwRAX+VyXAlssgse7tUNLr6ERn4pWQ3ySU8bFMiuDaZhh1rJhDCFpz Ql2Q== X-Forwarded-Encrypted: i=1; AHgh+RqnegI1ulqJkxYmnoAwyFd44/92VSuq88sNsGlte1rpqgAadjEz8f1DKwYevcwR2MT0HOH/00IUkKUis5U=@vger.kernel.org X-Gm-Message-State: AOJu0YxELe+0+EMN8FGxfUjXSVkeNYtc3v4UO+4MNF59dC6MGW+5740O QXq9VR7HK/6w7Fe9oq8estU2IIhz3k9uI0qroK6M+cMWLAepw8Xi+T6dZJagLQTI2mJg3n0kJyL 5j3a0cD6V90q1wq3PLpP3sg09TaTBH1pn08dEGlt+uDWFW5O+ib19/nFi5xFAo1NldUY= X-Gm-Gg: AR+sD116X8MKpad9hyUrVexbaDIk+M3MwyfK120fsDq3ypplvQ/Hx1m26c1HK0JV1wJ yqPhtH1fXb6HC8zFAfA8OazLZV2sJ9whXdfYqUbrLbvtALYvF+G1SMCcQ83hWGE+KT5C1D/QeKx C2jCjKNWZr60QrwUJ8g11lRDEiTuwYlea2x0NfvhDu4sXjqajuJF+9vVrYlZ/O5R6iXuuHBK+hi Q4OukqJBIbj4/hRMglOrD+2Uor7dbXg/uk/+oq8SCaEGmH34aoZZ8HFK2ldfubdPlp+IpPOJgGI /XfRlTWloicszIAl17jcAhPNgNAh7GUtZf816zNKYE8Zw7FvmVDhyQKGe2LzwKROT1biOC37l73 q4bwegEditZ1qskCByQXPZT34SxlRDnryiRwgn3ycees= X-Received: by 2002:a05:6a20:7f9c:b0:3c4:3112:45 with SMTP id adf61e73a8af0-3c91b063143mr2120305637.1.1785502947589; Fri, 31 Jul 2026 06:02:27 -0700 (PDT) X-Received: by 2002:a05:6a20:7f9c:b0:3c4:3112:45 with SMTP id adf61e73a8af0-3c91b063143mr2120172637.1.1785502946332; Fri, 31 Jul 2026 06:02:26 -0700 (PDT) Received: from QCOM-aGQu4IUr3Y (i-global052.qualcomm.com. [199.106.103.52]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3153dd4e5c7sm6826247eec.5.2026.07.31.06.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 06:02:25 -0700 (PDT) Date: Fri, 31 Jul 2026 21:02:20 +0800 From: Shawn Guo To: Stephan Gerhold Cc: Bjorn Andersson , Mathieu Poirier , Abel Vesa , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] remoteproc: qcom: q6v5: Ignore stale handover IRQ delivered on attach Message-ID: References: <20260731025655.2642860-1-shengchao.guo@oss.qualcomm.com> <20260731025655.2642860-3-shengchao.guo@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Authority-Analysis: v=2.4 cv=IJsyzAvG c=1 sm=1 tr=0 ts=6a6c9ce4 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=b9+bayejhc3NMeqCNyeLQQ==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=dpTBv4f86fTnYSg34-kA:9 a=CjuIK1q_8ugA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA5OCBTYWx0ZWRfX2FrY/2VzDT0u v5TBmUhmQU/U1Eix2WNSprAQSwE0VFXpiGHjQZXd+nftwtFujJ906QLSDFa0bnrYMHFcBPcSyxD n/xMGmCHI4wMuUP3tPayHlKtFNZoeos= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA5OCBTYWx0ZWRfX2O11gE42baKX sGILthR/GfIYLoUPqsDSE3EFRdxjxpgiLjE9YyXrc1lEB7DL9O6oirLT896EMqnQ/azmB4YK966 y8KP3ArNCMZJ4pgg/Og2MH8tt62vmbPcspGlqRpzwnCOZtd8MsSSsMipzGrB12J5fCzb66jcq/2 xzbzsCQhdslaUynHrIfvnB9Kk5tyBhNZg+zHT+576TvsN3gjq76n93xTsNWlCRMEgKguVWMJovO GhJ7A9BwYhnf3W5ncVfN5dtNNn2n+Reai09hJBc0yah7OEcwvtNNFJ9Hy1iJUqa/Z2iTTI6jLy9 3HUbYw4wKjzj0H443vlSDU/ayyynFzS9ic8Vu5xK/Ukr5hZP6aS6F+PX5jJdsSUbF/bxctAQ0t+ Txb1JfHAFKvZH8HsBRWg4/2B8uFbKdA0o0m7aYwFRRuhiO2zbqFIYUQ0Vz1un/oOsrlXewHOqM2 N+/Ucmo+vQNez0JlX8Q== X-Proofpoint-GUID: CAoXNLUMOSJQ1UHP9dk4fQ3rkeDFbBk4 X-Proofpoint-ORIG-GUID: CAoXNLUMOSJQ1UHP9dk4fQ3rkeDFbBk4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_04,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310098 On Fri, Jul 31, 2026 at 10:42:20AM +0200, Stephan Gerhold wrote: > On Fri, Jul 31, 2026 at 10:56:54AM +0800, Shawn Guo wrote: > > Commit bb7c5d6f5b41 ("remoteproc: qcom: q6v5: Make handover IRQ one-shot") > > dropped the check that ignored a handover interrupt after handover > > had already been issued, relying instead on disabling the IRQ after > > its first delivery to make it one-shot. > > > > That is not sufficient for qcom_pas_attach(): when attaching to a > > remote processor that was already booted by the bootloader, handover > > has already happened out-of-band, before this driver ever probed. > > qcom_pas_attach() sets handover_issued = true and unmasks the > > handover IRQ to keep the enable/disable tracking consistent, but the > > transition that signals handover is latched at the interrupt > > controller while masked, so unmasking still delivers that one IRQ. > > > > Since this driver instance never ran qcom_pas_start() for that boot, > > it never took the proxy power-domain/clock/regulator votes that > > q6v5->handover() releases. Running the handover callback for this > > stale, already-accounted-for signal disables those votes without a > > matching enable, producing: > > > > genpd genpd:0:4c00000.remoteproc: Runtime PM usage count underflow! > > genpd genpd:1:4c00000.remoteproc: Runtime PM usage count underflow! > > > > Restore the early-return when handover_issued is already set, so a > > stale IRQ delivered on attach is dropped after being disabled instead > > of re-running the handover callback. > > > > Fixes: bb7c5d6f5b41 ("remoteproc: qcom: q6v5: Make handover IRQ one-shot") > > Assisted-by: Claude:claude-sonnet-5 > > Signed-off-by: Shawn Guo > > --- > > drivers/remoteproc/qcom_q6v5.c | 17 +++++++++++++++-- > > 1 file changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c > > index 10fa38f264c8..e715083846aa 100644 > > --- a/drivers/remoteproc/qcom_q6v5.c > > +++ b/drivers/remoteproc/qcom_q6v5.c > > @@ -210,10 +210,23 @@ static irqreturn_t q6v5_handover_interrupt(int irq, void *data) > > { > > struct qcom_q6v5 *q6v5 = data; > > > > - q6v5->handover_issued = true; > > - > > qcom_q6v5_handover_irq_disable(q6v5, false); > > > > + /* > > + * When attaching to an already-running remote processor, > > + * handover_issued is set before the IRQ is unmasked, since the > > + * handover already happened out-of-band, before this driver probed. > > + * The transition that signals it is latched at the interrupt > > + * controller while masked, so unmasking still delivers this one > > + * IRQ. Ignore it: this driver instance never enabled the resources > > + * (proxy PDs, clocks, etc.) that the handover callback would tear > > + * down. > > + */ > > + if (q6v5->handover_issued) > > + return IRQ_HANDLED; > > + > > The goal of Abel's patch was to have the handover interrupt unmasked > only when needed. If you just bail out here and do nothing then there > was no need to unmask it in the first place. Can you just drop enabling > the handover IRQ in qcom_pas_attach()? Hi Stephen, Thanks for the comment! Although it seems working in my limited testing, I'm not sure it's entirely safe to drop the handover IRQ enable in qcom_pas_attach(). The handover IRQ is requested with IRQF_TRIGGER_RISING. When we attach to a remote processor the bootloader already booted, that rising edge happened while the IRQ was masked. Masking doesn't prevent the edge from being latched at the interrupt controller -- it just defers delivery. The pending bit sits there until the IRQ is unmasked and actually taken; unmasking alone doesn't clear it. If qcom_pas_attach() never unmasks the IRQ, that stale pending edge doesn't go away -- it just waits for the next unmask, which is the next real qcom_q6v5_prepare() (i.e. the next stop/start cycle). But by then handover_issued has already been reset to false for that new boot (qcom_q6v5_prepare() does this before re-enabling the IRQ), so the stale edge would be indistinguishable from a genuine handover for the new cycle. It could run q6v5->handover() and tear down proxy PDs/clocks/interconnect immediately on prepare, before the firmware for that cycle has even signaled ready. So the enable_irq() in attach() isn't dead weight -- it's there to deliberately unmask and flush that stale latched edge right away, while handover_issued is still true from attach(), so the IRQ fires once, gets caught by the one-shot ISR, is dropped harmlessly (because handover_issued is already set), and the IRQ ends up masked again. Removing the enable would just defer the spurious handover to a later and more damaging point instead of eliminating it. If you agree with the theory above, I can follow up with a comment update in q6v5_handover_interrupt() to make this rationale explicit, so it's clear that the attach-time enable exists to flush the latched edge. Shawn