8.2 Hardware coherency concepts
Most of the material in this section is not architectural. The Arm ARM does not mention MOESI, snoop filters or inclusivity. It states the outcomes hardware coherency must provide and leaves the mechanism to the implementation and to the AMBA protocols (ACE, CHI). The mechanism still matters for this reader for two reasons. It explains which observers need cache maintenance operations at all. It is also where validation finds bugs that the architectural model only describes as “forbidden outcome observed”.
Coherence vs ordering
Coherence is a per-location property. For each location, all writes appear in a single total order (the coherence order of DDI0487 B2), and every observer that reads the location sees values consistent with it. The ordering model of Part 7 is about the relation between locations, and is built on top of coherence. A cache-coherent system can still produce the MP outcome of 7.3 when the barriers are missing, and a coherence bug can break even a correctly fenced program. Validation needs to keep the two failure classes apart: a CoRR or CoWW violation on one address is a coherence bug and always a hardware bug, while a missing-barrier outcome is usually a software bug.
Line states: MOESI as ACE and CHI name them
Hardware keeps one invariant per line: at any instant there is either one writer or many readers (single-writer/multiple-reader), and at most one cache is responsible for the dirty data. AMBA names the states on two axes, Unique/Shared and Clean/Dirty:
| MOESI | ACE/CHI | Meaning |
|---|---|---|
| M | UniqueDirty (UD) | Only copy, modified; this cache must write it back |
| O | SharedDirty (SD) | Other copies may exist; this cache owns the dirty data |
| E | UniqueClean (UC) | Only copy, matches memory; can be written without a transaction |
| S | SharedClean (SC) | Other copies may exist; not responsible for writeback |
| I | Invalid (I) | — |
| — | CHI: UniqueCleanEmpty (UCE), UniqueDirtyPartial (UDP) | Ownership held with no or partial valid data (for full-line writes without a read) |
A store to a line in a Shared state must first gain uniqueness (CHI CleanUnique or ReadUnique). That transaction invalidates the other copies, which is where the cost of true and false sharing comes from (8.10). A load miss on a line that is UniqueDirty in another cache is satisfied by a snoop: the owner forwards the data and either keeps ownership (SD) or passes the dirty data on. The exact transitions belong to the protocol and the implementation. 8.3 maps instructions onto them.
Finding the copies: snooping, directories, snoop filters
- Broadcast snooping. Every coherent miss snoops every other coherent cache. The CCI-400 generation (Cortex-A53/A57/A72 clusters with ACE ports) worked this way. It is simple, but snoop traffic grows with the number of agents.
- Directory / snoop filter. A structure at the home of each address records which caches may hold the line, so only those caches are snooped. In a CMN mesh, each HN-F keeps a snoop filter for its address slice. A DSU also tracks its cores’ L1/L2 contents, so it can answer snoops for the cluster.
- Snoop filter capacity. A snoop filter is a finite cache of tracking entries. When it must evict an entry, it has to back-invalidate the line from every cache that may hold it. A core can therefore lose a line it is actively using because of activity elsewhere. This is architecturally invisible, because the line is just refetched, but it costs performance. It also stresses coherence corner cases (an eviction racing with a store or with an exclusive), which makes it a validation target.
Inclusivity
| Policy | Outer level holds… | Consequence |
|---|---|---|
| Inclusive | everything in the inner levels | The outer tags double as a snoop filter, but evicting an outer line forces back-invalidation of inner copies |
| Exclusive | lines not in the inner levels | Maximum capacity. Lines move between levels on fill and eviction |
| Non-inclusive, non-exclusive (NINE) | either | Typical modern choice. Tracking is done by a separate snoop filter |
Inclusivity is IMPLEMENTATION DEFINED and can differ per level and per core; check the TRM. Software must never depend on it. The architectural CMOs are defined so that they work whatever the policy: a by-VA clean to PoC must find the line wherever it is in the hierarchy up to the PoC. Set/way operations, in contrast, act on one level of one PE’s local hierarchy. With exclusive or NINE caches a line can migrate between levels, or to another PE, while a set/way loop runs. This is one reason set/way cannot be used for coherency (8.5).
The system-level cache
A system-level cache (SLC) lives in the interconnect, for example in each CMN HN-F, rather than in a cluster. Two properties matter:
- It is usually memory-side. Every coherent and IO-coherent agent reaches memory through the home node, so the SLC is transparent to all of them. In architectural terms it is at or beyond the PoC.
CLIDR_EL1does not report it, and no CPU maintenance is needed for it. - “Usually” is the catch. An agent that reaches DRAM by a path that bypasses the home node sees memory without the SLC’s contents, for example a debug or test master wired directly to the memory controller, or a second die whose accesses are not homed in this die’s HN-F. For such an agent the PoC is not where the system designer thinks it is; strictly, such a system does not meet the PoC definition. Because “clean to PoC” is defined by observers, not by a physical place, the 2024 extensions add more precise targets in both directions: outer-cache CMOs (FEAT_OCCMO,
DC CVAOC/DC CIVAOC) that push data only as far as an outer cache such as an SLC, when that is all the consumer needs, and a Point of Physical Storage (FEAT_PoPS,DC CIVAPS) for when the physical storage itself must hold the data (8.4).
Which observers hardware keeps coherent
The architectural statement: for Normal memory that is Inner and Outer Write-Back cacheable and Inner Shareable, hardware keeps the data coherent for all observers in the Inner Shareable domain that access it with the same attributes. No CMO is needed between PEs, ever. The attribute conditions are what matter in practice:
| Observer | Coherent with PE data caches? | Maintenance needed |
|---|---|---|
| Other PEs, same Inner Shareable domain, same cacheable attributes | Yes (snooped) | None. Barriers only (Part 7) |
| Fully coherent agent (CHI RN-F accelerator, CXL.cache device) | Yes, both ways | None |
| IO-coherent master (ACE-Lite or CHI RN-I/RN-D issuing snoopable transactions, typically through an SMMU with cacheable shareable attributes) | Its reads snoop PE caches, and its writes invalidate PE copies. It has no snooped cache of its own | None, provided the transactions really are marked snoopable (8.7, 11.5) |
| Non-coherent master (plain AXI, or non-snoopable attributes) | No | Clean to PoC before it reads; invalidate before the CPU reads what it wrote (8.7) |
| The PE’s own instruction fetch | Not required | DC CVAU + IC IVAU unless IDC/DIC say otherwise (8.6) |
| Translation table walks | Coherent if the walk attributes (TCR_ELx.IRGNn/ORGNn/SHn) are cacheable and match the data mapping | If walks are Non-cacheable, clean table updates to PoC |
| The same PE through a mismatched alias (for example a Non-cacheable mapping of cacheable data) | No | See 6.6 |
| Agents beyond a PA-space or encryption boundary | Defined by RME/MEC | PoPA/PoE operations (8.4, 12.4) |
The table is the main point of this section. Most CMOs exist only for the rows that say “No” or “Not required”. In a well-built server SoC, nearly all DMA is IO-coherent and the CPU never issues a data CMO in steady state. In a cost-reduced embedded SoC, or in pre-silicon models where the interconnect is a stub, every DMA path may be non-coherent. Bring-up firmware has to know which kind it is running on, per master.
Bring-up note: “IO-coherent” is a property of a whole path, not of a device. The device must emit snoopable transactions, or the SMMU must override its attributes (
STE/CDmemory attributes, theSMMU_CR1table-walk attributes for its own fetches). The interconnect port must be configured to accept snoops (ACE-Lite port enabled, or RN-I configured). The memory must be mapped Inner and Outer Write-Back shareable on the CPU side. Any one of these missing gives a path that is silently non-coherent and works “most of the time”.
Validation note: to confirm that a path is actually coherent, have the CPU write a pattern to a cacheable line and leave it dirty (no CMO), then have the master read it. A coherent path returns the new pattern. On the interconnect PMU, an HN-F snoop event should increment (Linux
arm-cmnexposes, for example,hnf_snp_sent,hnf_dir_snoops_sentandhnf_sf_hit; CMN S3 HN-S nodes use thehns_prefix), and the CPU-side writeback or snoop-related counters should move (which events count snoop-caused writebacks is core-specific; check the TRM). Then reverse the direction: the master writes, and the CPU reads a line it previously held. A stale value means the master’s write did not invalidate the CPU’s copy. To provoke snoop-filter back-invalidation, run a footprint larger than the snoop filter’s coverage on other cores and repeat;hnf_sf_evictionsandhnf_sfbi_dir_snp_sent/hnf_sfbi_brd_snp_sentconfirm that it happened.
Checkpoint
Q8.2.1 A DMA engine sits behind an SMMU on an ACE-Lite port. The CPU maps the buffer Normal Inner/Outer Write-Back Inner Shareable. The SMMU STE leaves the device’s own AxCACHE attributes, which mark accesses Non-cacheable non-snoopable, unchanged. The CPU writes a descriptor and rings the doorbell with the correct DMB. What is the risk?
- A. None, because an ACE-Lite port makes all accesses from the device IO-coherent
- B. The device can read stale data from DRAM while the descriptor is still dirty in a CPU cache, because its transactions are not snooped
- C. None, because
DMB OSHbefore the doorbell forces the dirty line out to memory - D. The SMMU reports a permission fault because the attributes mismatch
Answer
B. Coherency depends on the transaction attributes. A non-snoopable read goes to memory without looking in the CPU caches. C is the tempting option, but a barrier orders and completes accesses. It never moves data out of a cache, so only a CMO (clean to PoC) or a snoopable path would help. A is wrong because an ACE-Lite port only allows snoopable transactions.
Read more: Arm ARM (DDI0487), shareability and coherency of Normal memory; SMMUv3 (IHI0070), STE memory attribute overrides
Q8.2.2 On a two-core system, a test observes core 1 read x = 2 and then a later read of x by the same core return 1, where core 0 performed x = 1; x = 2 with no barriers. What does this imply?
- A. Expected behaviour: the test needs a
DMBbetween core 0’s stores - B. Expected behaviour: core 1 needs a
DMB LDbetween its two loads - C. A software bug, because
xshould have been declared atomic - D. A coherence violation (CoRR), which is forbidden without any barrier and points to a hardware or model bug
Answer
D. Two reads of the same location by one observer must not go backwards in that location’s coherence order, whatever barriers are present (read-read coherence). Barriers order accesses to different locations. A and B apply the ordering-model tools to a per-location property. This is exactly the separation a validation triage needs.
Read more: Arm ARM (DDI0487), the AArch64 application-level memory model, coherence order and the internal visibility requirement
Q8.2.3 A test master is wired directly to the DRAM controller, bypassing the CMN HN-Fs that contain the system-level cache. Firmware cleans a buffer with DC CVAC before the master reads it. The master still sometimes sees old data. Which explanation is most plausible?
- A. The clean to PoC left the data in the SLC, which is beyond the architectural PoC for HN-routed agents but not for an agent that bypasses it
- B.
DC CVAConly cleans L1, soDC CIVACis required - C. The master needs a
DSB SYexecuted on its side - D.
CLIDR_EL1.LoCis misreported and the set/way loop missed a level
Answer
A. The PoC is defined by the observers the system designer included. An agent that bypasses the home node is effectively outside that definition, so for it the SLC is a non-coherent cache. Fix it in the system design (route the master through an HN, or have the SLC treat its accesses correctly), or with operations that target further out where the architecture provides them. B is wrong: DC CVAC cleans every level up to the PoC.
Read more: Arm ARM (DDI0487), Point of Coherency definition; Terminology for Clean, Invalidate, and Clean and Invalidate instructions (PoPS)