Imagination_BXM-4-64

Clean-Room Specification — SpacemiT K3 GPU Firmware (PowerVR BXM-4-64)

This directory contains the behavioral, hardware architecture, and ABI contract specification for a clean-room reimplementation of the firmware for the Imagination PowerVR Rogue BXM-4-64 MC1 GPU (BVNC 36.56.104.183) integrated into the SpacemiT K3 SoC.

The primary target of this specification is the open mainline Linux (drivers/gpu/drm/imagination) contract, FWIF ABI version 1.1 (v3 container, public identifier powervr/rogue_36.56.104.183_v1.fw). Where relevant for cross-validation on real hardware, the documentation also records surface-level differences relative to the legacy vendor (img-rogue / DDK 24.2) contract without mixing private layouts into the target specification.


Reading Rules and Provenance

Before starting any implementation, read clean-room-process.md.

Every technical statement in this specification follows three provenance levels:


Documentation Map

1. Governance and General Architecture

# Document Contents
01 clean-room-process.md Clean-room firewall, what is allowed and what is prohibited, source hierarchy, and acceptance criteria
02 overview.md BXM-4-64 (36.56.104.183) GPU architecture, SpacemiT K3 SoC integration, platform resources, and control loop
03 open-vs-closed.md Relationship between the open mainline contract (drm/imagination 1.1) and the legacy vendor driver (DDK 24.2)

2. MIPS Processor, Memory, and Host Interface

# Document Contents
04 execution-environment.md MIPS32r2 / microMIPS core, boot/reset/NMI, CP0 vectors, interrupts (HW0/HW1/HW2), L1 caches, barriers, and stack
05 memory-model.md MIPS virtual map, REMAP1..5, BRN 63553 workaround, 36-bit MIPS page table, TLB (16 entries), GPU MMU (3 levels, 40b→36b), and .fw v3 container
06 host-interface.md Shared memory, MIPS_BOOT_DATA, boot handshake (FW_BOOT_STAGE + firmware_started), compchecks, Host↔FW IRQs, and start/stop
07 data-structures.md Exact layouts and offsets of shared structures (connection_ctl, osinit, sysinit, sysdata, osdata, runtime_cfg, contexts, HWRTData, Freelist, HWR, GPU Util)

3. Command Queues and Scheduling (Control Plane)

# Document Contents
08 kernel-ccb.md KCCB ring (Host → FW), rogue_fwif_ccb_ctl, KCCB command catalog (0x2ABC....), and return slots
09 firmware-ccb.md FWCCB ring (FW → Host), slot acquisition, and FWCCB command catalog (101..112)
10 client-ccb.md Per-context cCCB ring (Woff/Roff/Doff/wrap_mask), 40 B header, TASK vs generic commands, UFOs, and Sync Checkpoints
11 command-structs.md Kick payloads (cmd_geom, cmd_frag, cmd_compute, cmd_transfer) with verified sizes/offsets and active fields on K3
12 scheduler.md Per-DM queues (GP, GEOM, FRAG, CDM), scheduling, cooperative preemption (CSW store/resume), overlap matrix, and kick admission check
13 data-masters.md Data Masters present/absent on K3, MemCtx activation/deactivation across the 8 BIF banks (BIF_CAT_BASE0..7), and per-DM completion flush

4. Hardware Programming (Data Plane)

# Document Contents
14 boot-gpu-init.md GPU unit initialization sequence on K3 BXM-4-64: dynamic SLC detection (0x3970), PDS/USC bases, BXM-4-64 unit defaults, polls, and MTS routing
15 kick-geometry-ta.md Register programming for Geometry/TA kick (DM2), loading HWRTData and Freelist into PM, TE/PPP/VDM/RTA/RTC, CSW, and completion
16 kick-compute-and-3d.md Register programming for Compute/CDM (DM4), Fragment/3D (DM3, 6 ISP pipes, 8 PBE MRTs, ZLS), and 3D-TQ Transfer (DM3, 3 MRTs)
17 partial-render-spm.md Full PM Out-of-Memory flow (EVENT_STATUS b7), ready_pages, FREELIST_GROW, Partial Render (0x0338), and post-PR TA resume
18 power-management.md Power state machine (POW_OFF/ON/FORCED_IDLE/IDLE), APM (100 ms), unit power control (0x0038), final power-off, DVFS, and CR_TIMER
19 hardware-recovery.md HWR watchdog (deadline and 3 verification stages), MMU page fault, poll failure, full soft reset, DM recovery, and freelist reconstruction

5. Reference, Diagnostics, and On-Board Validation

# Document Contents
20 board-testing-oracle.md On-board acceptance oracle: .fw container pre-flight, safe load/reload, and stages A–F (cold boot, per-DM sanity, vkfwtest, APM/DVFS, HWR, stress)
21 observed-sequences.md Real sequences measured on a SpacemiT K3 Pico ITX board (boot, 3D, CDM, 3D-TQ, CSW, overlap, APM, DVFS, HWPerf), platform pitfalls, and open gaps
22 registers.md Consolidated map of public ROGUE_CR_* and FW-only registers on K3 BXM-4-64, including per-DM flush, with active snapshot observed on board
23 hwperf-trace.md HWPerf V2B stream, 6 BXM-4-64 mux blocks, FW Trace ring buffer (12,000 dwords), and operational constraints on K3
24 trace-ids.md Public pvr_rogue_fwif_sf.h contract, log groups (log_type), and key events per subsystem
25 glossary.md Glossary of acronyms and technical terms for the PowerVR Rogue BXM-4-64 architecture and SpacemiT K3 SoC

Reimplementation Coverage Status


License

This specification is distributed under the Creative Commons Attribution-ShareAlike 4.0 International (CC-BY-SA-4.0) license. See the LICENSE file for the full terms.

(Note: public ABI definitions referenced from the Linux kernel drivers/gpu/drm/imagination/ remain under their original GPL-2.0-only OR MIT license.)