On Tue, May 09, 2023 at 08:18:36PM +0530, Udipto Goswami wrote:
When the dwc3 device is runtime suspended, various required clocks are in disabled state and it is not guaranteed that access to any registers would work. Depending on the SoC glue, a register read could be as benign as returning 0 or be fatal enough to hang the system.
In order to prevent such scenarios of fatal errors, make sure to resume dwc3 then allow the function to proceed.
Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") Cc: stable@vger.kernel.org #3.2: 30332eeefec8: debugfs: regset32: Add Runtime PM support Signed-off-by: Udipto Goswami quic_ugoswami@quicinc.com
v10: Re-wrote the subject & the commit text along with the dependency. v9: Fixed function dwc3_rx_fifo_size_show & return values in function dwc3_link_state_write along with minor changes for code symmetry. v8: Replace pm_runtime_get_sync with pm_runtime_resume_and get. v7: Replaced pm_runtime_put with pm_runtime_put_sync & returned proper values. v6: Added changes to handle get_dync failure appropriately. v5: Reworked the patch to resume dwc3 while accessing the registers. v4: Introduced pm_runtime_get_if_in_use in order to make sure dwc3 isn't suspended while accessing the registers. v3: Replace pr_err to dev_err. v2: Replaced return 0 with -EINVAL & seq_puts with pr_err.
I've verified that this prevents the system from hanging when accessing the debugfs interface while the controller is runtime suspended on the ThinkPad X13s (sc8280xp):
Reviewed-by: Johan Hovold johan+linaro@kernel.org Tested-by: Johan Hovold johan+linaro@kernel.org
Johan