当前位置:网站首页>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.
边栏推荐
- C专家编程 第2章 这不是Bug,而是语言特性 2.3 误做之过
- [redis] cache penetration and cache avalanche and cache breakdown solutions
- MySQL窗口函数 PARTITION BY()函数介绍
- Some optional strategies and usage scenarios for PWA application Service Worker caching
- 【翻译】关于扩容一个百万级别用户系统的六个课程
- C专家编程 第3章 分析C语言的声明 3.2 声明是如何形成的
- 如何设计大电流九线导电滑环
- leetcode:187. 重复的DNA序列
- Detailed ReentrantLock
- 请问下这个hologres维表是被缓存了么?怎么直接Finished了
猜你喜欢

leetcode:187. 重复的DNA序列

node连接mongoose数据库流程

从零开始搭建MySQL主从复制架构

MySQL相关介绍
![STM32 GPIO LED and buzzer implementation [Day 4]](/img/13/dbfed5a207e97ba0b78c1f63712e16.png)
STM32 GPIO LED and buzzer implementation [Day 4]

#夏日挑战赛# HarmonyOS 实现一个绘画板
![[Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 02](/img/45/96af4ca21329964808a4c8f2b8272c.png)
[Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 02
![[Deep Learning] Today's bug (August 2)](/img/c5/c4c6d97276bd9997c49ed886aa24cf.png)
[Deep Learning] Today's bug (August 2)

C专家编程 第1章 C:穿越时空的迷雾 1.9 阅读ANSI C标准,寻找乐趣和裨益

可复现、开放科研、跨学科合作:数据驱动下的科研趋势及应用方案
随机推荐
QT QT 】 【 to have developed a good program for packaging into a dynamic library
To add digital wings to education, NetEase Yunxin released the overall solution of "Internet + Education"
中小微企业如何简单便捷、低成本实现数字化?360视觉云有妙招
#夏日挑战赛#【FFH】OpenHarmony设备开发基础(四)启动流程
WordPress 5.2.3 更新,升级出现请求超时的解决方法
详谈RDMA技术原理和三种实现方式
Cookie和Session的关系
C专家编程 第2章 这不是Bug,而是语言特性 2.2 多做之过
SQL中对 datetime 类型操作
socket快速理解
DAYU200 OpenHarmony标准系统HDMI全屏显示
C专家编程 第3章 分析C语言的声明 3.7 typedef struct foo{... foo;}的含义
使用uniapp 封装一个request 请求
【There is no tracking information for the current branch. Please specify which branch you want to 】
Yuan xiaolin: Volvo focus on travel security, and put it perfectly
关于oracle表空间在线碎片整理
【系统学习编程-编程入门-全民编程 视频教程】
黄致绮 荣获第六季完美童模全球总决赛 全国总冠军
SwinIR实战:如何使用SwinIR和预训练模型实现图片的超分
uniapp的webview滑动缩放