[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250729221913.33qgxhb77f5hl5df@synopsys.com>
Date: Tue, 29 Jul 2025 22:19:14 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Prashanth K <prashanth.k@....qualcomm.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Bjorn Andersson <bjorn.andersson@....qualcomm.com>,
Krishna Kurapati <krishna.kurapati@....qualcomm.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc3: qcom: Add shutdown handler
On Fri, Jul 25, 2025, Prashanth K wrote:
> Currently during system reboot, SMMU disables its translations
> while devices like USB may still be actively using DMA buffers.
> This can lead to NOC errors and system crashes due to invalid
> memory access.
>
> Address this by adding a shutdown callback to dwc3-qcom, which
> ensures proper teardown of UDC stack and prevents DWC3 controller
> from accessing memory after SMMU translation is disabled. Reuse
> the existing remove callback for this purpose.
>
> Signed-off-by: Prashanth K <prashanth.k@....qualcomm.com>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index ca7e1c02773a..308360a32c93 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -764,11 +764,14 @@ static void dwc3_qcom_remove(struct platform_device *pdev)
> struct dwc3 *dwc = platform_get_drvdata(pdev);
> struct dwc3_qcom *qcom = to_dwc3_qcom(dwc);
>
> - dwc3_core_remove(&qcom->dwc);
> + if (pm_runtime_resume_and_get(qcom->dev) < 0)
> + return;
>
> + dwc3_core_remove(&qcom->dwc);
> clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks);
> -
> dwc3_qcom_interconnect_exit(qcom);
> +
> + pm_runtime_put_noidle(qcom->dev);
> }
>
> static int dwc3_qcom_pm_suspend(struct device *dev)
> @@ -873,6 +876,7 @@ MODULE_DEVICE_TABLE(of, dwc3_qcom_of_match);
> static struct platform_driver dwc3_qcom_driver = {
> .probe = dwc3_qcom_probe,
> .remove = dwc3_qcom_remove,
> + .shutdown = dwc3_qcom_remove,
> .driver = {
> .name = "dwc3-qcom",
> .pm = pm_ptr(&dwc3_qcom_dev_pm_ops),
> --
> 2.25.1
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
BR,
Thinh
Powered by blists - more mailing lists