当前位置:网站首页>Detailed explanation of setting HiSilicon MMZ memory and OS memory
Detailed explanation of setting HiSilicon MMZ memory and OS memory
2022-08-03 16:41:00 【snail taking off】
1、前言
(1)本文是基于hi3516dv300芯片的ubootExplain with the kernel;
(2)dv300The chip is actually connected to the board2G内存,dv300The actual maximum chip only supports2G内存;
2、hi3516dv300The memory address range of the chip
(1)By consulting the data sheet《Hi3516DV300 专业型 Smart IP Camera SoC 用户指南》,dv300The memory address range of the chip is0x8000_0000-0xFFFF_FFFF,最大能支持2G内存;
(2)HiSilicon chips divide memory intommz内存和os内存,最终linuxThe memory that the system can manage is less than the actual memory size,Because part of the memory needs to be allocated asmmz;
3、Memory management of HiSilicon chips
(1)in the HiSilicon chip,将内存划分为OS内存和MMZ内存,板子上的2Gpart of memoryOS内存,一部分做MMZ内存;
(2)OS内存:就是分配给linux内核管理的内存,Allocated for use by the kernel and applications;
(3)MMZ(Media Memory Zone,multimedia memory area):Unique to HiSilicon,Because the HiSilicon chip is a chip specially used for audio and video encoding and decoding,requires a lot of memory,In order to the speed of the codec,The bottom layer of the HiSilicon driver will manage a part of the memory,Specially used for audio and video codec;
总结:Divide the actual physical memory into two parts——OS内存和MMZ内存,Two parts of memory management is independent of each other;
4、分配OS内存和MMZprinciples of memory
(1)分配的OS内存和MMZThe total size of the combined memory cannot exceed the size of the actual physical memory;
(2)OS内存和MMZThe memory addresses of the memory cannot overlap with each other,Otherwise there will be a memory stampede;
(3)The total physical memory size remains unchanged,OS内存和MMZAllocation between memory is trade-off,The share allocated between the two needs to be balanced,以达到最优性能;
5、设置MMZ内存
5.1、加载hi_osal.ko驱动
mmz_buf0_start=0xD8000000;
mmz_buf0_size=60M;
mmz_start=0xDBC00000; # mmz start addr
mmz_size=579M; # 579M, mmz size
insmod hi_osal.ko anony=1 mmz_allocator=hisi mmz=anonymous,0,$mmz_start,$mmz_size:buf0,0,$mmz_buf0_start,$mmz_buf0_size || report_error
mmz=anonymous | 第一块MMZThe name of the memory isanonymous |
$mmz_start | 起始地址是0xDBC00000 |
$mmz_size | 内存大小是579M |
buf0 | 第一块MMZThe name of the memory isbuf0 |
$mmz_buf0_start | 起始地址是0xD8000000 |
$mmz_buf0_size | 内存大小是60M |
(1)在海思提供的SDKThere will be a script to load the driver in the package,比如dv300The loading script for the chip isload3516dv300,The above is the loading of the excerpthi_osal.ko的脚本;
(2)加载hi_osal.ko时传入MMZThe start address and size of memory,The driver supports incoming multiple blocksMMZ内存地址;
5.2、查看MMZ内存:/proc/media-mem
~ # cat /proc/media-mem
+---ZONE: PHYS(0xD8000000, 0xDBBFFFFF), GFP=0, nBYTES=61440KB, NAME="buf0"
+---ZONE: PHYS(0xDBC00000, 0xFFEFFFFF), GFP=0, nBYTES=592896KB, NAME="anonymous"
|-MMB: phys(0xDBC00000, 0xDBC07FFF), kvirt=0xF0DE8000, flags=0x00000001, length=32KB, name="sys_scale_coef"
|-MMB: phys(0xDBC08000, 0xDBC27FFF), kvirt=0x00000000, flags=0x00000000, length=128KB, name="TDE_MEMPOOL_MMB"
|-MMB: phys(0xDBC28000, 0xDBC43FFF), kvirt=0xF0FE0000, flags=0x00000001, length=112KB, name="gdc_node_buf"
|-MMB: phys(0xDBC44000, 0xDBC44FFF), kvirt=0xF0C95000, flags=0x00000001, length=4KB, name="GDC int_pole_co"
|-MMB: phys(0xDBC45000, 0xDBCBFFFF), kvirt=0xF1100000, flags=0x00000001, length=492KB, name="VGS_NodeBuf"
|-MMB: phys(0xDBCC0000, 0xDBCC0FFF), kvirt=0xF0CD9000, flags=0x00000001, length=4KB, name="dis_node_buf"
|-MMB: phys(0xDBCC1000, 0xDC0C0FFF), kvirt=0x00000000, flags=0x00000000, length=4096KB, name="hifb_layer0"
|-MMB: phys(0xDC0C1000, 0xDC0D0FFF), kvirt=0xF14D0000, flags=0x00000001, length=64KB, name="HIFB COEF"
|-MMB: phys(0xDC0D1000, 0xDC105FFF), kvirt=0xF1C80000, flags=0x00000001, length=212KB, name="IVE_QUEUE"
|-MMB: phys(0xDC106000, 0xDC106FFF), kvirt=0xF0EDD000, flags=0x00000003, length=4KB, name="IVE_TEMP_NODE"
|-MMB: phys(0xDC107000, 0xDC116FFF), kvirt=0xF1CE0000, flags=0x00000001, length=64KB, name="SVP_NNIE_QUEUE"
|-MMB: phys(0xDC117000, 0xDC11AFFF), kvirt=0xF12F8000, flags=0x00000003, length=16KB, name="SVP_NNIE_MODLE_"
---MMZ_USE_INFO:
total size=654336KB(639MB),used=5228KB(5MB + 108KB),remain=649108KB(633MB + 916KB),zone_number=2,block_number=12
(1)从上面可知,MMZThere are two pieces of memory:名字是buf0,大小是61440KB;名字是anonymous,大小是592896KB;
(2)Just loading with ushi_osal.ko时指定的MMZMemory parameters match;
6、设置OS内存
6.1、设置bootargs
~ # cat /proc/cmdline
mem=1408M console=ttyS0,115200 root=/dev/mmcblk0p7 rootfstype=squashfs rootwait
(1)从bootargs中可以得知,OS内存分配了1408M,The starting address is not specified here,Analysis of the kernel source code,The memory start address is0x80000000;
(2)具体bootargsHow the memory specified in takes effect,参考博客:《linux内存管理——内存大小、Analysis and modification of the starting address》;
6.2、查看OS内存:free
~ # free
total used free shared buffers
Mem: 1419980 132636 1287344 448 23808
-/+ buffers: 108828 1311152
Swap: 0 0 0
7、Memory management figure
-----|----------------| 0x80000000 # Memory managed by OS.
1408M| |
| OS |
-----|----------------| 0xD8000000 #Memory managed by MMZ block buf0.
60M | |
| MMZ:buf0 |
-----|----------------| 0xDBC00000 # Memory managed by MMZ block anonymous.
579M | MMZ:anonymous |
| |
-----|----------------| 0xFFF00000 # End of memory managed by MMZ.
边栏推荐
猜你喜欢
leetcode:189. 轮转数组
设置海思芯片MMZ内存、OS内存详解
Auto Scaling 弹性伸缩(运维释放人力)
自动化部署+整合SSM项目
最强分布式锁工具:Redisson
世界顶级级架构师编写2580页DDD领域驱动设计笔记,属实有牌面
【带你了解SDN和网络虚拟化】
高效的组织信息共享知识库是一种宝贵的资源
C专家编程 第1章 C:穿越时空的迷雾 1.10 “安静的改变”究竟有多少安静
Understand the recommendation system in one article: Outline 02: The link of the recommendation system, from recalling rough sorting, to fine sorting, to rearranging, and finally showing the recommend
随机推荐
13 and OOM simulation
Big guys.Use flink-cdc-sqlserver version 2.2.0 to read sqlserver2008R
高效的组织信息共享知识库是一种宝贵的资源
C语言03、数组
MySQL窗口函数
deepstresam的插件配置说明,通过配置osd,设置字体的背景为透明
TiKV & TiFlash 加速复杂业务查询丨TiFlash 应用实践
Why do I strongly recommend using smart async?
C专家编程 第3章 分析C语言的声明 3.3 优先级规则
83. Remove Duplicates from Sorted List
组件通信--下拉菜单案例
leetcode:202. 快乐数
Components of communication - the drop-down menu
Kubernetes 笔记 / 目录
leetcode-693.交替位二进制数
我写了个”不贪吃蛇“小游戏
yolov5s用自己的数据集进行训练模型
socket快速理解
smp,numa和mpp体系结构总结
Huawei, Lenovo, BAIC, etc. were selected as the first batch of training bases for "Enterprise Digital Transformation and Security Capability Improvement" by the Ministry of Industry and Information Te