7

CPU体系(2):ARM Store Buffer - vaughn.huang

 1 year ago
source link: https://www.cnblogs.com/vaughnhuang/p/16915470.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

本文主要翻译自 Arm Cortex-M7 Processor Technical Reference Manual r1p2 其中章节 Memory System / L1 caches / Store Buffer 。

Store Buffer

Cache中的数据,在写入memory或 AXIM 总线之前,先存放在store buffer中。store buffer有四个存储单元,每个存储单元由一个64bit数据存储及一个32bit地址存储组成。来自data-side的写请求都会存放在store buffer中,但有两个例外:写往TCM 或 AHBP接口的数据。

注:名词解释 浅谈嵌入式MCU CPU内核之ARM Cortex-M7内核高性能(Dual Issue ISA--双发指令)实现要点解析

  • AXIM :高性能内部总线互联矩阵。ARM Cortex-M7内核配备了ARM第4代的AMBA总线矩阵--AXIM,给MCU/SOC提供64-bit的存储器和外设总线互联能力,通过AXIM访问存储器(SRAM和Flash)和外设时可以配置内核的MPU使能I-Cache和D-Cache,从而加速访问,进一步提高系统效率。
  • AHBP :高性能外设接口。ARM Cortex-M7内核还为高性能低延迟的外设连接预留了一个32-bit的AHBP接口:通过该接口扩展的外设,读写访问时无需经过系统总线互联矩阵,从而保证了高性和低延迟。

Store buffer merging

  1. 来自同一个cache line的写请求,被合并到同一个store buffer单元。store buffer写请求合并只适合于带有普通memory属性的写请求。
  2. 如果是强内存序(怎么知道是强内存序??),或者是device memory属性的内存页,则不会发生store buffer写请求合并。
  3. 遇到强内存序写或者device memory属性内存,会首先将store buffer中的数据全部写回,即清空了store buffer中的数据。

Store buffer 写请求转发

在指定条件下,store buffer会将写请求转给 Cache控制器,AXIM总线等(即跳过store buffer,交由cache控制器,AXIM总线)。

  1. 比如针对 Non-Cacheable标记的数据,write-through 类型的cache,等操作,交由AXIM总线。
    比较难理解,不翻译

Store buffer draining

有些情况下,需要先等store buffer中的数据全部写回。有些情况下,需要等该单元的数据写回。
需要等全部的情形:

  1. cache维护操作;
  2. 共享内存(Shared Memory)的独占操作;
  3. DMB, DSB指令;
  4. 上面提到的强内存序地址,或device memory标记的数据。

定义memory maps的属性权限等

#define ioremap(addr, size)     __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
#define ioremap_wc(addr, size)      __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
#define ioremap_wt(addr, size)      __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))

ARM memory models


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK