From: Faisal Hassan <faisal.hassan@oss.qualcomm.com>
To: Peter Chen <peter.chen@oss.qualcomm.com>
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
Subject: Re: [PATCH v5 03/11] usb: dwc3: qcom: Keep wakeup IRQ enable/disable balanced on failed resume
Date: Thu, 3 Dec 2026 12:35:02 +0530 [thread overview]
Message-ID: <25b74357-ddab-47bd-9d8b-60fcc2059ce0@oss.qualcomm.com> (raw)
In-Reply-To: <awfv5SLoUnYlJUWi@hu-petche-lv.qualcomm.com>
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 <faisal.hassan@oss.qualcomm.com>
>
> Reviewed-by: Peter Chen <peter.chen@oss.qualcomm.com>
>
> 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
>>
>
next prev parent reply other threads:[~2026-12-03 7:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 10:47 [PATCH v5 00/11] usb: dwc3: qcom: Add firmware-managed resource support for SA8255P Faisal Hassan
2026-11-23 10:47 ` [PATCH v5 01/11] usb: dwc3: qcom: Distinguish PM and runtime suspend/resume paths Faisal Hassan
2026-11-26 7:40 ` Peter Chen
2026-11-23 10:47 ` [PATCH v5 02/11] usb: dwc3: qcom: Disarm wakeup IRQs on system suspend without wakeup Faisal Hassan
2026-11-26 7:44 ` Peter Chen
2026-11-23 10:47 ` [PATCH v5 03/11] usb: dwc3: qcom: Keep wakeup IRQ enable/disable balanced on failed resume Faisal Hassan
2026-11-26 8:37 ` Peter Chen
2026-12-03 7:05 ` Faisal Hassan [this message]
2026-11-26 17:31 ` Krishna Kurapati
2026-12-03 21:16 ` Greg KH
2026-11-23 10:47 ` [PATCH v5 04/11] dt-bindings: usb: Add qcom,sa8255p-dwc3 for firmware-managed resources Faisal Hassan
2026-11-23 10:47 ` [PATCH v5 05/11] usb: host: xhci-plat: Support XHCI_RESET_ON_RESUME via device property Faisal Hassan
2026-11-23 10:47 ` [PATCH v5 06/11] usb: dwc3: Support resetting the xHCI host on system resume Faisal Hassan
2026-11-23 10:47 ` [PATCH v5 07/11] usb: dwc3: qcom: Recover controller state after power loss in system suspend Faisal Hassan
2026-11-26 9:52 ` Peter Chen
2026-12-03 7:04 ` Faisal Hassan
2026-11-23 10:47 ` [PATCH v5 08/11] usb: dwc3: qcom: Restore VBUS override after system resume Faisal Hassan
2026-11-26 9:54 ` Peter Chen
2026-11-26 17:32 ` Krishna Kurapati
2026-11-23 10:47 ` [PATCH v5 09/11] usb: dwc3: qcom: Assert controller reset on remove and probe failure Faisal Hassan
2026-11-26 9:56 ` Peter Chen
2026-11-23 10:47 ` [PATCH v5 10/11] usb: dwc3: qcom: Support firmware-managed resource states for power management Faisal Hassan
2026-11-26 10:09 ` Peter Chen
2026-11-23 10:47 ` [PATCH v5 11/11] usb: dwc3: qcom: Enable VBUS override at probe for default peripheral role Faisal Hassan
2026-11-26 10:12 ` Peter Chen
2026-11-26 17:34 ` Krishna Kurapati
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25b74357-ddab-47bd-9d8b-60fcc2059ce0@oss.qualcomm.com \
--to=faisal.hassan@oss.qualcomm.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krishna.kurapati@oss.qualcomm.com \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.