339x Filetype PPTX File size 0.63 MB Source: community.nxp.com
Kernel virtual memory layout
MODULES_VADDR (VA_START) KIMAGE_VADDR + TEXT_OFFSET
VMEMMAP_START __phys_to_virt(memblock_start_of_DRAM())
2 CONFIDENTIAL AND PROPRIETARY
Kernel variable and configure
• VA_BITS = 48
• VA_START = 0xffff000000000000
• PAGE_OFFSET = 0xffff800000000000
• PHYS_OFFSET = 0x80000000 // i.MX8QM/QXP
• memblock_start_of_DRAM() = 0x80200000 // passed in by u-boot (get from scfw)
• KIMAGE_VADDR = MODULE_END = 0xffff000008000000
• TEXT_OFFSET = 0x80000
• #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) |
PAGE_OFFSET)
• #define __phys_to_kimg(x) ((unsigned long)((x) + kimage_voffset))
3 CONFIDENTIAL AND PROPRIETARY
DDR Memory layout
• Memblock on boot 0x8BFFF_FFF
>4G DDR F
−configurations is passed by u-boot, who get usable 0x88000_000
0
memory from SCFW API sc_rm_get_memreg_info() 0xFFFF_FFFF
BL32 (TEE)
0xFE00_0000
−On i.MX8Q, there’s 5 memblocks, the hole is used by
ATF/M4_0/1/TEE/SHM.. (BLUE) 0xDFFF_FFFF
−On Android Auto Car2, No M4 used, on boot memory CMA 0xC600_000
0
DDR blocks get from uboot: SWIOTLB 0xC5FF_F000
0xBFFF_F000
memblock_add: [0x0000000080200000-0x00000000fdffffff]
memblock_add: [0x0000000880000000-0x00000008bfffffff] 0x9440_0000
DSP 0x9240_0000
• Kernel after boot (below settings) RPMSG 0x9200_0000
M4 0x9000_0000
• CMA = 400MB (RED) 0x8640_0000
VPU 0x8400_0000
• SWIOTLB = 96MB (RED)
0x8020_0000
• reserved-memory {} in dts (BLACK) BL31 (ATF)
0x8000_0000
4 CONFIDENTIAL AND PROPRIETARY
Kernel memory allocation
• kmalloc – for small chunks allocation,
go through SLxB. Directly call
kmalloc vmalloc DMA API alloc_pages for large continue size
ION • vmalloc – for virtual continuous
2
x
E memory allocation, physical is not
Z
I SLUB
S Driver required to be continuous (place in
_ (SLAB/SLOB CMA
E Specific
G virtual vmalloc range)
A )
P
>
• CMA – described in next page
e
z
i
S • Reserved memory (in dts, reserved
Page
Page
allocators by memblock_alloc on boot)
allocators
managed by drivers for specific
DDR usage (like GPU)
Buddy Reserved • ION – Android specific allocator,
used for video/camera buffers
5 CONFIDENTIAL AND PROPRIETARY
Continuous Memory Allocator (CMA)
• Target: Allocating big chunks of physically contiguous memory
• CMA is integrated with the DMA API
memblock DMA API
Gi
• How it works ve se
m u
−At the boot time, cma= of the memory is reserved. e ay
mo M e
T r s
−When page allocator initializes, cma range is released with ak y U
MIGRATE_CMA type e m Page
pages can be used for movable pages. (normal usage, e.g. Examples em allocator
anonymous process pages and disk cache) or I
y G n
f i t
r v e
Unless the memory is allocated to a device driver. (CMA alloc) om e g
r
b a
−Migration a t
c e
allocating a new page k d
copying contents of the old page to the new page
CMA
updating all places where old page was referred, and freeing the old
page.
6 CONFIDENTIAL AND PROPRIETARY
no reviews yet
Please Login to review.