Skip to content

Commit 41a4301

Browse files
Wesley Chenggregkh
authored andcommitted
usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
As mentioned in: commit 474ed23 ("xhci: align the last trb before link if it is easily splittable.") A bounce buffer is utilized for ensuring that transfers that span across ring segments are aligned to the EP's max packet size. However, the device that is used to map the DMA buffer to is currently using the XHCI HCD, which does not carry any DMA operations in certain configrations. Migration to using the sysdev entry was introduced for DWC3 based implementations where the IOMMU operations are present. Replace the reference to the controller device to sysdev instead. This allows the bounce buffer to be properly mapped to any implementations that have an IOMMU involved. cc: stable@vger.kernel.org Fixes: 4c39d4b ("usb: xhci: use bus->sysdev for DMA configuration") Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20230915143108.1532163-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a00e197 commit 41a4301

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
798798
static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci,
799799
struct xhci_ring *ring, struct xhci_td *td)
800800
{
801-
struct device *dev = xhci_to_hcd(xhci)->self.controller;
801+
struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
802802
struct xhci_segment *seg = td->bounce_seg;
803803
struct urb *urb = td->urb;
804804
size_t len;
@@ -3469,7 +3469,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
34693469
static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
34703470
u32 *trb_buff_len, struct xhci_segment *seg)
34713471
{
3472-
struct device *dev = xhci_to_hcd(xhci)->self.controller;
3472+
struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
34733473
unsigned int unalign;
34743474
unsigned int max_pkt;
34753475
u32 new_buff_len;

0 commit comments

Comments
 (0)