Skip to content

Commit 006d582

Browse files
Sarah Sharpgregkh
authored andcommitted
USB: xhci: Set DMA mask for host.
Tell the USB core that we can do DMA directly (instead of needing it to memory-map the buffers for PIO). If the xHCI host supports 64-bit addresses, set the DMA mask accordingly. Otherwise indicate the host can handle 32-bit DMA addresses. This improves performance because the USB core doesn't have to spend time remapping buffers in high memory into the 32-bit address range. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent ed3f245 commit 006d582

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/usb/host/xhci-pci.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
5353
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
5454
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
5555
int retval;
56+
u32 temp;
5657

5758
hcd->self.sg_tablesize = TRBS_PER_SEGMENT - 2;
5859

@@ -93,6 +94,14 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
9394
return retval;
9495
xhci_dbg(xhci, "Reset complete\n");
9596

97+
temp = xhci_readl(xhci, &xhci->cap_regs->hcc_params);
98+
if (HCC_64BIT_ADDR(temp)) {
99+
xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
100+
dma_set_mask(hcd->self.controller, DMA_BIT_MASK(64));
101+
} else {
102+
dma_set_mask(hcd->self.controller, DMA_BIT_MASK(32));
103+
}
104+
96105
xhci_dbg(xhci, "Calling HCD init\n");
97106
/* Initialize HCD and host controller data structures. */
98107
retval = xhci_init(hcd);

0 commit comments

Comments
 (0)