aarch64 内存属性-device memory normal memory - cacheable - sharable 相关

参考:

参考:Arm Architecture Reference Manual for A-profile architecture 

Chapter D5  The AArch64 Virtual Memory System Architecture

内存属性存放位置

MAIR_EL1, Memory Attribute Indirection Register

这个寄存器里面,可以放 8 个内存属性。

 

 

 

内存属性使用

然后 页表描述符  的  AttrIndx[2:0], bits[4:2]  来 做 index, 索引 使用 MAIR_EL1 中配置的内存属性。

内存属性 - 即描述一块内存的属性。

设备IO内存还是普通内存?

设备IO内存 属性

device类型的内存还有三种属性:

(1) G, Gather, Determines whether multiple accesses can be merged into a single bus transaction。多个memory access merge为 合并成一个bus-transaction

(2) R, reorder, Determines whether accesses to the same device can be reordered。device memory的access 是否可以重新排序。

(3) E, Early Write Ack,Indicates to the memory system whether a buffer can send acknowledgements。 write不写入device,通过中间buffer之后就 return ack。

 

在 MAIR_EL1  寄存器中,以 0b0000dd00 是形式出现。0bdd 不同,标识不同属性。如下:

 

 

普通内存属性

share 共享 属性

Non-shareable - 不共享。 core 0 的和 Core 1 的缓存都不共享。

Inner-shareable - 只在一个 cluster 内共享。 

outer-shareable - 可以在不同的cluster 之间共享。 

引用 https://blog.csdn.net/weixin_42135087/article/details/121117593 的图

 

 cache 属性

(1)Non-cacheable or cachable 不缓存   缓存

(2)write through or write back   写穿缓存   回写缓存

Write Back:Cache Line中的数据被CPU核修改时并不立刻写回内存,Cache Line和内存中的数据会暂时不一致,在Cache Line中有一个Dirty位标记这一情况。当一条Cache Line要被其它VA的数据替换时,如果不是Dirty的就直接替换掉,如果是Dirty的就先写回内存再替换。

Write Through:每当CPU核修改Cache Line中的数据时就立刻写回内存,Cache Line和内存中的数据总是一致的。如果有多个CPU或设备同时访问内存,例如采用双口RAM,那么Cache中的数据和内存保持一致就非常重要了,这时相关的内存页面通常配置为Write Through模式

 

(3)Read allocate or write allocate    读分配缓存    写分配缓存

Cache知识整理-Read-Allocate/Write-Allocate

https://blog.csdn.net/weixin_43936338/article/details/119774287

CPU read

hit – read from cache

miss:

a – read through – 直接从内存读取

b – read allocate – 先把数据读取到cache, 再从cache 里面读取。

 

cpu write

hit

a – write through 把数据同时写道cache 和内存

b – write back – 把数据写到cache,再通过flush 方式写入内存

miss

a – write allocate – 写cache ,然后再flush 方式写到内存

b – no write allocate – 直接写到内存中。

 

write allocate 和 write back 一起使用

no write allocate 和 write through 一起使用。

 

(4)transient or non-transient cache   瞬逝缓存     非瞬时缓存

 

在   MAIR_EL1    寄存器中,以0booooiiii 格式定义 。

 

 

 

 

 

 

 

 

  

posted @ 2022-03-07 13:01  张志伟122  阅读(1196)  评论(0编辑  收藏  举报