[architecture]-ARM SMMU学习概念总结一篇就够了
引流關鍵詞: SMMU,mmu500,mmu600,mmu700,system mmu,Non-cacheable,Cacheable, non-shareable,inner-shareable,outer-shareable, optee、ATF、TF-A、Trustzone、optee3.14、MMU、VMSA、cache、TLB、arm、armv8、armv9、TEE、安全、內存管理、頁表…
目錄
- 前言
- 1、SMMU總結
- 1.1、SMMU的timeline
- 1.2、SMMU的簡介
- 1.3、為什么要使用SMMU?
- 2、MMU IP總結
- 2.1、CoreLink MMU-700 features
- 2.12、CoreLink MMU-600AE features
- 2.3、CoreLink MMU-600 features
- 2.4、CoreLink MMU-500 Features
- 2.5、CoreLink MMU-401 Features
- 3、總結
- 4、參考
前言
最近朋友圈、微信群(ARM-Trustzone-TEE-AT)掀起一陣學習SMMU的熱潮,作為一名安全領域的渣渣 ,勢必要蹭一蹭這個“熱點”,也學習一下吧,反正早晚都要學,因為它和安全的關系還是比較大的。學習是一件長期的過程,本文就先簡單理一下概念吧。
1、SMMU總結
1.1、SMMU的timeline
1.2、SMMU的簡介
SMMU的全稱是System Memory Management Units, 它屬于Arm的System IP, 主要給其他Master來使用,其連頁表格式和Core MMU是一樣的,理論上可以讓Core的MMU和SMMU使用同一套頁表.
那么SMMU都是用在哪些地方呢?*以下展示了一個usecase,來自arm官方博客(February 17, 2014),也是比較早期的一個Sample case
1.3、為什么要使用SMMU?
-
訪問非連續的地址
現在系統中很少再預留連續的memory,如果Master需要很多memory,可以通過SMMU把一些非連續的PA映射到連續的VA,例如給DMA,VPU,DPU使用。 -
32位轉換成64位
現在很多系統是64位的,但是有些Master還是32位的,只能訪問低4GB空間,如果訪問更大的地址空間需要軟硬件參與交換memory,實現起來比較復雜,也可以通過SMMU來解決,Master發出來的32位的地址,通過SMMU轉換成64位,就很容易訪問高地址空間。 -
限制Master的訪問空間
Master理論上可以訪問所有的地址空間,可以通過SMMU來對Master的訪問進行過濾,只讓Master訪問受限的區域,那這個區域也可以通過CPU對SMMU建立頁表時動態控制。 -
用戶態驅動
現在我們也看到很多系統把設備驅動做在用戶態,調用驅動時不需要在切換到內核態,但是存在一些安全隱患,就是用戶態直接控制驅動,有可能訪問到內核空間,這種情況下也可以用SMMU來實現限制設備的訪問空間 -
設備虛擬化
例如設備虛擬化有多種方式,Emulate,Para-virtualized,以及Pass-through,用SMMU可以實現Pass though,這樣無論是性能,還是軟件的改動都是比較小的。 -
一些不支持TrustZone的Master,可以利用SMMU支持Trustzone
2、MMU IP總結
2.1、CoreLink MMU-700 features
- SMMUv3.2 compliant IO-MMU compatible with Arm v8.4 and Arm v9 based CPUs.
- Key Arm architecture features enabled: Secure-EL2, range invalidate, MPAM.
- Support for advanced PCIe and CXL ATS functionality.
- Built to support PCIe Gen5 bandwidth for wide range of I/O applications.
- Introduces AMBA-LTI for translations as a look-aside function.
- Enables the PCIe-PRI feature for on-die accelerators without the need for ATS flow.
2.12、CoreLink MMU-600AE features
- Meets automotive safety requirements for building high-performance ASIL B to ASIL D systems.
- Software compatible with MMU-600 with Arm v8.2 compliant RAS reporting interface.
- Efficient functional logic duplication, ECC and address protection for SRAM.
- AMBA extensions for interface protection.
- Fault management unit to simplify error reporting, testing and integration.
2.3、CoreLink MMU-600 features
- Enhances CoreLink MMU-500 feature set by incorporating SMMUv3.1 specification to support Armv8.2 CPUs.
- Expands the number of contexts supported to millions.
- Implements AMBA-DTI to interface TBU and TCU to improve scalability.
- Multi-level TLB and Walk Cache improves system address translation hit rates.
- Improved write buffer depth and parallel translations.
2.4、CoreLink MMU-500 Features
- Builds on top of MMU-400 features by implementing SMMUv2 architecture adding support for Armv8 CPUs.
- Supports Stage 1, Stage 2, and Stage1 followed by Stage 2 address translation for up to 128 active device contexts.
- Implements a distributed Translation Buffer Unit (TBU) micro-architecture with direct point-to-point connections between each TBU and the centralized Translation Control Unit (TCU) for Page Table Walks (PTWs).
- Supports up to 128 entries per TLB which is further backed by TCU cache up to 2K entries.
2.5、CoreLink MMU-401 Features
- Supports SMMUv1 architecture for Armv7 CPUs and Arm v8 for 64KB page sizes.
- Performs stage2 translation only for hypervisor support.
- Implements a single TBU micro-architecture with connection to a single TCU for page table walks.
3、總結
啥是mmu500,啥是smmu?
mmu500和smmu v3.2的關系,就如同gic500和gicv3的關系。一個是具體的IP,一個是架構。
4、參考
ARM system-memory-management-unit
SMMU跟TrustZone啥關系?
總結
以上是生活随笔為你收集整理的[architecture]-ARM SMMU学习概念总结一篇就够了的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: optee中断处理的介绍(概念篇)
- 下一篇: 01-缓存一致性---基础知识