A processor uses exclusive accesses on a semaphore that lives in a peripheral behind an AXI-to-APB bridge. On the AXI side, the exclusive write must report either success or failure. APB has no notion of exclusive access. The bridge turns the exclusive write into an ordinary APB write and reports... what? Whatever it reports, the processor's lock is now either never acquired, or acquired without being atomic.
What does a bridge between two protocols translate, and what can it not carry across?
The obvious bridge maps fields: an address is an address, data is data, a write is a write. For the common case, single writes and reads with no errors, it works. But every protocol has features the other may lack: bursts, many outstanding transactions, out-of-order responses, specific error codes, atomics, attributes, ordering rules. For each one the bridge must emulate it, approximate it, or refuse it, and each choice changes what the requester can rely on.
Feature | AXI side | APB side | What the bridge does |
|---|---|---|---|
Bursts | Up to 256 beats | None | Splits each burst into single transfers (emulated: slower) |
Outstanding transactions | Many, with IDs | One | Queues requests and serialises them (emulated: concurrency lost) |
Out-of-order responses | Allowed between IDs | Impossible | Responses come back in order (harmless, but lost) |
Read/write concurrency | Separate channels | One transfer at a time | Arbitrates between reads and writes; their relative order is the bridge's choice |
Errors | OKAY, SLVERR, DECERR | PSLVERR | PSLVERR becomes SLVERR; a burst's response must combine its transfers' errors |
Partial writes | WSTRB per byte | PSTRB only from APB4 | Before APB4: refuse, or write whole words (dangerous) |
Exclusive accesses | Exclusive read and write | None | Answer the exclusive write as failed (OKAY), so software's lock is never acquired, or implement a monitor in the bridge |
Attributes | AxPROT, AxCACHE, AxQOS | PPROT only from APB4 | Map protection bits; cache and priority attributes stop at the bridge |
Three kinds of outcome appear in the last column. Some features are emulated at a cost (bursts become many transfers). Some are lost harmlessly (out-of-order freedom the requester did not need). Some are lost dangerously (exclusives, partial writes): the requester believes it got a guarantee it did not.
Never fake success. If the far side cannot do something, return an error or a defined failure, never a plain OK.
Respect both sides' rules at once: the near side's response rules (one response per burst, ordering per ID) and the far side's limits (burst lengths, boundaries, outstanding count).
Decide ordering explicitly. A bridge that reorders reads and writes, or posts writes the near side expects to be non-posted, changes the guarantees software relies on (lesson 7.11).
Document what is lost. The bridge's datasheet should say which features it maps, emulates and refuses.
Bridge | Typical behaviour |
|---|---|
AXI to APB | Serialises everything into single APB transfers; maps PSLVERR to SLVERR; carries PSTRB and PPROT when the APB side is APB4. |
AXI to PCI Express | Maps AXI reads to non-posted reads and AXI writes to posted memory writes, then must provide an AXI write response even though no completion comes back from PCIe (an early acknowledgement), and must keep PCIe's and AXI's ordering rules consistent (Part 7). |
The opening semaphore (illustrative): the bridge answered exclusive writes with plain OKAY, which in AXI means "exclusive failed". The processor's lock routine retried for ever. A second version of the bridge "fixed" it by answering EXOKAY, so locks were acquired but not atomic, and two processors occasionally entered the same critical section. The real fix was to move the semaphore into memory that supports exclusive accesses, and to make the bridge return an error for exclusive accesses so the mistake would be caught at once.
Eight APB transfers (one per beat), and one AXI write response, which must report an error if any of the eight failed.
OKAY makes the lock routine retry (a visible hang); EXOKAY makes it believe it has the lock without atomicity, which corrupts data silently.
A bridge maps what both protocols share, emulates some features at a cost, and must refuse the rest.
Bursts and concurrency are usually emulated; exclusives, partial writes and attributes are often lost.
Never fake success: refuse what cannot be honoured, and document what is lost.