[mmu/cache]-Cache Type Register(CTR)寄存器介绍-InProgress
在ARMV8中,只有CTR_EL0,沒有CTR_EL1/2/3
1、CTR_EL0寄存器介紹
(1)、DminLine/IminLine
Log2 of the number of words in the smallest cache line of all the data caches and unified caches that are controlled by the PE.x
cache line的大小,cache_line_size = 4 * (2x2^x2x), x=[19:16], [3:0]
獲取d-cache cache-line的示例代碼:
.macro dcache_line_size, reg, tmpmrs \tmp, ctr_el0 // read CTRubfm \tmp, \tmp, #16, #19 // cache line size encodingmov \reg, #4 // bytes per wordlsl \reg, \reg, \tmp // actual cache line size.endm其算法就是:
a. 讀取ctr_el0比特16到19的數(shù)值 : tmp = ctr_el0[19:16]
b. 計(jì)算cache line大小 : reg = (4 << tmp) = 4 * (2^tmp)
(2)、TminLine
Tag minimum Line. Log2 of the number of words covered by Allocation Tags in the smallest cache
line of all caches which can contain Allocation tags that are controlled by the PE
cache line的大小,tag_size = 4 * (2x2^x2x), x=[37:32]
(3)、DIC
Instruction cache invalidation requirements for data to instruction coherence
0b0 Instruction cache invalidation to the Point of Unification is required for data to instruction coherence.
0b1 Instruction cache invalidation to the Point of Unification is not required for data to instruction coherence.
(4)、IDC
Data cache clean requirements for instruction to data coherence
0b0 Data cache clean to the Point of Unification is required for instruction to data coherence,
unless CLIDR_EL1.LoC == 0b000 or (CLIDR_EL1.LoUIS == 0b000 &&
CLIDR_EL1.LoUU == 0b000).
0b1 Data cache clean to the Point of Unification is not required for instruction to data
coherence.
(5)、CWG
Cache writeback granule. Log2 of the number of words of the maximum size of memory
(6)、ERG
Exclusives reservation granule. Log2 of the number of words of the maximum size of the reservation granule
(7)、L1Ip
Level 1 instruction cache policy
0b00 VMID aware Physical Index, Physical tag (VPIPT)
0b01 ASID-tagged Virtual Index, Virtual Tag (AIVIVT)
0b10 Virtual Index, Physical Tag (VIPT)
0b11 Physical Index, Physical Tag (PIPT)
2、代碼示例
在Linux Kernel代碼中,讀取CTR_EL0的地方只有三處,分別是:
- raw_icache_line_size
- raw_dcache_line_size
- read_ctr
而raw_icache_line_size和raw_dcache_line_size并沒有人直接調(diào)用;
read_ctr被 dcache_line_size 和 icache_line_size調(diào)用
總結(jié)
以上是生活随笔為你收集整理的[mmu/cache]-Cache Type Register(CTR)寄存器介绍-InProgress的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [mmu/cache]-cache在li
- 下一篇: ARM Trustzone介绍-视频学习