1USB_ALLOC_COHERENT(9)            USB Core APIs           USB_ALLOC_COHERENT(9)
2
3
4

NAME

6       usb_alloc_coherent - allocate dma-consistent buffer for
7       URB_NO_xxx_DMA_MAP
8

SYNOPSIS

10       void * usb_alloc_coherent(struct usb_device * dev, size_t size,
11                                 gfp_t mem_flags, dma_addr_t * dma);
12

ARGUMENTS

14       dev
15           device the buffer will be used with
16
17       size
18           requested buffer size
19
20       mem_flags
21           affect whether allocation may block
22
23       dma
24           used to return DMA address of buffer
25

RETURN

27       Either null (indicating no buffer could be allocated), or the cpu-space
28       pointer to a buffer that may be used to perform DMA to the specified
29       device. Such cpu-space buffers are returned along with the DMA address
30       (through the pointer provided).
31

NOTE

33       These buffers are used with URB_NO_xxx_DMA_MAP set in
34       urb->transfer_flags to avoid behaviors like using “DMA bounce buffers”,
35       or thrashing IOMMU hardware during URB completion/resubmit. The
36       implementation varies between platforms, depending on details of how
37       DMA will work to this device. Using these buffers also eliminates
38       cacheline sharing problems on architectures where CPU caches are not
39       DMA-coherent. On systems without bus-snooping caches, these buffers are
40       uncached.
41
42       When the buffer is no longer used, free it with usb_free_coherent.
43
45Kernel Hackers Manual 3.10         June 2019             USB_ALLOC_COHERENT(9)
Impressum