Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\cma.c Create Date:2022-07-28 16:31:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:ma_init_reserved_mem() - create custom contiguous area from reserved memory*@base: Base address of the reserved area*@size: Size of the reserved area (in bytes),*@order_per_bit: Order of pages represented by one bit on bitmap.*@name: The name of the area

Proto:int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, unsigned int order_per_bit, const char *name, struct cma **res_cma)

Type:int

Parameter:

TypeParameterName
phys_addr_tbase
phys_addr_tsize
unsigned intorder_per_bit
const char *name
struct cma **res_cma
181  If cma_area_count == ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(cma_areas) Then
182  pr_err("Not enough slots for CMA reserved regions!\n")
183  Return -ENOSPC
186  If Not size || Not memblock_is_region_reserved(base, size) Then Return -EINVAL
190  alignment = PAGE_SIZE << max_t - return maximum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedlong, Free memory management - zoned buddy allocator. - 1, Huge pages are a constant size )
194  If Not IS_ALIGNED(alignment >> PAGE_SHIFT determines the page size , 1 << order_per_bit) Then Return -EINVAL
197  If @a is a power of 2 value (base, alignment) != base || @a is a power of 2 value (size, alignment) != size Then Return -EINVAL
204  cma = cma_areas[cma_area_count]
205  If name Then
206  name = name
207  Else
208  name = kasprintf(GFP_KERNEL, "cma%d\n", cma_area_count)
209  If Not name Then Return -ENOMEM
212  base_pfn = PFN_DOWN(base)
213  count = size >> PAGE_SHIFT determines the page size
214  Order of pages represented by one bit = order_per_bit
215  res_cma = cma
216  cma_area_count++
217  totalcma_pages += size / PAGE_SIZE
219  Return 0
Caller
NameDescribe
cma_declare_contiguousma_declare_contiguous() - reserve custom contiguous area*@base: Base address of the reserved area optional, use 0 for any*@size: Size of the reserved area (in bytes),*@limit: End address of the reserved memory (optional, 0 for any)