MIPS core execution model
The internal GPU microcontroller is a MIPS32r2 core operating in microMIPS mode (docsClean/BXE-2-32/execution-environment). This page describes the hardware execution model, interrupt vectors, caches, barriers, performance counters and USC breakpoint registers exposed to firmware.
ISA, ABI and reset vector
ISA: MIPS32r2, microMIPS mode. Before releasing reset, the host configures
ROGUE_CR_MIPS_WRAPPER_CONFIG(0x0810) withBOOT_ISA_MODE = MICROMIPSandREGBANK_BASE_ADDR = 0xCF80(E007).ABI: o32, soft-float (no FPU), little-endian, ELF32
EM_MIPS.Reset / NMI vector:
0xBFC00000(KSEG1, uncached). Both cold boot and warm boot after runtime PM suspend enter at0xBFC00000. On an NMI, the reference firmware saves MIPS state into the private area ofBOOT_DATAbefore halting[spec].
Event-driven interrupt model
There is no main loop: once boot completes, the MIPS core sits in
WAIT and all work executes across three vectored interrupt sources:
Source |
Vector ( |
Responsibility |
|---|---|---|
HW0 — timer ( |
|
|
HW1 — BG task ( |
|
Raised by the Micro Task Scheduler (MTS) when host or firmware writes
|
HW2 — IRQ task ( |
|
Raised by the MTS on GPU events enabled in
|
CP0 interrupt configuration
Config3.ISAOnExc = 1: exception and interrupt handlers execute in microMIPS mode.Cause.IV = 1andIntCtl.VS = 8(256-byte vector spacing →+0x400/+0x500/+0x600).Status.IM2..IM4enabled (mask0x1C00).Critical sections: mask interrupts by clearing
Status.IE; each Kernel CCB command executes withIE = 0.EXLmust be cleared before C handlers run (E002): if a TLB miss happens whileEXL = 1, MIPS routes it to the general exception vector (+0x180) instead of the TLB refill vector (+0x000) and does not updateEPC.End-of-task acknowledgement
[spec]/[exp E018]: when a BG or IRQ task finishes, writeCR[0x0B08](0for BG,2for IRQ) and read it back to enforce bus ordering. NoMTS_INTCTXclear is needed.
CP0 timers vs. ROGUE_CR_TIMER
Deadlines (HWR watchdogs, HCS context-switch timeouts, APM idle timer) are
tracked in units of ROGUE_CR_TIMER (core_clock / 256). To arm the
next hardware interrupt for deadline ticks ahead, the reference firmware
programs CP0 Compare = (deadline - now) * 0x80 and clears CP0 Count
(factor 128 = (core_clock / 2) / (core_clock / 256)) [spec].
Caches and deterministic write barrier
MIPS caches [spec]
The reference firmware enables D-cache and I-cache and uses MIPS CACHE
instructions for coherency:
D-cache write-back (index operations over the whole cache) during power teardown and before publishing shared data.
D-cache hit-invalidate by address over newly written Client CCB bytes on every
KCCB_KICK(or whole cache for large ranges), so the MIPS does not read stale ring contents.I-cache primed at reset.
Note
Our clean-room firmware sets Config.K0 = 2 and maps every TLB entry
uncached, avoiding cache-coherency hazards at the cost of extra bus
traffic; see Architecture.
Write barrier (host ↔ firmware visibility)
Even with uncached memory, writes must drain out of the MIPS write buffer and the wrapper before the host observes updated offsets or an interrupt (docsClean/BXE-2-32/execution-environment, docsClean/BXE-2-32/observed-sequences):
Write
1to a dedicated uncached word in the privateBOOT_DATAarea (0xBFC01800).Execute
EHB(execution hazard barrier) followed bySYNC.Read the barrier word back.
Read
ROGUE_CR_CORE_REVISION(0x0020) to flush posted bus writes.
Only after step 4 does the firmware publish a host-visible offset, increment
osdata.interrupt_count[0], or write
ROGUE_CR_MIPS_WRAPPER_IRQ_STATUS = 1 (0x08A8).
Performance counters and USC breakpoints [spec]
CP0 performance counters:
PerfCtl0/1are configured fromrogue_fwif_sysinit.firmware_perfandPerfCnt0/1can be sampled for HWPerf (optional on mainline).USC shader breakpoints (XPU broadcast, no public names):
Offset
Role
0x4030Shader breakpoint address (from
fwmemcontext.breakpoint_addr)0x4038Breakpoint handler address (
bp_handler_addr)0x4040Breakpoint control: bits 2:0 slot/DM, bit 3 enable (
breakpoint_ctl)0x4050/0x06D8Over-allocation temp-register (
| 0x2000) and shared-register counts configured at GPU units init (GPU bring-up)Configured per memory context via KCCB
BP(not sent by mainlinepowervr).