Imagination_BXM-4-64

Clean-Room Process and Information Firewall

This document defines the isolation protocol (clean-room) under which this specification was written and under which the clean team must produce the reimplementation of the SpacemiT K3 (36.56.104.183) GPU firmware.


1. Separation of Roles

Development follows the classic two-team model separated by a documentation firewall:

  1. Specification Team (dirty side → produces this directory)
    • Inspects public sources, hardware captures on the SpacemiT K3 board, and observable system behavior.
    • Distills only hardware facts, public ABI contracts, state machines, and functional register sequences into docsClean/.
  2. Implementation Team (clean side → consumes this directory)
    • Has never had access to proprietary firmware binaries, disassemblies, decompiled code, or proprietary DDK source code.
    • Reads exclusively this specification, open-source public Linux kernel headers (GPL-2.0-only OR MIT), public MIPS32r2/microMIPS documentation, and the SpacemiT K3 Device Tree.
    • Writes the entire implementation in C/Assembly from scratch, with its own internal architecture, symbol names, private structures, and algorithms.

2. What May and May Not Enter This Specification

Allowed

Strictly Prohibited


3. Source Hierarchy and Provenance

In case of doubt or apparent divergence between sources, apply the following precedence:

  1. [P] Public mainline Linux kernel headers (drivers/gpu/drm/imagination/)
    • Normative source for the exact shared-memory layout (pvr_rogue_fwif_check.h, pvr_rogue_fwif_client_check.h, pvr_rogue_fwif_shared_check.h, pvr_rogue_mips_check.h), .fw container format (pvr_fw_info.h), MIPS definitions (pvr_rogue_mips.h), MMU (pvr_rogue_mmu_defs.h), and register names (pvr_rogue_cr_defs.h).
  2. [O] Evidence measured on a real board (SpacemiT K3 Pico ITX)
    • Normative source for the actual behavior of the 36.56.104.183 silicon (register values read from hardware, clocks/OPPs, APM/boot/render timings, reset/power-cycle behavior, and hardware controller responses).
  3. [D] Specification derived from silicon interaction
    • Register sequences, completion polls, and block initialization constants required by the 36.56.104.183 silicon to satisfy [P] and [O].

4. Clarification Protocol (Question Loop)

If during implementation the clean team encounters a gap or ambiguity:

  1. File an objective contract/hardware question, for example:
    • “Upon receiving an MMU_PAGE_FAULT (EVENT_STATUS bit 9), which fault status registers must be read and which clear bit must be written to EVENT_CLEAR?”
    • “What exact poll order is expected by hardware when triggering 0x0468 = 1 (TA context store)?”
  2. The specification team responds by updating the corresponding document in this directory with a behavioral rule or register table — never by sending code or internal implementation details.
  3. Never guess constants from another Rogue GPU (such as BXE-2-32 or AXE-1-16M): several initialization registers, ISP pipe count (6 on K3 vs 4 on K1), SLC detection (0x3970), and TPU registers (0x1858) differ across BVNCs.

5. Clean-Room Firmware Acceptance Criteria

A clean-room reimplementation is considered functionally complete for the SpacemiT K3 (36.56.104.183) when it passes the incremental milestones below against the mainline drm/imagination driver:

Milestone Verifiable Requirement
M1 — Boot and Handshake Loads via .fw v3 container with device_info (29 parameters), configures MIPS_BOOT_DATA, executes boot-gpu-init, completes firmware_started = 1 with visibility barrier, and responds to KCCB_CMD_KICK / INIT without compchecks errors.
M2 — Ping/Sync and Power/APM Processes KCCB_CMD_HEALTH_CHECK, KCCB_CMD_POW (OFF_REQ/FORCED_IDLE_REQ/FORCED_IDLE_CANCEL_REQ), transitions through APM (100 ms idle → POW_OFF → warm power-on without hanging).
M3 — Compute (CDM, DM4) Executes an arbitrary compute shader with proper UFO / Sync Checkpoint updates and MMU/SLC cache invalidation.
M4 — Transfer (3D-TQ, DM3) Executes 3D-TQ operations (readback / texture copy with up to 3 MRTs) producing bit-exact output.
M5 — Full 3D Render (TA DM2 + 3D DM3) Loads HWRTData + Freelist, executes geometry (TA) and fragment (3D with 6 ISP pipes, PBE up to 8 MRTs, ZLS, and RTA), completing full frames in Vulkan/GLES.
M6 — Stress (CSW + SPM + HWR) Supports cooperative preemption (CSW store/resume on TA, 3D, and CDM), PM Out-of-Memory recovery via Partial Render (SPM) + FREELIST_GROW, and hang detection/recovery (HWR + freelist reconstruction) without requiring an SoC reboot.