FAILED: patch "[PATCH] usb: dwc3: core: Stop processing of pending events if" failed to apply to 4.19-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x 0d410e8913f5cffebcca79ffdd596009d4a13a28
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024101439-storable-submerge-797a@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0d410e8913f5cffebcca79ffdd596009d4a13a28 Mon Sep 17 00:00:00 2001
From: Selvarasu Ganesan <[email protected]>
Date: Tue, 17 Sep 2024 04:48:09 +0530
Subject: [PATCH] usb: dwc3: core: Stop processing of pending events if
controller is halted
This commit addresses an issue where events were being processed when the controller was in a halted state. To fix this issue by stop processing the events as the event count was considered stale or invalid when the controller was halted.
drivers/usb/dwc3/core.c +19 -3
@@ -544,6 +544,7 @@ static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length)int dwc3_event_buffers_setup (struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +u32 reg;if (!dwc->ev_buf)return 0 ;
@@ -556,8 +557,10 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) upper_32_bits(evt->dma));dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_SIZE (evt->length)); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg);return 0 ; }
@@ -584,7 +587,10 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc)dwc3_writel (dwc->regs,DWC3_GEVNTADRHI (0 ),0 );dwc3_writel (dwc->regs,DWC3_GEVNTSIZ (0 ),DWC3_GEVNTSIZ_INTMASK |DWC3_GEVNTSIZ_SIZE (0 )); -dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ),0 ); + +/* Clear any stale event */ + reg =dwc3_readl (dwc->regs,DWC3_GEVNTCOUNT (0 )); +dwc3_writel (dwc->regs,DWC3_GEVNTCOUNT (0 ), reg); }static void dwc3_core_num_eps (struct dwc3 *dwc)
@@ -2499,7 +2505,11 @@ static int dwc3_runtime_resume(struct device *dev)switch (dwc->current_dr_role) {case DWC3_GCTL_PRTCAP_DEVICE : -dwc3_gadget_process_pending_events (dwc); +if (dwc->pending_events) { +pm_runtime_put (dwc->dev); + dwc->pending_events = false; +enable_irq (dwc->irq_gadget); + }break ;case DWC3_GCTL_PRTCAP_HOST :default :
@@ -2587,6 +2597,12 @@ static void dwc3_complete(struct device *dev)static const struct dev_pm_ops dwc3_dev_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (dwc3_suspend, dwc3_resume) .complete = dwc3_complete, + +/* +* Runtime suspend halts the controller on disconnection. It relies on +* platforms with custom connection notification to start the controller +* again. +*/ SET_RUNTIME_PM_OPS (dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) };
drivers/usb/dwc3/core.h +0 -4
@@ -1675,7 +1675,6 @@ static inline void dwc3_otg_host_init(struct dwc3 *dwc)#if !IS_ENABLED (CONFIG_USB_DWC3_HOST )int dwc3_gadget_suspend (struct dwc3 *dwc);int dwc3_gadget_resume (struct dwc3 *dwc); -void dwc3_gadget_process_pending_events (struct dwc3 *dwc);#else static inline int dwc3_gadget_suspend (struct dwc3 *dwc) {
@@ -1687,9 +1686,6 @@ static inline int dwc3_gadget_resume(struct dwc3 *dwc) return 0; } -static inline void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -}#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */ #if IS_ENABLED (CONFIG_USB_DWC3_ULPI )
drivers/usb/dwc3/gadget.c +0 -11
@@ -4728,14 +4728,3 @@ int dwc3_gadget_resume(struct dwc3 *dwc)return dwc3_gadget_soft_connect (dwc); } - -void dwc3_gadget_process_pending_events (struct dwc3 *dwc) -{ -if (dwc->pending_events) { -dwc3_interrupt (dwc->irq_gadget, dwc->ev_buf); -dwc3_thread_interrupt (dwc->irq_gadget, dwc->ev_buf); -pm_runtime_put (dwc->dev); - dwc->pending_events = false; -enable_irq (dwc->irq_gadget); - } -}