函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\dma\direct.c Create Date:2022-07-27 11:33:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:dma_direct_alloc_pages

函数原型:void *dma_direct_alloc_pages(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)

返回类型:void

参数:

类型参数名称
struct device *dev
size_tsize
dma_addr_t *dma_handle
gfp_tgfp
unsigned longattrs
139  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_DMA_DIRECT_REMAP)且Check if an allocation needs to be marked uncached to be coherent.且非gfpflags_allow_blocking(gfp)则
142  ret等于dma_alloc_from_pool( align the pointer to the (next) page boundary (size), & page, gfp)
143  如果非ret则返回:NULL
145  转到:done
148  page等于__dma_direct_alloc_pages(dev, size, gfp, attrs)
149  如果非page则返回:NULL
152  如果attrs按位与DMA_ATTR_NO_KERNEL_MAPPING: Lets the platform to avoid creating a kernel* virtual mapping for the allocated buffer.且非force_dma_unencrypted(dev)则
155  如果非PageHighMem(page)则arch_dma_prep_coherent(page, size)
158  ret等于page
159  转到:done
162  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_DMA_DIRECT_REMAP)且Check if an allocation needs to be marked uncached to be coherent.IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_DMA_REMAP)且PageHighMem(page)则
166  arch_dma_prep_coherent(page, align the pointer to the (next) page boundary (size))
169  ret等于dma_common_contiguous_remap(page, align the pointer to the (next) page boundary (size), Return the page attributes used for mapping dma_alloc_* memory, either in* kernel space if remapping is needed, or to userspace through dma_mmap_*., __builtin_return_address(0))
172  如果非ret
174  返回:ret
177  memset(ret, 0, size)
178  转到:done
181  如果PageHighMem(page)则
188  dev_info(dev, "Rejecting highmem page from CMA.\n")
189  dma_free_contiguous(dev, page, size)
190  返回:NULL
193  ret等于page_address(page)
194  如果force_dma_unencrypted(dev)则set_memory_decrypted((unsignedlong)ret, 1 << get_order - Determine the allocation order of a memory size*@size: The size for which to get the order* Determine the allocation order of a particular sized block of memory)
197  memset(ret, 0, size)
199  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_ARCH_HAS_UNCACHED_SEGMENT)且Check if an allocation needs to be marked uncached to be coherent.
201  arch_dma_prep_coherent(page, size)
202  ret等于uncached_kernel_address(ret)
204  done :
205  如果force_dma_unencrypted(dev)则dma_handle等于__phys_to_dma(dev, Change "struct page" to physical address.(page))
207  否则dma_handle等于If memory encryption is supported, phys_to_dma will set the memory encryption* bit in the DMA address, and dma_to_phys will clear it. The raw __phys_to_dma* and __dma_to_phys versions should only be used on non-encrypted memory for
209  返回:ret
调用者
名称描述
dma_direct_alloc
gart_alloc_coherentallocate and map a coherent mapping