AMBA AXI · Module 9
Exclusive Access
AXI's atomic read-modify-write mechanism — the exclusive monitor, load-/store-exclusive semantics, the EXOKAY (success) vs OKAY (failure) responses, and the size/alignment constraints, mapping to LDREX/STREX and load-linked/store-conditional.
Everywhere else in AXI, the master must build ordering and atomicity itself (Chapters 9.1–9.2). Exclusive access is the one place AXI provides a hardware mechanism for atomic read-modify-write — the basis of locks, semaphores, and atomic counters. It's AXI's form of load-exclusive / store-exclusive (ARM's LDREX/STREX, or load-linked/store-conditional elsewhere): read a location exclusively, modify the value, then attempt an exclusive write that succeeds only if nobody else touched the location in between. The machinery is the exclusive monitor and the EXOKAY vs OKAY response distinction. This chapter covers the sequence, the monitor's state machine, the success/failure semantics, and the constraints — building on AxLOCK from Chapter 6.4.
1. The Exclusive Sequence
An atomic update is two transactions marked exclusive (AxLOCK = 1):
- Load-exclusive (exclusive read): the manager issues a read with
ARLOCK = 1. A hardware exclusive monitor records the location and returnsEXOKAYto confirm the location is being monitored. The manager now has the current value. - (software modifies the value)
- Store-exclusive (exclusive write): the manager issues a write with
AWLOCK = 1to the same location. The monitor checks whether any other agent wrote that location since the exclusive read:- No intervening write → the write succeeds, memory updates, and
BRESP = EXOKAY. The read-modify-write was atomic. - Intervening write → the write fails: memory is not updated, and
BRESP = OKAY. Software seesOKAY(notEXOKAY) and retries the whole sequence.
- No intervening write → the write succeeds, memory updates, and
The key inversion to remember: on a store-exclusive, EXOKAY = success, OKAY = failure — the "normal" response means the atomic attempt lost the race.
2. The Exclusive Monitor State Machine
The monitor is a small state machine per monitored location (conceptually):
A subordinate that doesn't implement a monitor for a region returns OKAY to an exclusive read (signalling exclusivity isn't supported there) — so software must check the read response too. Monitors come in two flavors: a local monitor at a subordinate (for accesses that stay within it) and a global monitor in the interconnect (for locations multiple masters can reach), the latter needed for cross-master atomicity.
3. On the Wire
The two transactions carry AxLOCK = 1 and the responses carry the exclusive codes:
exclusive-access — load-exclusive then store-exclusive, success case
7 cycles4. The Success/Failure Decision and Constraints
The store-exclusive outcome is a single decision — was the monitor still set?
Exclusive access has constraints so monitors can be implemented simply: the exclusive read and write must use the same address, size, and length (they're a matched pair); the number of bytes must be a power of two and the address aligned to that size; the total must be ≤128 bytes (a single burst); and the pair typically uses the same AxID. Violating these makes the behavior unpredictable. AXI3 also had a locked access mode (hard bus locking), which AXI4 removed — exclusive access is the surviving atomicity mechanism (Chapter 9.4).
5. Common Misconceptions
6. Debugging Insight
7. Verification Insight
8. Interview Questions
9. Summary
Exclusive access is AXI's hardware atomic read-modify-write — load-exclusive / store-exclusive, the protocol's LDREX/STREX. A load-exclusive (ARLOCK=1) sets an exclusive monitor and returns EXOKAY; after the modify, a store-exclusive (AWLOCK=1) to the same matched location returns EXOKAY and commits if no other agent wrote the location in between (atomic success), or OKAY and does not write if an intervening write cleared the monitor (failure → software retries). The famous inversion: on a store-exclusive, EXOKAY is success and OKAY is failure. Monitors are local (within a subordinate) or global (in the interconnect, for cross-master atomicity), and the access pair is constrained (same address/size/length, aligned, power-of-two, ≤128 bytes) so monitors stay simple.
The discipline: software must check the response and retry on OKAY — treating OKAY as success is the canonical bug that silently breaks atomicity. Exclusive access provides lock-free synchronization without bus locking, which is why AXI4 removed the heavyweight locked mode entirely. Verify both outcomes (especially the intervening-write failure that must not modify memory) and the cross-master contention race (exactly one winner). Next: that removed locked access mode — what AXI3 had, why it existed, and why AXI4 dropped it in favor of exclusive access.
10. What Comes Next
You've got the atomic mechanism; next, the legacy mode it replaced:
- 9.4 — Locked Access (Legacy AXI3) (coming next) — what AXI3's locked access did, why it locked the bus, and why AXI4 removed it.
Previous: 9.2 — Read/Write Independence. Related: 6.4 — AxLOCK & AxCACHE for the AxLOCK encoding, and 6.8 — RESP & LAST Signals for the EXOKAY response code. For the broader protocol catalog, see the AMBA family overview doc.