当前位置:网站首页>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.
边栏推荐
- 数据中台“集存通用治”功能场景说明
- 滑环安装注意事项
- 测试测试测试
- 83. Remove Duplicates from Sorted List
- QT QT 】 【 to have developed a good program for packaging into a dynamic library
- C专家编程 第3章 分析C语言的声明 3.4 通过图标分析C语言的声明
- 想进阿里?先来搞懂一下分布式事务
- Component communication - parent-child component communication
- 关于oracle表空间在线碎片整理
- MATLAB | 一种简易的随机曼陀罗图形生成函数
猜你喜欢

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

滑环安装注意事项

protobuf 反射使用总结

Component communication - parent-child component communication

罗克韦尔AB PLC RSLogix5000中创建新项目、任务、程序和例程的具体方法和步骤

使用Stream多年,collect还有这些“骚操作”?

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

可复现、开放科研、跨学科合作:数据驱动下的科研趋势及应用方案
![[Unity Getting Started Plan] Basic Concepts (6) - Sprite Renderer Sprite Renderer](/img/c2/5717cb053bc6c07829a616735cbc71.png)
[Unity Getting Started Plan] Basic Concepts (6) - Sprite Renderer Sprite Renderer

面了个腾讯35k出来的,他让我见识到什么叫精通MySQL调优
随机推荐
Looking at the ecological potential of Hongmeng OS from the evolution of MatePad Pro
[Unity Getting Started Plan] Basic Concepts (7) - Input Manager & Input Class
Some optional strategies and usage scenarios for PWA application Service Worker caching
Kubernetes 笔记 / 任务 / 管理集群 / 用 kubeadm 管理集群 / 配置一个 cgroup 驱动
C专家编程 第2章 这不是Bug,而是语言特性 2.1 这关语言特性何事,在Fortran里这就是Bug呀
实时渲染流程操作复杂吗,如何实现?
建造者模式/生成器模式
B站回应HR称核心用户是Loser;微博回应宕机原因;Go 1.19 正式发布|极客头条
带你了解什么是 Web3.0
C专家编程 第3章 分析C语言的声明 3.3 优先级规则
新版本 MaxCompute 的SQL 中支持的 EXTRACT 函数有什么作用?
C专家编程 第2章 这不是Bug,而是语言特性 2.2 多做之过
甲方不让用开源【监控软件】?大不了我自己写一个
纯纯粹粹纯纯粹粹
vector类
C专家编程 第3章 分析C语言的声明 3.1 只有编译器才会喜欢的语法
smp,numa和mpp体系结构总结
Auto Scaling 弹性伸缩(运维释放人力)
C专家编程 第2章 这不是Bug,而是语言特性 2.3 误做之过
Cookie和Session的关系