From: Greg Kroah-Hartman Date: Wed, 20 Oct 2021 12:40:09 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.4.290~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=192c717798de706efacbde2629b8cc5bca01a1da;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: io_uring-fix-splice_fd_in-checks-backport-typo.patch xhci-add-quirk-for-host-controllers-that-don-t-update-endpoint-dcs.patch --- diff --git a/queue-5.10/io_uring-fix-splice_fd_in-checks-backport-typo.patch b/queue-5.10/io_uring-fix-splice_fd_in-checks-backport-typo.patch new file mode 100644 index 00000000000..c723679785d --- /dev/null +++ b/queue-5.10/io_uring-fix-splice_fd_in-checks-backport-typo.patch @@ -0,0 +1,34 @@ +From kamal@canonical.com Wed Oct 20 14:38:25 2021 +From: Kamal Mostafa +Date: Mon, 18 Oct 2021 10:18:08 -0700 +Subject: io_uring: fix splice_fd_in checks backport typo +To: Greg Kroah-Hartman +Cc: Kamal Mostafa , stable@vger.kernel.org, Alexander Viro , Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org +Message-ID: <20211018171808.18383-1-kamal@canonical.com> + +From: Kamal Mostafa + +The linux-5.10.y backport of commit "io_uring: add ->splice_fd_in checks" +includes a typo: "|" where "||" should be. (The original upstream commit +is fine.) + +Fixes: 54eb6211b979 ("io_uring: add ->splice_fd_in checks") +Cc: Greg Kroah-Hartman +Cc: stable@vger.kernel.org # v5.10 +Signed-off-by: Kamal Mostafa +Signed-off-by: Greg Kroah-Hartman +--- + fs/io_uring.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -5559,7 +5559,7 @@ static int io_timeout_remove_prep(struct + return -EINVAL; + if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) + return -EINVAL; +- if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags | ++ if (sqe->ioprio || sqe->buf_index || sqe->len || sqe->timeout_flags || + sqe->splice_fd_in) + return -EINVAL; + diff --git a/queue-5.10/series b/queue-5.10/series index 256897b0c38..f7adb9d5a68 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1 +1,3 @@ parisc-math-emu-fix-fall-through-warnings.patch +xhci-add-quirk-for-host-controllers-that-don-t-update-endpoint-dcs.patch +io_uring-fix-splice_fd_in-checks-backport-typo.patch diff --git a/queue-5.10/xhci-add-quirk-for-host-controllers-that-don-t-update-endpoint-dcs.patch b/queue-5.10/xhci-add-quirk-for-host-controllers-that-don-t-update-endpoint-dcs.patch new file mode 100644 index 00000000000..d50bfbb0d73 --- /dev/null +++ b/queue-5.10/xhci-add-quirk-for-host-controllers-that-don-t-update-endpoint-dcs.patch @@ -0,0 +1,103 @@ +From 5255660b208aebfdb71d574f3952cf48392f4306 Mon Sep 17 00:00:00 2001 +From: Jonathan Bell +Date: Fri, 8 Oct 2021 12:25:44 +0300 +Subject: xhci: add quirk for host controllers that don't update endpoint DCS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jonathan Bell + +commit 5255660b208aebfdb71d574f3952cf48392f4306 upstream. + +Seen on a VLI VL805 PCIe to USB controller. For non-stream endpoints +at least, if the xHC halts on a particular TRB due to an error then +the DCS field in the Out Endpoint Context maintained by the hardware +is not updated with the current cycle state. + +Using the quirk XHCI_EP_CTX_BROKEN_DCS and instead fetch the DCS bit +from the TRB that the xHC stopped on. + +[ bjorn: rebased to v5.14-rc2 ] + +Link: https://github.com/raspberrypi/linux/issues/3060 +Cc: stable@vger.kernel.org +Signed-off-by: Jonathan Bell +Signed-off-by: Bjørn Mork +Signed-off-by: Mathias Nyman +Link: https://lore.kernel.org/r/20211008092547.3996295-3-mathias.nyman@linux.intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci-pci.c | 4 +++- + drivers/usb/host/xhci-ring.c | 26 +++++++++++++++++++++++++- + drivers/usb/host/xhci.h | 1 + + 3 files changed, 29 insertions(+), 2 deletions(-) + +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -276,8 +276,10 @@ static void xhci_pci_quirks(struct devic + pdev->device == 0x3432) + xhci->quirks |= XHCI_BROKEN_STREAMS; + +- if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) ++ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { + xhci->quirks |= XHCI_LPM_SUPPORT; ++ xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; ++ } + + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -562,7 +562,10 @@ void xhci_find_new_dequeue_state(struct + struct xhci_virt_ep *ep = &dev->eps[ep_index]; + struct xhci_ring *ep_ring; + struct xhci_segment *new_seg; ++ struct xhci_segment *halted_seg = NULL; + union xhci_trb *new_deq; ++ union xhci_trb *halted_trb; ++ int index = 0; + dma_addr_t addr; + u64 hw_dequeue; + bool cycle_found = false; +@@ -600,7 +603,28 @@ void xhci_find_new_dequeue_state(struct + hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); + new_seg = ep_ring->deq_seg; + new_deq = ep_ring->dequeue; +- state->new_cycle_state = hw_dequeue & 0x1; ++ ++ /* ++ * Quirk: xHC write-back of the DCS field in the hardware dequeue ++ * pointer is wrong - use the cycle state of the TRB pointed to by ++ * the dequeue pointer. ++ */ ++ if (xhci->quirks & XHCI_EP_CTX_BROKEN_DCS && ++ !(ep->ep_state & EP_HAS_STREAMS)) ++ halted_seg = trb_in_td(xhci, cur_td->start_seg, ++ cur_td->first_trb, cur_td->last_trb, ++ hw_dequeue & ~0xf, false); ++ if (halted_seg) { ++ index = ((dma_addr_t)(hw_dequeue & ~0xf) - halted_seg->dma) / ++ sizeof(*halted_trb); ++ halted_trb = &halted_seg->trbs[index]; ++ state->new_cycle_state = halted_trb->generic.field[3] & 0x1; ++ xhci_dbg(xhci, "Endpoint DCS = %d TRB index = %d cycle = %d\n", ++ (u8)(hw_dequeue & 0x1), index, ++ state->new_cycle_state); ++ } else { ++ state->new_cycle_state = hw_dequeue & 0x1; ++ } + state->stream_id = stream_id; + + /* +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -1884,6 +1884,7 @@ struct xhci_hcd { + #define XHCI_DISABLE_SPARSE BIT_ULL(38) + #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) + #define XHCI_NO_SOFT_RETRY BIT_ULL(40) ++#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) + + unsigned int num_active_eps; + unsigned int limit_active_eps;