From: Greg Kroah-Hartman Date: Mon, 17 May 2021 08:15:38 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.4.120~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2439372addaf22feab547fbfd0a3c4a6e252c2db;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch usb-dwc2-fix-gadget-dma-unmap-direction.patch usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch usb-dwc3-omap-improve-extcon-initialization.patch usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch usb-xhci-increase-timeout-for-hc-halt.patch --- diff --git a/queue-4.19/blk-mq-swap-two-calls-in-blk_mq_exit_queue.patch b/queue-4.19/blk-mq-swap-two-calls-in-blk_mq_exit_queue.patch index 1fff61e4899..bf93a6582c5 100644 --- a/queue-4.19/blk-mq-swap-two-calls-in-blk_mq_exit_queue.patch +++ b/queue-4.19/blk-mq-swap-two-calls-in-blk_mq_exit_queue.patch @@ -24,14 +24,12 @@ Link: https://lore.kernel.org/r/20210513171529.7977-1-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- - block/blk-mq.c | 6 ++++-- + block/blk-mq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -diff --git a/block/blk-mq.c b/block/blk-mq.c -index 195526b93895..ae70b4809bec 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c -@@ -2673,10 +2673,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue); +@@ -2673,10 +2673,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queu /* tags can _not_ be used after returning from blk_mq_exit_queue */ void blk_mq_exit_queue(struct request_queue *q) { @@ -46,6 +44,3 @@ index 195526b93895..ae70b4809bec 100644 } /* Basically redo blk_mq_init_queue with queue frozen */ --- -2.30.2 - diff --git a/queue-4.19/series b/queue-4.19/series index f2abe0b164b..d7896e3a27f 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -371,3 +371,9 @@ iio-proximity-pulsedlight-fix-rumtime-pm-imbalance-o.patch usb-fotg210-hcd-fix-an-error-message.patch acpi-scan-fix-a-memory-leak-in-an-error-handling-pat.patch blk-mq-swap-two-calls-in-blk_mq_exit_queue.patch +usb-dwc3-omap-improve-extcon-initialization.patch +usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch +usb-xhci-increase-timeout-for-hc-halt.patch +usb-dwc2-fix-gadget-dma-unmap-direction.patch +usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch +usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch diff --git a/queue-4.19/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch b/queue-4.19/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch new file mode 100644 index 00000000000..b58f711af26 --- /dev/null +++ b/queue-4.19/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch @@ -0,0 +1,45 @@ +From 975f94c7d6c306b833628baa9aec3f79db1eb3a1 Mon Sep 17 00:00:00 2001 +From: Chunfeng Yun +Date: Wed, 12 May 2021 10:07:38 +0800 +Subject: usb: core: hub: fix race condition about TRSMRCY of resume + +From: Chunfeng Yun + +commit 975f94c7d6c306b833628baa9aec3f79db1eb3a1 upstream. + +This may happen if the port becomes resume status exactly +when usb_port_resume() gets port status, it still need provide +a TRSMCRY time before access the device. + +CC: +Reported-by: Tianping Fang +Acked-by: Alan Stern +Signed-off-by: Chunfeng Yun +Link: https://lore.kernel.org/r/20210512020738.52961-1-chunfeng.yun@mediatek.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/hub.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -3539,9 +3539,6 @@ int usb_port_resume(struct usb_device *u + * sequence. + */ + status = hub_port_status(hub, port1, &portstatus, &portchange); +- +- /* TRSMRCY = 10 msec */ +- msleep(10); + } + + SuspendCleared: +@@ -3556,6 +3553,9 @@ int usb_port_resume(struct usb_device *u + usb_clear_port_feature(hub->hdev, port1, + USB_PORT_FEAT_C_SUSPEND); + } ++ ++ /* TRSMRCY = 10 msec */ ++ msleep(10); + } + + if (udev->persist_enabled) diff --git a/queue-4.19/usb-dwc2-fix-gadget-dma-unmap-direction.patch b/queue-4.19/usb-dwc2-fix-gadget-dma-unmap-direction.patch new file mode 100644 index 00000000000..3389ee5d5d1 --- /dev/null +++ b/queue-4.19/usb-dwc2-fix-gadget-dma-unmap-direction.patch @@ -0,0 +1,67 @@ +From 75a41ce46bae6cbe7d3bb2584eb844291d642874 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 6 May 2021 12:22:00 +0100 +Subject: usb: dwc2: Fix gadget DMA unmap direction + +From: Phil Elwell + +commit 75a41ce46bae6cbe7d3bb2584eb844291d642874 upstream. + +The dwc2 gadget support maps and unmaps DMA buffers as necessary. When +mapping and unmapping it uses the direction of the endpoint to select +the direction of the DMA transfer, but this fails for Control OUT +transfers because the unmap occurs after the endpoint direction has +been reversed for the status phase. + +A possible solution would be to unmap the buffer before the direction +is changed, but a safer, less invasive fix is to remember the buffer +direction independently of the endpoint direction. + +Fixes: fe0b94abcdf6 ("usb: dwc2: gadget: manage ep0 state in software") +Acked-by: Minas Harutyunyan +Cc: stable +Signed-off-by: Phil Elwell +Link: https://lore.kernel.org/r/20210506112200.2893922-1-phil@raspberrypi.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/core.h | 2 ++ + drivers/usb/dwc2/gadget.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc2/core.h ++++ b/drivers/usb/dwc2/core.h +@@ -112,6 +112,7 @@ struct dwc2_hsotg_req; + * @debugfs: File entry for debugfs file for this endpoint. + * @dir_in: Set to true if this endpoint is of the IN direction, which + * means that it is sending data to the Host. ++ * @map_dir: Set to the value of dir_in when the DMA buffer is mapped. + * @index: The index for the endpoint registers. + * @mc: Multi Count - number of transactions per microframe + * @interval: Interval for periodic endpoints, in frames or microframes. +@@ -161,6 +162,7 @@ struct dwc2_hsotg_ep { + unsigned short fifo_index; + + unsigned char dir_in; ++ unsigned char map_dir; + unsigned char index; + unsigned char mc; + u16 interval; +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -380,7 +380,7 @@ static void dwc2_hsotg_unmap_dma(struct + { + struct usb_request *req = &hs_req->req; + +- usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in); ++ usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir); + } + + /* +@@ -1163,6 +1163,7 @@ static int dwc2_hsotg_map_dma(struct dwc + { + int ret; + ++ hs_ep->map_dir = hs_ep->dir_in; + ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in); + if (ret) + goto dma_error; diff --git a/queue-4.19/usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch b/queue-4.19/usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch new file mode 100644 index 00000000000..ae8a8c70508 --- /dev/null +++ b/queue-4.19/usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch @@ -0,0 +1,38 @@ +From 18ffa988dbae69cc6e9949cddd9606f6fe533894 Mon Sep 17 00:00:00 2001 +From: Wesley Cheng +Date: Fri, 7 May 2021 10:55:19 -0700 +Subject: usb: dwc3: gadget: Return success always for kick transfer in ep queue + +From: Wesley Cheng + +commit 18ffa988dbae69cc6e9949cddd9606f6fe533894 upstream. + +If an error is received when issuing a start or update transfer +command, the error handler will stop all active requests (including +the current USB request), and call dwc3_gadget_giveback() to notify +function drivers of the requests which have been stopped. Avoid +returning an error for kick transfer during EP queue, to remove +duplicate cleanup operations on the request being queued. + +Fixes: 8d99087c2db8 ("usb: dwc3: gadget: Properly handle failed kick_transfer") +cc: stable@vger.kernel.org +Signed-off-by: Wesley Cheng +Link: https://lore.kernel.org/r/1620410119-24971-1-git-send-email-wcheng@codeaurora.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/gadget.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -1413,7 +1413,9 @@ static int __dwc3_gadget_ep_queue(struct + } + } + +- return __dwc3_gadget_kick_transfer(dep); ++ __dwc3_gadget_kick_transfer(dep); ++ ++ return 0; + } + + static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, diff --git a/queue-4.19/usb-dwc3-omap-improve-extcon-initialization.patch b/queue-4.19/usb-dwc3-omap-improve-extcon-initialization.patch new file mode 100644 index 00000000000..7756f159fc8 --- /dev/null +++ b/queue-4.19/usb-dwc3-omap-improve-extcon-initialization.patch @@ -0,0 +1,44 @@ +From e17b02d4970913233d543c79c9c66e72cac05bdd Mon Sep 17 00:00:00 2001 +From: Marcel Hamer +Date: Tue, 27 Apr 2021 14:21:18 +0200 +Subject: usb: dwc3: omap: improve extcon initialization + +From: Marcel Hamer + +commit e17b02d4970913233d543c79c9c66e72cac05bdd upstream. + +When extcon is used in combination with dwc3, it is assumed that the dwc3 +registers are untouched and as such are only configured if VBUS is valid +or ID is tied to ground. + +In case VBUS is not valid or ID is floating, the registers are not +configured as such during driver initialization, causing a wrong +default state during boot. + +If the registers are not in a default state, because they are for +instance touched by a boot loader, this can cause for a kernel error. + +Signed-off-by: Marcel Hamer +Link: https://lore.kernel.org/r/20210427122118.1948340-1-marcel@solidxs.se +Cc: stable +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/dwc3-omap.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/usb/dwc3/dwc3-omap.c ++++ b/drivers/usb/dwc3/dwc3-omap.c +@@ -432,8 +432,13 @@ static int dwc3_omap_extcon_register(str + + if (extcon_get_state(edev, EXTCON_USB) == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); ++ else ++ dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF); ++ + if (extcon_get_state(edev, EXTCON_USB_HOST) == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); ++ else ++ dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT); + + omap->edev = edev; + } diff --git a/queue-4.19/usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch b/queue-4.19/usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch new file mode 100644 index 00000000000..58a2e502d7c --- /dev/null +++ b/queue-4.19/usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch @@ -0,0 +1,32 @@ +From 04357fafea9c7ed34525eb9680c760245c3bb958 Mon Sep 17 00:00:00 2001 +From: Ferry Toth +Date: Sun, 25 Apr 2021 17:09:47 +0200 +Subject: usb: dwc3: pci: Enable usb2-gadget-lpm-disable for Intel Merrifield + +From: Ferry Toth + +commit 04357fafea9c7ed34525eb9680c760245c3bb958 upstream. + +On Intel Merrifield LPM is causing host to reset port after a timeout. +By disabling LPM entirely this is prevented. + +Fixes: 066c09593454 ("usb: dwc3: pci: Enable extcon driver for Intel Merrifield") +Reviewed-by: Andy Shevchenko +Signed-off-by: Ferry Toth +Cc: stable +Link: https://lore.kernel.org/r/20210425150947.5862-1-ftoth@exalondelft.nl +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/dwc3-pci.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/dwc3/dwc3-pci.c ++++ b/drivers/usb/dwc3/dwc3-pci.c +@@ -133,6 +133,7 @@ static const struct property_entry dwc3_ + PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"), + PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), + PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), ++ PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"), + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), + {} + }; diff --git a/queue-4.19/usb-xhci-increase-timeout-for-hc-halt.patch b/queue-4.19/usb-xhci-increase-timeout-for-hc-halt.patch new file mode 100644 index 00000000000..b4275ccc85c --- /dev/null +++ b/queue-4.19/usb-xhci-increase-timeout-for-hc-halt.patch @@ -0,0 +1,38 @@ +From ca09b1bea63ab83f4cca3a2ae8bc4f597ec28851 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Wed, 12 May 2021 11:08:15 +0300 +Subject: usb: xhci: Increase timeout for HC halt + +From: Maximilian Luz + +commit ca09b1bea63ab83f4cca3a2ae8bc4f597ec28851 upstream. + +On some devices (specifically the SC8180x based Surface Pro X with +QCOM04A6) HC halt / xhci_halt() times out during boot. Manually binding +the xhci-hcd driver at some point later does not exhibit this behavior. +To work around this, double XHCI_MAX_HALT_USEC, which also resolves this +issue. + +Cc: +Signed-off-by: Maximilian Luz +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20210512080816.866037-5-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci-ext-caps.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/usb/host/xhci-ext-caps.h ++++ b/drivers/usb/host/xhci-ext-caps.h +@@ -7,8 +7,9 @@ + * Author: Sarah Sharp + * Some code borrowed from the Linux EHCI driver. + */ +-/* Up to 16 ms to halt an HC */ +-#define XHCI_MAX_HALT_USEC (16*1000) ++ ++/* HC should halt within 16 ms, but use 32 ms as some hosts take longer */ ++#define XHCI_MAX_HALT_USEC (32 * 1000) + /* HC not running - set to 1 when run/stop bit is cleared. */ + #define XHCI_STS_HALT (1<<0) +