From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796281510; b=Pg9OsHAiirmI2hfEGXkhDeX3DWs+oAabaOafo5BEzDeVldWyg1Rs5bDJr1NC9v40ksux b6omA1kZRYcUED1Kveoc1z48QYZcXBXz+N+SfpMImjSZ4pK5RuwPOfH/aAO9UREIA+1wN ozCITr+RhLeN1RZNPVEyr8COakF9uIeZkc38BnWDFFWDD90I+Ow7xKW0xLUuAO81Flx/H dbkqkSG767YCdf3602gkLSXANAnP59NK8O0Gb1G4X8d79JQye3zQOLcTW8B6D9+D4tXTq Y1mLgKIv1aystc6hfgvtY4/gfLpL4Zc2gkCCOVyj6iMKD/lMiTUdVl3Jt0hWo4aJn4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796281510; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=RzUTCjOmoibohtT/iolb8P/eoCa1TlOQLOa7ENGJHPU=; b=C6Yz4yFqozDRheviicshBolWaFxG9qTyodUe7EWDbRhFpTGot4gc0V2MT6YZEo9Tt59N 3nLxEuQKKAP4YyhA9gmpnyh5AE3S9bECnaDHqN+nfuOEGQHWzgsOfLj0apVSaETSGaYDY ULK/bunCT840kjXmklEHeiUHB5v1oVu4SXAOewMCyLPWRYTRdnjN0Z2Fv79NJ142nqGAs a52BW4tezUjD9pAV0ZA2eXkeAh9iQAg5aW4YgC7rQYEHxM9zLcHn0LB+A27oIVnQkiJ8c wOcES0WUHmOp7rL/fOCxuOP91g+wUvobRSQa0XtWEvS9IAF0UzoKL485lEsVE0oUbbA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=YIZU6qi7; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=fsSfrHXV; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF88A606A333 for ; Thu, 3 Dec 2026 07:05:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF88A606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=YIZU6qi7; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=fsSfrHXV Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B36k2ue4058651 for ; Thu, 3 Dec 2026 07:05:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= RzUTCjOmoibohtT/iolb8P/eoCa1TlOQLOa7ENGJHPU=; b=YIZU6qi7UDER5LUM O1BJZBj1BqtHC2KxmAIwmNXeWrpRagseOSIJUsQ5b4kRIuHnqkT+844Hr8/jDm8s qGF4M4ZsixKw8wEDcoxWwbh2CH+NwlPHLwbTv3ZX3r2YVz4T317gsXKR1T3wDgNG fmNAVvAlPfVIvNgYa2JYAJiYJH9F5CzE5tWBSs7mmMOLj+Zvy01yd7xwd/0CCmV+ ZyJpmYLzUsmZeK0UtaG3KI8CPdjZ4efwKMnmIKqiOnc9vTHRpGCowA/cOe+2CN2h ZjXLybLocRdh7n/zlXRU62/T8JtTrwXkSUAfCt+vUpXEF0P+Xvob07UxAlvM8MA/ SWryZA== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jb2sqg86t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Dec 2026 07:05:08 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-3b42ebf632cso10887643a91.2 for ; Wed, 02 Dec 2026 23:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796281508; x=1796886308; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=RzUTCjOmoibohtT/iolb8P/eoCa1TlOQLOa7ENGJHPU=; b=fsSfrHXVw2SNVzjy322XkL9FRcdrBRXTsHhOl+9LNs67VR70c2/rPQTUvN5EWX2C07 fYKBIcypota1IE3SKglSmktJynuqLZrylTPCIhS4rdx1iVkBBdR3AxG7z1/cBGSKxS8q I1+i2A7iiFR5Qu8X7c0QBT2kP0sJYJktF//eEDszHuJlVIdmx66HmrTCIa3h1x6VcWqg W/Qhv1bI4ZAHbjUAuFPAqykYwLpl11GofaasZvDKlReBJZ8G4kEYmzHCsKJxosHAN9Tf wVnnrYDxLfw4135UeTrq2ELlwCAB/fYjfNc8LxC1jKA2zdWA898ZJ3OhPCsGfXyIFbLA 55FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796281508; x=1796886308; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RzUTCjOmoibohtT/iolb8P/eoCa1TlOQLOa7ENGJHPU=; b=GMdm7/ePRRPQLLJ27TdcQYT4KxT1Dw3s+nPZ45uUYdI1uR60cHYr/HEhayh0f/YQeH f06tyu1Cv0zpBG2cGKJykVvygFQsyp/TVORSwyS3cIlYCfz1Hfxwbt+SgCqk5R/BVO1O hXA/ixa3Cn+z8HnMzn62XG0G+Q/KCp2uF3g7116sTnHrn09AyCnG51taBIR6vsfvwh2S 6YsyJq7cNhzwa2cwhq9sTrbCttnAFFXc/LGLZhndlD8IhGUjnXd4islT0zCIwO5GmdeD GDNA6vaF9e1lrxOiHWJx9y8XQXHfZ6zKdefgepLeDpfQ3e/Ex2iBW4tN8sJ7dBwJs+pz Hl6Q== X-Forwarded-Encrypted: i=1; AL+hErFmxskrnpV0pW881i3Y96W6es8/w9G9vh3FJEK3WGAEhizMKnIUyfmdxMFkVuzdguBWmeLltZr8rUk3@vger.kernel.org X-Gm-Message-State: APuU4Z+f4VpbF80t8FIxepMBr3cPM52NWIdevC944NaBgLhk29Ac0C9d p2QTT/KIZUGBs0vD4AgcE73yfrxv5YPZg73SWKbEWeOkQ0K1okjxXWpu3r7H5I4fNQO3GuZyVkc illIZVIaR22P67GFa2hEz4MhwQ3pSOHzrEfOh864qcO4A5HZ0J+uUvm7lBLY/1Dyb X-Gm-Gg: AZFdTZcIt3ZQWu9/WnNyCn/RSNcswoBMnBLPABoQKCpArpdacJen2+3a5EuEgHivUL1 zK7K3UXFYQ0EsRmXNZC8aK9sWZIShmNFlFwclXJINcOcU7TCSdQJU+6foHeWxow0w/TwWfTVsWZ TGy3KQWHqAx/tDnyNEd8Kvl4bz+kzDPDysmPRFlmWI15KEeJ2SIzwriTSru7LBDV2WwwlHlOwbz A0W0zdkFpwYPxZcHQizi1KbooEbkXB6rW7PsnZb63wO1XPAol3m/oz0uIYOip49SeThVbFOGn14 RPvV6h3T9nJEPZozEqRWw8qtVouGwfZDgH3QfM3XLTOhnGHRYut9nUARofU/b9AB7xT9og3MusI bQBedurjO6xOuKTjZEZJV28MVmqyhbpPprzrj+Fsdpt7pKo713HLpQtqvPLVhr2y0IvRuYuXolG 3iew== X-Received: by 2002:a17:90b:4a06:b0:3a4:9dd7:296f with SMTP id 98e67ed59e1d1-3b41caec8a1mr41642610a91.40.1796281507648; Wed, 02 Dec 2026 23:05:07 -0800 (PST) X-Received: by 2002:a17:90b:4a06:b0:3a4:9dd7:296f with SMTP id 98e67ed59e1d1-3b41caec8a1mr41642583a91.40.1796281507151; Wed, 02 Dec 2026 23:05:07 -0800 (PST) Received: from [172.20.10.2] ([223.188.104.51]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c784eab9sm2871837a91.7.2026.12.02.23.05.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 23:05:06 -0800 (PST) Message-ID: <25b74357-ddab-47bd-9d8b-60fcc2059ce0@oss.qualcomm.com> Date: Thu, 3 Dec 2026 12:35:02 +0530 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 03/11] usb: dwc3: qcom: Keep wakeup IRQ enable/disable balanced on failed resume To: Peter Chen Cc: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, krishna.kurapati@oss.qualcomm.com, krzysztof.kozlowski@oss.qualcomm.com References: <20261123104727.1539149-1-faisal.hassan@oss.qualcomm.com> <20261123104727.1539149-4-faisal.hassan@oss.qualcomm.com> Content-Language: en-US From: Faisal Hassan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDAyNyBTYWx0ZWRfXyt8q7LhicbOO kgXS6I9ii5MNZBPrPck8NWTUIpT36RJQ7VtEkWjVdw197sHn+FEebAvSS/8KdYvlHgAkCEQfE+U 8gmJUQuYfmFSwi0h4boIHJMLAyEGLQXlE6COh8ATbwNyNYak6P1FlUNHYDxz9Axc8jkWlXQrLYU PJlcONgAK6koJcRKzJRCC7dgiYazJK+/+YICgfFXnjh8fjYTAylmCVW0kEwl+g40DcssWfx/E1W sdspjCLS+Vokwyw6Pc8YYS2gd1r7nLf7Hc3STLxLgX4jV/4gEX79xlc7JYJXrsi1Mwc8EpgfjeQ IMtQ0VFUgO5uQGPlX3YitHPdKeJf9hua5rbCIRznz8ywNXmFJDJPlJZJPGyyT7cROQ/wC7POZjj +8c8BXyPqh6uEVc9wEJldm4NqavEoaGsjwT+SiDPDDafN2Jqyh0/QUErpQXKRQ3kQb6sM8JlOp2 1LX8qz+iRcQKiTjHslA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAyNyBTYWx0ZWRfX+M8yxNgQpCva hZR2leZehouMaOwAVr7ZIY500SUlt3jOKMsSOXGtfg3UvHWoMjzVyAmdmHM+Sn9xnEl+EaQBMZl VK/pJTC5DrNYEDfD40pTMTFUOjyMFJE= X-Proofpoint-GUID: dZQUVBW6oCuVFIB1F4w4DIeNQqmXE7Zi X-Authority-Analysis: v=2.4 cv=B4IsQ+tM c=1 sm=1 tr=0 ts=6b1114a4 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=P9BdI5F+mvP9aojgogbvCw==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=WCsEc79AI33hBFpqUJsA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: dZQUVBW6oCuVFIB1F4w4DIeNQqmXE7Zi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_02,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030027 On 26-11-2026 02:07 pm, Peter Chen wrote: > On 26-11-23 16:17:18, Faisal Hassan wrote: >> dwc3_qcom_resume() disables the wakeup interrupts before enabling the >> clocks. If clk_bulk_prepare_enable() fails, it returns with them >> disabled. The next suspend returns early > > Have you run out this sequence at hardware? I find the dwc3 core suspend > (dwc3_pm_suspend) has not guarded for is_suspended, it should run into > some problems, eg visiting register with clocks off, etc. It is predate > issue, not related to your patch. > Hi Peter, Thanks for the review. No, I haven't seen this fail on hardware. I spotted it while reading dwc3_qcom_resume(): if the clock enable fails after the wakeup interrupts are disabled, they stay disabled, and the next suspend returns early on is_suspended without arming them again. The missing is_suspended guard in dwc3_pm_suspend() predates this patch, so I'd rather keep it out of this series. Thanks, Faisal >> on is_suspended without >> re-enabling them, and the next resume disables them again, so every >> failed resume leaves the disable depth one level deeper and host-mode >> wakeup is lost for good. >> >> Re-enabling them on the error path is not safe either: the >> level-triggered ss_phy interrupt can stay asserted, and the handler >> can't make progress while the controller is not resumed, so it would >> fire continuously. >> >> Track whether the wakeup interrupts are armed and make enabling and >> disabling them idempotent. A failed resume now leaves them disarmed and >> balanced, and the next suspend arms them again. >> >> Signed-off-by: Faisal Hassan > > Reviewed-by: Peter Chen > > Peter >> --- >> drivers/usb/dwc3/dwc3-qcom.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c >> index 18db19cf2065..e7fadad9a4e1 100644 >> --- a/drivers/usb/dwc3/dwc3-qcom.c >> +++ b/drivers/usb/dwc3/dwc3-qcom.c >> @@ -81,6 +81,7 @@ struct dwc3_qcom { >> enum usb_dr_mode mode; >> bool is_suspended; >> bool pm_suspended; >> + bool wakeup_irqs_armed; >> struct icc_path *icc_path_ddr; >> struct icc_path *icc_path_apps; >> >> @@ -323,16 +324,26 @@ static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom) >> { >> int i; >> >> + if (!qcom->wakeup_irqs_armed) >> + return; >> + >> for (i = 0; i < qcom->num_ports; i++) >> dwc3_qcom_disable_port_interrupts(&qcom->ports[i]); >> + >> + qcom->wakeup_irqs_armed = false; >> } >> >> static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom) >> { >> int i; >> >> + if (qcom->wakeup_irqs_armed) >> + return; >> + >> for (i = 0; i < qcom->num_ports; i++) >> dwc3_qcom_enable_port_interrupts(&qcom->ports[i]); >> + >> + qcom->wakeup_irqs_armed = true; >> } >> >> /* >> @@ -396,6 +407,11 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, pm_message_t msg) >> if (!qcom->is_suspended) >> return 0; >> >> + /* >> + * If a later step fails, the wakeup interrupts stay disarmed, as a >> + * level-triggered wakeup line could otherwise keep firing while the >> + * controller can't be resumed. >> + */ >> if (dwc3_qcom_is_host(qcom) && wakeup) >> dwc3_qcom_disable_interrupts(qcom); >> >> -- >> 2.34.1 >> >