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=j3bpO2QJ9qe7MQDajAorRzx/nE3VGOjNVkUw8P+ENR40w9a1HjutR4mhIZCrxmcuilyB jFjcN93iCv9NpgVlcQ8q09WQ2fIKE6x3T9Ewj9rtkTSJsNwXYSOuNbyblESJzRVqGqm/M olyAE5xhhS7I4iyzNDCdwAoQAMTwQaz5u6TFns1BiB5fJ5qvosQHyCLkWjEdKsT4fERju VsT/RE7iqR5WIPD3JfWJWg0p2b3Ca4CU9wvkSbglSVMZIht1Li0U5xAw+NO+aNySPCc2H xGSMEX0rb6KK/hYYvaNsPcyQFRw5CHYolPQuHfKjdL0pSg6aZkZBCW51E0Hgf7TDXdQ== 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-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=rvTETEf/kxbZqQUmIxBKyadgaGpYAOr5eQhePblL+GP7ivZtWzYRKKIDF2UUJSjiWdf7 Y++Ht71QtXLIc9DboHShr8tTeM2h4gh4Sfr5XAvL5HXqLPczIOVbiAdTDW8jmJfbM2TN3 gTU+BYexSwhNOZnqXTkG9MdVay4VGok1gimlGPP8DbpgJFikolym4TrNOE5ungJkD8/wa XEwltm3ALXslxVnXpcwWxcETlctcXmj1mJdWBt0FO0eef0O2ffFufY+MzgaTwoTRfSg7y J8k/8c/WONW3CI/rFu7WIiKE8BYjSh/ReEiYYgyJabfGVQplLDaLGzCUeFLKL9XB+iQ== 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 44D8B606A32F for ; Thu, 3 Dec 2026 07:05:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 44D8B606A32F 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 6B36mvXE2591996 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 4jb3g4021p-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-3b456fee3b2so11301836a91.1 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=hvQe9tUQnzBsFOZy7MuQNBWP5IHnjq4uYxooDPu3cBN39fpUrYtmWk++/6Ys42YdtB 2Fal9tA9S514fTg0dwPHAQ/ldPqiVdNeCIEy8NxNDOCLJHJclWDxbcJw4WoMX3sng042 WfXuENft0FnYqxWSjOmfH4IC3eadmbPvPhuxsW5tGWawvakxtzEMN9AYOXby79EZfJkv 5jBizqBgN8hiT09uKjHijMfcixIwa7RpLEvyTpn7DBc46s5y+FQBnZeYxxWJlerhhg72 HCMzIxwbh/9cngAr7vZCvgtYKT3qsul6dM+aFd0ScXVpEzvtGrAUL7FzCwN3fuSeP0yS cOSA== X-Forwarded-Encrypted: i=1; AL+hErHacBS5J1d04ktZyJVs/+drESknr1iI9/mu7Ke73Rfh5IdiaaJehLo2C7fGkl9GhGKGYl+h6bi6FOUJAoA=@vger.kernel.org X-Gm-Message-State: APuU4Z/ibka7tzY8jtI5hOJ2rTwRScq2diT91/ogThjLH9OqfHl2TZOU 3IvMtYvGxUjxhdyU1DeFHPBS0oRGQPkDWBvqXAztX1TBwkU5L64zi2etq+BZDLpdfWWIjHHAQtg WrbbuRd9RWsaXQkwA3sgP6q4CGte2Au8+dMCz5WAWT4L4uz5VhHgjxuFAI2qLERnTgntR8DjYbn E= X-Gm-Gg: AZFdTZeVUQ3LstzJwSeJldrPZ42weUvd0SYI0QrqVCc4E+T8hV5yzZFgHLg5eN3gWVg XjBuXXCKF3IztTuNEY0ySz430prAJbv7Ja+fKQctaiBGQr4XxVB6x+fCkHCKmhDYfMq3BscTr2+ jpGMGC2ENI7NEH9RAKrfqQBGx2DLOjkjEDgFd0+jBjdX1/9+iuWK/oy7DxlZj+sWC5hxHc+d6ws I7lp85bREmQGYAv5aybJFOPMt9Gq9B3Bs5EuL7EEqey2X3gw9l8ee8GZ7BhS8WGtWC5DGiOQrbD ax1Qq85hpeL9Y8d0xfe5crZ8w2Le0POagsoaSOMafpRre3RbCTyXIC7IhJikE9gjkmIFZ7go490 1AK/XYkaHECvoPV6mgpoHUX8i3lgQl4oa8E1/Z3b7H0/1DospO38kmFuRqbDtf3PkZxNE6jl/ba KG+g== X-Received: by 2002:a17:90b:4a06:b0:3a4:9dd7:296f with SMTP id 98e67ed59e1d1-3b41caec8a1mr41642608a91.40.1796281507642; 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-kernel@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: AW1haW4tMjYxMjAzMDAyNiBTYWx0ZWRfX0G7w7NV0WjCR y3s/69fF9Vcb8m5x21M2f8Yyveo9EZPmsOnsJUMYDZ8w/InNbwC3CVBAZSzy8QzGD7V4QHK7tkU Oay2uqmCuP6exX1pHSwnCz9Xztmt6r+9LsvCnV72+KsNyzI/zuT+4no2uW1fcZB9fHhVB8Smlp6 RqBUgpF6RN7gdVXIZi6DpAKFbXa4DvssgaHh4I1+jXviLogkmfKfcwU4unR4/YPg8PXhH9QKxX9 /D90ayKGDqciTCUDFICYX6qb9QOS8kA0dcNBWAqm2QAYx7Xc7uLfB/c3qLDam1qt2GeABXGeZB5 ozOXGf7EMNhDvwGN0YUpZs+xtMdEU/+Qcez98UlQzUzPP7kUVa//LwDLKZCCWckuUpgzZWxs9Wj fCzl8Jr+7hUBVlAmZGbl3k7LNDHb1avuV8PGmoGINns6ZqL2NyIJWrsCXZZ3DCGvV47LLfCnIir PBUIMJxdomC9RGOzA/g== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDAyNiBTYWx0ZWRfX3IxbypDTizvs iFrPXZLoJT5zSQY6YBg/GuAv5vOG2FeGJec8xsvjoiPQDh6I0IgBW7BIAYAIYZUwwZEFiJrE4mm oipuILbxjbw+PXLuL5XoI8Upuj/tTQs= X-Proofpoint-GUID: _FvjKeys8LwsmgnaFcybcjSEkBPFVJ0G X-Proofpoint-ORIG-GUID: _FvjKeys8LwsmgnaFcybcjSEkBPFVJ0G 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 >> >