Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: qcom: Add shutdown handler

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@oss.qualcomm.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20250725062158.2418961-1-prashanth.k@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Prashanth K and committed by
Greg Kroah-Hartman
784ad808 8f5ae30d

+6 -2
+6 -2
drivers/usb/dwc3/dwc3-qcom.c
··· 764 764 struct dwc3 *dwc = platform_get_drvdata(pdev); 765 765 struct dwc3_qcom *qcom = to_dwc3_qcom(dwc); 766 766 767 + if (pm_runtime_resume_and_get(qcom->dev) < 0) 768 + return; 769 + 767 770 dwc3_core_remove(&qcom->dwc); 768 - 769 771 clk_bulk_disable_unprepare(qcom->num_clocks, qcom->clks); 770 - 771 772 dwc3_qcom_interconnect_exit(qcom); 773 + 774 + pm_runtime_put_noidle(qcom->dev); 772 775 } 773 776 774 777 static int dwc3_qcom_pm_suspend(struct device *dev) ··· 876 873 static struct platform_driver dwc3_qcom_driver = { 877 874 .probe = dwc3_qcom_probe, 878 875 .remove = dwc3_qcom_remove, 876 + .shutdown = dwc3_qcom_remove, 879 877 .driver = { 880 878 .name = "dwc3-qcom", 881 879 .pm = pm_ptr(&dwc3_qcom_dev_pm_ops),