当前位置:网站首页>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.
边栏推荐
- 自动化部署+整合SSM项目
- 怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
- 华为、联想、北汽等入选工信部“企业数字化转型和安全能力提升”首批实训基地
- 纯纯粹粹纯纯粹粹
- 中小微企业如何简单便捷、低成本实现数字化?360视觉云有妙招
- Kubernetes 笔记 / 入门 / 生产环境 / 用部署工具安装 Kubernetes / 用 kubeadm 启动集群 / 安装 kubeadm
- 产品-Axure9英文版,轮播图效果
- [Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement
- MySQL相关介绍
- TiKV & TiFlash accelerate complex business queries丨TiFlash application practice
猜你喜欢

TiKV & TiFlash accelerate complex business queries丨TiFlash application practice

MATLAB | 一种简易的随机曼陀罗图形生成函数

Analysis of ffplay video playback principle

FinClip | 2022 年 7 月产品大事记

面试突击71:GET 和 POST 有什么区别?

自动化部署+整合SSM项目

虹科分享 | 如何测试与验证复杂的FPGA设计(3)——硬件测试

使用deepstream消息发送功能的时候,检测框没有检测标签,No text labels of bboxes displayed with osd for deepstream-test5

Small Tools (4) integrated Seata1.5.2 distributed transactions

C专家编程 第1章 C:穿越时空的迷雾 1.9 阅读ANSI C标准,寻找乐趣和裨益
随机推荐
leetcode-693.交替位二进制数
ArkUI如何适配横竖屏
Web3 安全风险令人生畏?应该如何应对?
C专家编程 第3章 分析C语言的声明 3.8 理解所有分析过程的代码段
MobileVIT实战:使用MobileVIT实现图像分类
最强分布式锁工具:Redisson
[Unity Getting Started Plan] Basic Concepts (8) - Tile Map TileMap 01
C专家编程 第3章 分析C语言的声明 3.4 通过图标分析C语言的声明
WordPress建站技术笔记
SQL中对 datetime 类型操作
Selective Search学习笔记
视频人脸识别和图片人脸识别的关系
简易网络传输方法
MySQL窗口函数 PARTITION BY()函数介绍
从MatePad Pro进化看鸿蒙OS的生态势能
TCP 可靠吗?为什么?
【系统学习编程-编程入门-全民编程 视频教程】
新版本 MaxCompute 的SQL 中支持的 EXTRACT 函数有什么作用?
正向代理与反向代理
怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?