Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\dma\direct.c Create Date:2022-07-28 10:33:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__dma_direct_alloc_pages

Proto:struct page *__dma_direct_alloc_pages(struct device *dev, size_t size, gfp_t gfp, unsigned long attrs)

Type:struct page

Parameter:

TypeParameterName
struct device *dev
size_tsize
gfp_tgfp
unsigned longattrs
93  alloc_size = align the pointer to the (next) page boundary (size)
94  node = dev_to_node(dev)
95  struct page * page = NULL
98  If attrs & DMA_ATTR_NO_WARN: This tells the DMA-mapping subsystem to suppress* allocation failure reports (similarly to __GFP_NOWARN). Then gfp |= DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.
102  gfp &= ~__GFP_ZERO
103  gfp |= __dma_direct_optimal_gfp_mask(dev, Like dma_mask, but for alloc_coherent mappings as not all hardware supports 64 bit addresses for consistent allocations such descriptors. , & phys_limit)
105  page = Use fallback alloc() and free() when CONFIG_DMA_CMA=n
106  If page && Not dma_coherent_ok(dev, Change "struct page" to physical address.(page), size) Then
107  dma_free_contiguous(dev, page, alloc_size)
108  page = NULL
110  again :
111  If Not page Then page = Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE,* prefer the current CPU's closest node. Otherwise node must be valid and* online.
113  If page && Not dma_coherent_ok(dev, Change "struct page" to physical address.(page), size) Then
114  dma_free_contiguous(dev, page, size)
115  page = NULL
120  gfp |= GFP_DMA32
121  Go to again
125  gfp = gfp & ~GFP_DMA32 | GFP_DMA
126  Go to again
130  Return page
Caller
NameDescribe
dma_direct_alloc_pages