Chapter 3. L1 and L2 Cache Operation
3-7
Memory and Cache Coherency
These operations are necessary because the processor does not maintain instruction
memory coherent with data memory. Software is responsible for enforcing coherency of
instruction caches and data memory. Since instruction fetching may bypass the data cache,
changes made to items in the data cache may not be reected in memory until after the
instruction fetch completes.
3.4 Memory and Cache Coherency
The primary objective of a coherent memory system is to provide the same image of
memory to all devices using the system. Coherency allows synchronization and cooperative
use of shared resources. Otherwise, multiple copies of a memory location, some containing
stale values, could exist in a system resulting in errors when the stale values are used. Each
potential bus master must follow rules for managing the state of its cache. This section
describes the coherency mechanisms of the PowerPC architecture and the cache coherency
protocols that the MPC7400 data cache supports.
Note that unless speciTcally noted, the discussion of coherency in this section applies to the
MPC7400s data cache only. The instruction cache is not snooped. Instruction cache
coherency must be maintained by software. However, the MPC7400 does support a fast
instruction cache invalidate capability as described in Section 3.5.1.6, òInstruction Cache
Flash Invalidation.ó
3.4.1 Memory/Cache Access Attributes (WIMG Bits)
Some memory characteristics can be set on either a memory management block or page
basis by using the WIMG bits in the BAT registers or page table entrys (PTE), respectively.
These bits allow both uniprocessor and multiprocessor system designs to exploit numerous
system-level performance optimizations. The WIMG attributes control the following
functionality:
¥
Write-through (W bit)
¥
Caching-inhibited (I bit)
¥
Memory-coherency-required (M bit)
¥
Guarded (G bit)
The WIMG attributes are programmed by the operating system for each page and block.
The W and I attributes control how the processor performing an access uses its own cache.
The M attribute ensures that coherency is maintained for all copies of the addressed
memory location. The G attribute prevents out-of-order loading and prefetching from the
addressed memory location.
The WIMG attributes occupy four bits in the BAT registers for block address translation
and in the PTEs for page address translation. The WIMG bits are programmed as follows: