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=1796281509; b=GchZOnS5yO4ylUNVkQS9XdRMWUXxSBxbxnNW7MNX8NtpPQyingVllkpkTEn2foz3nJhI aYEpDZFOQmovrUVLQTWL+0YPuZ7Np2sP0EoQupqkvm5dIlZufb9qC6x+k//pTjyZvZR/W 7VC1cN+fzQcRofvfxH/2BiWX5VWlWIXXZBbbYJ1tUMJW5wEuTN5m0ucNjLLdDy2Xdw23h sB3zu+7AcvTSJHSZ6XrKAoJGCTdv9c3aJgCKVvi3J2o8DAOiG/M0ERwC3VGZzC7Ov2gRZ M+/MYg0DbQOff8hKUGxqgGJ0yJfVaatCK3LvAW8XzdGpy4m0EJoMY4iNY67AuSMBeVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796281509; 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-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Spam-Info: X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=RzUTCjOmoibohtT/iolb8P/eoCa1TlOQLOa7ENGJHPU=; b=IYTWD2VagKlmtHllEE7lrRhzpaG/uZ1yK5q0xugJjCvjggEr0aH6Z8uxN77UvCyc2tpi ynmja4a/SmDbAA4oSWq4aTA4zMw9p+deKUoprh5+wXMJpI1sYL+yjLLIJq1FiZSSOxEkr Zx3HLcJMpPjXsSkNLufwhiID8pT/LZHPV4phXH8M3feFtnR/u8BCxk20+g1X3KEI92yey D2XeX52BaokGcXVDXrNP4O0ENZ7SrozufM994dDBUs/KxaLu8faEMf0FiUwyTkATYB+Dc MbwVTcvgf9z8I7XiUyQ0ywA5bXY0V3S51n90x6p1lXJzRDSC1hM96It+hfv63BdzgTQ== 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 44C93606A32D for ; Thu, 3 Dec 2026 07:05:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 44C93606A32D 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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B36mqow2591935 for ; Thu, 3 Dec 2026 07:05:08 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-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jb3g4021m-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-f69.google.com with SMTP id 98e67ed59e1d1-3b41aa2b9a8so9683084a91.3 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=O79Z3b3XrxPVQQDqoPnI9BsveSdxDo2mZli8221BEyQPNVKJZFmTs2OOSXgxorZ5ts xHTtBIaIY9SoFLDqJ9xDTVNNQyAqRkOlw6Bt+fJpwWPhmXe2U4ezY4OtzxQX8bFAovyD B8qYMdbUZSEGRW8nZcPaZupJDD1X8kUpcsCH+8Zw0EU2jGvHoiKcEskoodMoOEpAstrC 9hjsoeoAYdj25R5KrpcsEaO8eetdvnvAQXH8h7Xon+UMNKvZNjcC1RqKHOVRqWiizISV AXU4N2SWr2iWJIhYol5tNeaa9EzO0LhSx0AuVNivfTxuPr3J5exfMXlUE0tCNiebH6dL KYGQ== X-Forwarded-Encrypted: i=1; AL+hErF7baER1Te25BWgqw1odFlxOQ4aj2kjqQHYxPJdMq8Q3epva2tr6+gQY6Dw3UnqiihzZCgm91c1MUQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+oO10uUSw4R3IhMv25hvi0savjagqCyAtcSXwTgGcr3vlz4Abd AyCoqUtRQ7sahFBARKWsgJbIkjx6m/w1fl7EdeWdqKkbtnv5Ahk09wSGVXRJkNLJdJwfT0UV6cC p3UOLxsnU+Dd8sxkfrPqFUqor2BJbRHQ+M4OpcSDIXAQgox0St6MFKY684ehfT3w= X-Gm-Gg: AZFdTZe1Lqo5W4rE0N1RPJeJV2NIJkruQXL3I61trzAdGcOOO+gtdgwP4EvjIKx2Zoe vmAc6XaSzwKRu4uSOv9cXaMUWKMH9cS1rWs1FtKLoEnrYSTDgELhA+6L0aUv9hllQFst0gMUXOh uPe7MbX3rrW380E1II0hH9AgD58+/3F4eZBNoNt6s8ZF8Ces75keZV2gmElRQheVrz1AldD93cz 4a/DBiouGzeZTY2WNxDoACHiRu6TeXRei2Fpe/z9MbqIBhdw8yzBDnSGYSPDeMezvdXQivhVQR0 tijexYFR3DEeBi20c/gSVgVTlFBHkFY/AfCikmsL06zxQ/iXTRSS4igFDT2TiAuJ+JJU5ZdTkEJ uoSDnQ97TQ8orpMxjwNQ9IZQHnWWgV1RQkV790c3M+v87uxoaNFeebubSb1KZwUMVwE29BfMOx6 RZvg== X-Received: by 2002:a17:90b:4a06:b0:3a4:9dd7:296f with SMTP id 98e67ed59e1d1-3b41caec8a1mr41642615a91.40.1796281507653; 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: linux-usb@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-Authority-Analysis: v=2.4 cv=OaENnRTY c=1 sm=1 tr=0 ts=6b1114a4 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=P9BdI5F+mvP9aojgogbvCw==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=WCsEc79AI33hBFpqUJsA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDAyNiBTYWx0ZWRfX1J+UrgUwhcA4 hJ+NOY9K/+ITvmxO8Edz3zfvXF8RAMMY7eQlvIJ+xEmpIct6bzfd/NIwyFOkjLOZ5iG0QMb6Guk U0Tsh9/9BUiiBsVlnE5LA66oP3WsUkBQMF3rG7bWlOaqyHqEuZ7atkk9wZxwnz1vWRJSTqWupah dpsf6KKishVlR3rLqRsKotxMGwpQBweO1LVEu2bOmGHbPB++LqiXwv1nAwO5cC8v6l46NvTFG5g XCPQm+I5tcrnuhfi6izigJ56najjUmhBa5GdjrLa+dt043kGZxelqvIR/FXMeFvOuzFsjyjG95h 40nLu/7CsshAFzs53KEa41ChI2ts3z/AevV0s9z64rHhWcPpkpb/4Ep9qbwPxggJmb799oV5PTj Fr8Uh47r3830pDRBVf4onEMNx23IYcRakhvGqDn5QSxjccKSf3y14H9MoBoNp+IrntQeusHstvK QYUWpcPe4xlmwSOV+oQ== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAyNiBTYWx0ZWRfX3oVvYAsjxuYG VC5H8sMukopj6B/O+PLJKbwyfJoEDOOszPnhprH0mhaYkQ5wXo19Y0Z8T49s7a5FQKnccmzIBI1 aDNpystARUcE7Dur+/KGnHGAtY3RU8Q= X-Proofpoint-GUID: GNXk2ku1L3Ncxn5DyUqyPSTSZZ9219V6 X-Proofpoint-ORIG-GUID: GNXk2ku1L3Ncxn5DyUqyPSTSZZ9219V6 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 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 adultscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030026 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 >> >