ARM架构中MMU/TLB/Cache的一些概念和寄存器
★★★ 個人博客導讀首頁—點擊此處 ★★★
相關文章
1、ARMV8-aarch64的MMU學習筆記
2、aarch64的TCR寄存器介紹
文章目錄
- 1、MMU/Cache相關的一些基本概念
- (1)、Write-through 和 Write-back
- (2)、Write allocate 和No-write allocate
- (3)、Inner 和Outer
- (4)、Shareable、Inner-shareable、outer-shareable
- 2、MMU/cache maintenance相關的寄存器
- (1)、address translation
- (2)、TLB maintenance
- (3)、cache maintenance
- (4)、Base system registers
- TTBR0_ELx TTBR1_ELx
- TCR_ELx
- MAIR_ELx
1、MMU/Cache相關的一些基本概念
(1)、Write-through 和 Write-back
Write-through- Write is done synchronously both to the cache and to the backing store. Write-back (or Write-behind) - Writing is done only to the cache. A modified cache block is written back to the store, just before it is replaced.- Write-through(直寫模式)在數據更新時,同時寫入緩存Cache和后端存儲。此模式的優點是操作簡單;缺點是因為數據修改需要同時寫入存儲,數據寫入速度較慢
- Write-back(回寫模式)在數據更新時只寫入緩存Cache。只在數據被替換出緩存時,被修改的緩存數據才會被寫到后端存儲。此模式的優點是數據寫入速度快,因為不需要寫存儲;缺點是一旦更新后的數據未被寫入存儲時出現系統掉電的情況,數據將無法找回。
(2)、Write allocate 和No-write allocate
Write-misses寫缺失的處理方式 對于寫操作,存在寫入緩存缺失數據的情況,這時有兩種處理方式: Write allocate (aka Fetch on write) - Datum at the missed-write location is loaded to cache, followed by a write-hit operation. In this approach, write misses are similar to read-misses. No-write allocate (aka Write-no-allocate, Write around) - Datum at the missed-write location is not loaded to cache, and is written directly to the backing store. In this approach, actually only system reads are being cached.-
Write allocate方式將寫入位置讀入緩存,然后采用write-hit(緩存命中寫入)操作。寫缺失操作與讀缺失操作類似。
-
No-write allocate方式并不將寫入位置讀入緩存,而是直接將數據寫入存儲。這種方式下,只有讀操作會被緩存。
無論是Write-through還是Write-back都可以使用寫缺失的兩種方式之一。只是通常Write-back采用Write allocate方式,而Write-through采用No-write allocate方式;因為多次寫入同一緩存時,Write allocate配合Write-back可以提升性能;而對于Write-through則沒有幫助。
(3)、Inner 和Outer
- Inner Cache是指在微架構之內的Cache,如ARM微架構中含有L1和L2兩級Cache,
- Outer Cache指在微架構之外的Cache
(4)、Shareable、Inner-shareable、outer-shareable
Shareable的很容易理解,就是某個地址的可能被別人使用。我們在定義某個頁屬性的時候會給出。Non-Shareable就是只有自己使用。當然,定義成Non-Shareable不表示別人不可以用。某個地址A如果在核1上映射成Shareable,核2映射成Non-Shareable,并且兩個核通過CCI400相連。那么核1在訪問A的時候,總線會去監聽核2,而核2訪問A的時候,總線直接訪問內存,不監聽核1。顯然這種做法是錯誤的。
對于Inner和Outer Shareable,有個簡單的的理解,就是認為他們都是一個東西。在最近的ARM A系列處理器上上,配置處理器RTL的時候,會選擇是不是把inner的傳輸送到ACE口上。當存在多個處理器簇或者需要雙向一致性的GPU時,就需要設成送到ACE端口。這樣,內部的操作,無論inner shareable還是outershareable,都會經由CCI廣播到別的ACE口上。
2、MMU/cache maintenance相關的寄存器
MMU(address translation /TLB maintenance)、cache maintenance相關的寄存器
(1)、address translation
address translation 共計14個寄存器
(2)、TLB maintenance
TLB maintenance數十個寄存器
(以下截取部分)
(3)、cache maintenance
(4)、Base system registers
系統寄存器中, 和MMU/Cache相關的寄存器有:
TTBR0_ELx TTBR1_ELx
(aarch64)
- TTBR0_EL1
- TTBR0_EL2
- TTBR0_EL3
- TTBR1_EL1
- VTTBR_EL2
(aarch32)
- TTBR0
- TTBR1
- HTTBR
- VTTBR
TCR_ELx
(aarch64)
- TCR_EL1
- TCR_EL2
- TCR_EL3
- VTCR_EL2
(aarch32)
- TTBCR(NS)
- HTCR
- TTBCR(S)
- VTCR
MAIR_ELx
- MAIR_EL1
- MAIR_EL2
- MAIR_EL3
總結
以上是生活随笔為你收集整理的ARM架构中MMU/TLB/Cache的一些概念和寄存器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: aarch64的TCR寄存器介绍
- 下一篇: [architecture]-AMRV7