From 4701152149a5dd3da04daba3d2843ff3d1541af8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 13 May 2024 15:26:59 +0200 Subject: [PATCH] 5.10-stable patches added patches: alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch usb-dwc3-core-prevent-phy-suspend-during-init.patch usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch usb-gadget-composite-fix-os-descriptors-w_value-logic.patch usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch usb-ohci-prevent-missed-ohci-interrupts.patch usb-xhci-plat-don-t-include-xhci.h.patch --- ...ix-mute-led-of-hp-laptop-15-da3001tu.patch | 31 +++ queue-5.10/series | 7 + ...core-prevent-phy-suspend-during-init.patch | 262 ++++++++++++++++++ ...xpacket-in-virtual-superspeed-device.patch | 46 +++ ...ite-fix-os-descriptors-w_value-logic.patch | 78 ++++++ ...dition-when-processing-setup-packets.patch | 34 +++ ...-ohci-prevent-missed-ohci-interrupts.patch | 60 ++++ .../usb-xhci-plat-don-t-include-xhci.h.patch | 35 +++ 8 files changed, 553 insertions(+) create mode 100644 queue-5.10/alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch create mode 100644 queue-5.10/usb-dwc3-core-prevent-phy-suspend-during-init.patch create mode 100644 queue-5.10/usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch create mode 100644 queue-5.10/usb-gadget-composite-fix-os-descriptors-w_value-logic.patch create mode 100644 queue-5.10/usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch create mode 100644 queue-5.10/usb-ohci-prevent-missed-ohci-interrupts.patch create mode 100644 queue-5.10/usb-xhci-plat-don-t-include-xhci.h.patch diff --git a/queue-5.10/alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch b/queue-5.10/alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch new file mode 100644 index 00000000000..0782898c845 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch @@ -0,0 +1,31 @@ +From 2d5af3ab9e6f1cf1468b2a5221b5c1f7f46c3333 Mon Sep 17 00:00:00 2001 +From: Aman Dhoot +Date: Mon, 22 Apr 2024 18:08:23 +0530 +Subject: ALSA: hda/realtek: Fix mute led of HP Laptop 15-da3001TU + +From: Aman Dhoot + +commit 2d5af3ab9e6f1cf1468b2a5221b5c1f7f46c3333 upstream. + +This patch simply add SND_PCI_QUIRK for HP Laptop 15-da3001TU to fixed +mute led of laptop. + +Signed-off-by: Aman Dhoot +Cc: +Link: https://lore.kernel.org/r/CAMTp=B+3NG65Z684xMwHqdXDJhY+DJK-kuSw4adn6xwnG+b5JA@mail.gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9066,6 +9066,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), ++ SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2), + SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO), + SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), + SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), diff --git a/queue-5.10/series b/queue-5.10/series index e114cb6a3fb..05711e4cf95 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -93,3 +93,10 @@ firewire-nosy-ensure-user_length-is-taken-into-account-when-fetching-packet-cont arm64-dts-qcom-fix-interrupt-map-parent-address-cells.patch usb-typec-ucsi-check-for-notifications-after-init.patch usb-typec-ucsi-fix-connector-check-on-init.patch +usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch +usb-ohci-prevent-missed-ohci-interrupts.patch +usb-gadget-composite-fix-os-descriptors-w_value-logic.patch +usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch +usb-xhci-plat-don-t-include-xhci.h.patch +usb-dwc3-core-prevent-phy-suspend-during-init.patch +alsa-hda-realtek-fix-mute-led-of-hp-laptop-15-da3001tu.patch diff --git a/queue-5.10/usb-dwc3-core-prevent-phy-suspend-during-init.patch b/queue-5.10/usb-dwc3-core-prevent-phy-suspend-during-init.patch new file mode 100644 index 00000000000..3e923772cd0 --- /dev/null +++ b/queue-5.10/usb-dwc3-core-prevent-phy-suspend-during-init.patch @@ -0,0 +1,262 @@ +From 6d735722063a945de56472bdc6bfcb170fd43b86 Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Wed, 17 Apr 2024 23:14:36 +0000 +Subject: usb: dwc3: core: Prevent phy suspend during init + +From: Thinh Nguyen + +commit 6d735722063a945de56472bdc6bfcb170fd43b86 upstream. + +GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY should be cleared +during initialization. Suspend during initialization can result in +undefined behavior due to clock synchronization failure, which often +seen as core soft reset timeout. + +The programming guide recommended these bits to be cleared during +initialization for DWC_usb3.0 version 1.94 and above (along with +DWC_usb31 and DWC_usb32). The current check in the driver does not +account if it's set by default setting from coreConsultant. + +This is especially the case for DRD when switching mode to ensure the +phy clocks are available to change mode. Depending on the +platforms/design, some may be affected more than others. This is noted +in the DWC_usb3x programming guide under the above registers. + +Let's just disable them during driver load and mode switching. Restore +them when the controller initialization completes. + +Note that some platforms workaround this issue by disabling phy suspend +through "snps,dis_u3_susphy_quirk" and "snps,dis_u2_susphy_quirk" when +they should not need to. + +Cc: stable@vger.kernel.org +Fixes: 9ba3aca8fe82 ("usb: dwc3: Disable phy suspend after power-on reset") +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/20da4e5a0c4678c9587d3da23f83bdd6d77353e9.1713394973.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 90 +++++++++++++++++++--------------------------- + drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/gadget.c | 2 + + drivers/usb/dwc3/host.c | 27 +++++++++++++ + 4 files changed, 68 insertions(+), 52 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -102,6 +102,27 @@ static int dwc3_get_dr_mode(struct dwc3 + return 0; + } + ++void dwc3_enable_susphy(struct dwc3 *dwc, bool enable) ++{ ++ u32 reg; ++ ++ reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); ++ if (enable && !dwc->dis_u3_susphy_quirk) ++ reg |= DWC3_GUSB3PIPECTL_SUSPHY; ++ else ++ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; ++ ++ dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); ++ ++ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); ++ if (enable && !dwc->dis_u2_susphy_quirk) ++ reg |= DWC3_GUSB2PHYCFG_SUSPHY; ++ else ++ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; ++ ++ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); ++} ++ + void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) + { + u32 reg; +@@ -590,11 +611,8 @@ static int dwc3_core_ulpi_init(struct dw + */ + static int dwc3_phy_setup(struct dwc3 *dwc) + { +- unsigned int hw_mode; + u32 reg; + +- hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); +- + reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); + + /* +@@ -604,21 +622,16 @@ static int dwc3_phy_setup(struct dwc3 *d + reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX; + + /* +- * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY +- * to '0' during coreConsultant configuration. So default value +- * will be '0' when the core is reset. Application needs to set it +- * to '1' after the core initialization is completed. ++ * Above DWC_usb3.0 1.94a, it is recommended to set ++ * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration. ++ * So default value will be '0' when the core is reset. Application ++ * needs to set it to '1' after the core initialization is completed. ++ * ++ * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be ++ * cleared after power-on reset, and it can be set after core ++ * initialization. + */ +- if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) +- reg |= DWC3_GUSB3PIPECTL_SUSPHY; +- +- /* +- * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after +- * power-on reset, and it can be set after core initialization, which is +- * after device soft-reset during initialization. +- */ +- if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD) +- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; ++ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; + + if (dwc->u2ss_inp3_quirk) + reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK; +@@ -644,9 +657,6 @@ static int dwc3_phy_setup(struct dwc3 *d + if (dwc->tx_de_emphasis_quirk) + reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis); + +- if (dwc->dis_u3_susphy_quirk) +- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; +- + if (dwc->dis_del_phy_power_chg_quirk) + reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE; + +@@ -694,24 +704,15 @@ static int dwc3_phy_setup(struct dwc3 *d + } + + /* +- * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to +- * '0' during coreConsultant configuration. So default value will +- * be '0' when the core is reset. Application needs to set it to +- * '1' after the core initialization is completed. +- */ +- if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) +- reg |= DWC3_GUSB2PHYCFG_SUSPHY; +- +- /* +- * For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after +- * power-on reset, and it can be set after core initialization, which is +- * after device soft-reset during initialization. ++ * Above DWC_usb3.0 1.94a, it is recommended to set ++ * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration. ++ * So default value will be '0' when the core is reset. Application ++ * needs to set it to '1' after the core initialization is completed. ++ * ++ * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared ++ * after power-on reset, and it can be set after core initialization. + */ +- if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD) +- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; +- +- if (dwc->dis_u2_susphy_quirk) +- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; ++ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; + + if (dwc->dis_enblslpm_quirk) + reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; +@@ -993,21 +994,6 @@ static int dwc3_core_init(struct dwc3 *d + if (ret) + goto err1; + +- if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && +- !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { +- if (!dwc->dis_u3_susphy_quirk) { +- reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); +- reg |= DWC3_GUSB3PIPECTL_SUSPHY; +- dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); +- } +- +- if (!dwc->dis_u2_susphy_quirk) { +- reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); +- reg |= DWC3_GUSB2PHYCFG_SUSPHY; +- dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); +- } +- } +- + dwc3_core_setup_global_control(dwc); + dwc3_core_num_eps(dwc); + +--- a/drivers/usb/dwc3/core.h ++++ b/drivers/usb/dwc3/core.h +@@ -1456,6 +1456,7 @@ int dwc3_event_buffers_setup(struct dwc3 + void dwc3_event_buffers_cleanup(struct dwc3 *dwc); + + int dwc3_core_soft_reset(struct dwc3 *dwc); ++void dwc3_enable_susphy(struct dwc3 *dwc, bool enable); + + #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) + int dwc3_host_init(struct dwc3 *dwc); +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -2380,6 +2380,7 @@ static int __dwc3_gadget_start(struct dw + dwc3_ep0_out_start(dwc); + + dwc3_gadget_enable_irq(dwc); ++ dwc3_enable_susphy(dwc, true); + + return 0; + +@@ -4046,6 +4047,7 @@ void dwc3_gadget_exit(struct dwc3 *dwc) + if (!dwc->gadget) + return; + ++ dwc3_enable_susphy(dwc, false); + usb_del_gadget(dwc->gadget); + dwc3_gadget_free_endpoints(dwc); + usb_put_gadget(dwc->gadget); +--- a/drivers/usb/dwc3/host.c ++++ b/drivers/usb/dwc3/host.c +@@ -9,9 +9,30 @@ + + #include + #include ++#include ++#include + ++#include "../host/xhci-plat.h" + #include "core.h" + ++static void dwc3_xhci_plat_start(struct usb_hcd *hcd) ++{ ++ struct platform_device *pdev; ++ struct dwc3 *dwc; ++ ++ if (!usb_hcd_is_primary_hcd(hcd)) ++ return; ++ ++ pdev = to_platform_device(hcd->self.controller); ++ dwc = dev_get_drvdata(pdev->dev.parent); ++ ++ dwc3_enable_susphy(dwc, true); ++} ++ ++static const struct xhci_plat_priv dwc3_xhci_plat_quirk = { ++ .plat_start = dwc3_xhci_plat_start, ++}; ++ + static int dwc3_host_get_irq(struct dwc3 *dwc) + { + struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); +@@ -115,6 +136,11 @@ int dwc3_host_init(struct dwc3 *dwc) + } + } + ++ ret = platform_device_add_data(xhci, &dwc3_xhci_plat_quirk, ++ sizeof(struct xhci_plat_priv)); ++ if (ret) ++ goto err; ++ + ret = platform_device_add(xhci); + if (ret) { + dev_err(dwc->dev, "failed to register xHCI device\n"); +@@ -129,6 +155,7 @@ err: + + void dwc3_host_exit(struct dwc3 *dwc) + { ++ dwc3_enable_susphy(dwc, false); + platform_device_unregister(dwc->xhci); + dwc->xhci = NULL; + } diff --git a/queue-5.10/usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch b/queue-5.10/usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch new file mode 100644 index 00000000000..22cb441302b --- /dev/null +++ b/queue-5.10/usb-fix-regression-caused-by-invalid-ep0-maxpacket-in-virtual-superspeed-device.patch @@ -0,0 +1,46 @@ +From c78c3644b772e356ca452ae733a3c4de0fb11dc8 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Tue, 30 Apr 2024 10:33:48 -0400 +Subject: usb: Fix regression caused by invalid ep0 maxpacket in virtual SuperSpeed device + +From: Alan Stern + +commit c78c3644b772e356ca452ae733a3c4de0fb11dc8 upstream. + +A virtual SuperSpeed device in the FreeBSD BVCP package +(https://bhyve.npulse.net/) presents an invalid ep0 maxpacket size of 256. +It stopped working with Linux following a recent commit because now we +check these sizes more carefully than before. + +Fix this regression by using the bMaxpacketSize0 value in the device +descriptor for SuperSpeed or faster devices, even if it is invalid. This +is a very simple-minded change; we might want to check more carefully for +values that actually make some sense (for instance, no smaller than 64). + +Signed-off-by: Alan Stern +Reported-and-tested-by: Roger Whittaker +Closes: https://bugzilla.suse.com/show_bug.cgi?id=1220569 +Link: https://lore.kernel.org/linux-usb/9efbd569-7059-4575-983f-0ea30df41871@suse.com/ +Fixes: 59cf44575456 ("USB: core: Fix oversight in SuperSpeed initialization") +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/4058ac05-237c-4db4-9ecc-5af42bdb4501@rowland.harvard.edu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/hub.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -5053,9 +5053,10 @@ hub_port_init(struct usb_hub *hub, struc + } + if (usb_endpoint_maxp(&udev->ep0.desc) == i) { + ; /* Initial ep0 maxpacket guess is right */ +- } else if ((udev->speed == USB_SPEED_FULL || ++ } else if (((udev->speed == USB_SPEED_FULL || + udev->speed == USB_SPEED_HIGH) && +- (i == 8 || i == 16 || i == 32 || i == 64)) { ++ (i == 8 || i == 16 || i == 32 || i == 64)) || ++ (udev->speed >= USB_SPEED_SUPER && i > 0)) { + /* Initial guess is wrong; use the descriptor's value */ + if (udev->speed == USB_SPEED_FULL) + dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); diff --git a/queue-5.10/usb-gadget-composite-fix-os-descriptors-w_value-logic.patch b/queue-5.10/usb-gadget-composite-fix-os-descriptors-w_value-logic.patch new file mode 100644 index 00000000000..e49f4a910c5 --- /dev/null +++ b/queue-5.10/usb-gadget-composite-fix-os-descriptors-w_value-logic.patch @@ -0,0 +1,78 @@ +From ec6ce7075ef879b91a8710829016005dc8170f17 Mon Sep 17 00:00:00 2001 +From: Peter Korsgaard +Date: Thu, 4 Apr 2024 12:06:35 +0200 +Subject: usb: gadget: composite: fix OS descriptors w_value logic + +From: Peter Korsgaard + +commit ec6ce7075ef879b91a8710829016005dc8170f17 upstream. + +The OS descriptors logic had the high/low byte of w_value inverted, causing +the extended properties to not be accessible for interface != 0. + +>From the Microsoft documentation: +https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-os-1-0-descriptors-specification + +OS_Desc_CompatID.doc (w_index = 0x4): + +- wValue: + + High Byte = InterfaceNumber. InterfaceNumber is set to the number of the + interface or function that is associated with the descriptor, typically + 0x00. Because a device can have only one extended compat ID descriptor, + it should ignore InterfaceNumber, regardless of the value, and simply + return the descriptor. + + Low Byte = 0. PageNumber is used to retrieve descriptors that are larger + than 64 KB. The header section is 16 bytes, so PageNumber is set to 0 for + this request. + +We currently do not support >64KB compat ID descriptors, so verify that the +low byte is 0. + +OS_Desc_Ext_Prop.doc (w_index = 0x5): + +- wValue: + + High byte = InterfaceNumber. The high byte of wValue is set to the number + of the interface or function that is associated with the descriptor. + + Low byte = PageNumber. The low byte of wValue is used to retrieve + descriptors that are larger than 64 KB. The header section is 10 bytes, so + PageNumber is set to 0 for this request. + +We also don't support >64KB extended properties, so verify that the low byte +is 0 and use the high byte for the interface number. + +Fixes: 37a3a533429e ("usb: gadget: OS Feature Descriptors support") +Cc: stable +Signed-off-by: Peter Korsgaard +Link: https://lore.kernel.org/r/20240404100635.3215340-1-peter@korsgaard.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/composite.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/usb/gadget/composite.c ++++ b/drivers/usb/gadget/composite.c +@@ -1925,7 +1925,7 @@ unknown: + buf[5] = 0x01; + switch (ctrl->bRequestType & USB_RECIP_MASK) { + case USB_RECIP_DEVICE: +- if (w_index != 0x4 || (w_value >> 8)) ++ if (w_index != 0x4 || (w_value & 0xff)) + break; + buf[6] = w_index; + /* Number of ext compat interfaces */ +@@ -1941,9 +1941,9 @@ unknown: + } + break; + case USB_RECIP_INTERFACE: +- if (w_index != 0x5 || (w_value >> 8)) ++ if (w_index != 0x5 || (w_value & 0xff)) + break; +- interface = w_value & 0xFF; ++ interface = w_value >> 8; + if (interface >= MAX_CONFIG_INTERFACES || + !os_desc_cfg->interface[interface]) + break; diff --git a/queue-5.10/usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch b/queue-5.10/usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch new file mode 100644 index 00000000000..06ea2612497 --- /dev/null +++ b/queue-5.10/usb-gadget-f_fs-fix-a-race-condition-when-processing-setup-packets.patch @@ -0,0 +1,34 @@ +From 0aea736ddb877b93f6d2dd8cf439840d6b4970a9 Mon Sep 17 00:00:00 2001 +From: Chris Wulff +Date: Tue, 23 Apr 2024 18:02:15 +0000 +Subject: usb: gadget: f_fs: Fix a race condition when processing setup packets. + +From: Chris Wulff + +commit 0aea736ddb877b93f6d2dd8cf439840d6b4970a9 upstream. + +If the USB driver passes a pointer into the TRB buffer for creq, this +buffer can be overwritten with the status response as soon as the event +is queued. This can make the final check return USB_GADGET_DELAYED_STATUS +when it shouldn't. Instead use the stored wLength. + +Fixes: 4d644abf2569 ("usb: gadget: f_fs: Only return delayed status when len is 0") +Cc: stable +Signed-off-by: Chris Wulff +Link: https://lore.kernel.org/r/CO1PR17MB5419BD664264A558B2395E28E1112@CO1PR17MB5419.namprd17.prod.outlook.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/f_fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/f_fs.c ++++ b/drivers/usb/gadget/function/f_fs.c +@@ -3403,7 +3403,7 @@ static int ffs_func_setup(struct usb_fun + __ffs_event_add(ffs, FUNCTIONFS_SETUP); + spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); + +- return creq->wLength == 0 ? USB_GADGET_DELAYED_STATUS : 0; ++ return ffs->ev.setup.wLength == 0 ? USB_GADGET_DELAYED_STATUS : 0; + } + + static bool ffs_func_req_match(struct usb_function *f, diff --git a/queue-5.10/usb-ohci-prevent-missed-ohci-interrupts.patch b/queue-5.10/usb-ohci-prevent-missed-ohci-interrupts.patch new file mode 100644 index 00000000000..d6f6a16d470 --- /dev/null +++ b/queue-5.10/usb-ohci-prevent-missed-ohci-interrupts.patch @@ -0,0 +1,60 @@ +From fe81f354841641c7f71163b84912b25c169ed8ec Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Mon, 29 Apr 2024 08:40:10 -0700 +Subject: usb: ohci: Prevent missed ohci interrupts + +From: Guenter Roeck + +commit fe81f354841641c7f71163b84912b25c169ed8ec upstream. + +Testing ohci functionality with qemu's pci-ohci emulation often results +in ohci interface stalls, resulting in hung task timeouts. + +The problem is caused by lost interrupts between the emulation and the +Linux kernel code. Additional interrupts raised while the ohci interrupt +handler in Linux is running and before the handler clears the interrupt +status are not handled. The fix for a similar problem in ehci suggests +that the problem is likely caused by edge-triggered MSI interrupts. See +commit 0b60557230ad ("usb: ehci: Prevent missed ehci interrupts with +edge-triggered MSI") for details. + +Ensure that the ohci interrupt code handles all pending interrupts before +returning to solve the problem. + +Cc: Gerd Hoffmann +Cc: David Laight +Cc: stable@vger.kernel.org +Fixes: 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices") +Signed-off-by: Guenter Roeck +Reviewed-by: Alan Stern +Reviewed-by: Gerd Hoffmann +Link: https://lore.kernel.org/r/20240429154010.1507366-1-linux@roeck-us.net +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/ohci-hcd.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -890,6 +890,7 @@ static irqreturn_t ohci_irq (struct usb_ + /* Check for an all 1's result which is a typical consequence + * of dead, unclocked, or unplugged (CardBus...) devices + */ ++again: + if (ints == ~(u32)0) { + ohci->rh_state = OHCI_RH_HALTED; + ohci_dbg (ohci, "device removed!\n"); +@@ -984,6 +985,13 @@ static irqreturn_t ohci_irq (struct usb_ + } + spin_unlock(&ohci->lock); + ++ /* repeat until all enabled interrupts are handled */ ++ if (ohci->rh_state != OHCI_RH_HALTED) { ++ ints = ohci_readl(ohci, ®s->intrstatus); ++ if (ints && (ints & ohci_readl(ohci, ®s->intrenable))) ++ goto again; ++ } ++ + return IRQ_HANDLED; + } + diff --git a/queue-5.10/usb-xhci-plat-don-t-include-xhci.h.patch b/queue-5.10/usb-xhci-plat-don-t-include-xhci.h.patch new file mode 100644 index 00000000000..23ef70ce8e5 --- /dev/null +++ b/queue-5.10/usb-xhci-plat-don-t-include-xhci.h.patch @@ -0,0 +1,35 @@ +From 4a237d55446ff67655dc3eed2d4a41997536fc4c Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Wed, 17 Apr 2024 23:14:30 +0000 +Subject: usb: xhci-plat: Don't include xhci.h + +From: Thinh Nguyen + +commit 4a237d55446ff67655dc3eed2d4a41997536fc4c upstream. + +The xhci_plat.h should not need to include the entire xhci.h header. +This can cause redefinition in dwc3 if it selectively includes some xHCI +definitions. This is a prerequisite change for a fix to disable suspend +during initialization for dwc3. + +Cc: stable@vger.kernel.org +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/310acfa01c957a10d9feaca3f7206269866ba2eb.1713394973.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci-plat.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/xhci-plat.h ++++ b/drivers/usb/host/xhci-plat.h +@@ -8,7 +8,9 @@ + #ifndef _XHCI_PLAT_H + #define _XHCI_PLAT_H + +-#include "xhci.h" /* for hcd_to_xhci() */ ++struct device; ++struct platform_device; ++struct usb_hcd; + + struct xhci_plat_priv { + const char *firmware_name; -- 2.47.2