Imagination_BXM-4-64

GPU Hardware Initialization at Boot (boot-gpu-init)

This document specifies the CR register programming sequence required by the PowerVR BXM-4-64 (36.56.104.183) silicon on the SpacemiT K3 on every cold boot, post-APM power-on (warm boot), and reinitialization after an HWR reset.

Critical notice ([O][D]): The values below are specific to the BXM-4-64 (36.56.104.183, XE_TPU2, PBE2_IN_XE, 128 KiB SLC, 6 ISP pipes) silicon and differ from other Rogue Series B GPUs (such as BXE-2-32). Do not reuse initialization tables from another BVNC.


1. Functional Initialization Order ([D])

The phases below respect hardware dependencies (power/clocks → MMU/SLC → execution bases and block setup → mandatory USC/TE internal init polls → final rendering/texture block setup → multicore/MTS → publishing firmware_started):

1. Clock gating (when DISABLE_CLKGATING_EN is active) and cluster/dust power-up (1 cluster)
2. Initial MMU cache invalidation (mask 0x1C) and SLC size detection via CR[0x3970]
3. PDS/USC execution bases and overalloc controls
4. Initial PDS/TPU configuration and mandatory internal init polls (0x4068 and 0x0CD8)
5. Memory/pipeline subsystem setup (BIF, PM, TE/PPP, ISP, PBE, and TPU XE_TPU2)
6. Multicore indices (0xF338 / 0xF318 / 0x0890)
7. Clearing pending events and MTS interrupt routing
8. Optional reg_cfg application and sysinit.firmware_started = 1 handshake with full barrier

2. Clocks, Dusts, MMU, and Dynamic SLC Detection ([O][D])

2.1. Optional Clock Gating

If sysdata.config_flags has ROGUE_FWIF_INICFG_DISABLE_CLKGATING_EN set:

2.2. Clusters / Dusts and MMU Invalidation

2.3. Dynamic SLC Size Detection via CR[0x3970] ([O][D])

On silicon 36.56.104.183 (SLC_SIZE_CONFIGURABLE = 1), the actual SLC size in KiB is read directly from hardware register CR[0x3970] (no public name in the mainline header):

Value read from CR[0x3970] (KiB) Action on BCAST[0x3828] (SLC_CTRL_BYPASS lo) Action on BCAST[0x382C] (SLC_CTRL_BYPASS hi)
== 0 or <= 0x20 (≤ 32 KiB) \|= 0x01000000 \|= 0x00002000
0x21 .. 0x7F (33–127 KiB) \|= 0x01000000 &= ~0x00002000
>= 0x80 (≥ 128 KiB — K3 case) &= ~0x01000000 &= ~0x00002000

Why this matters on K3: The SpacemiT K3 has 128 KiB of SLC (0x80). Clearing the bypass bits 0x01000000 (0x3828) and 0x2000 (0x382C) enables full SLC usage for all clients.


3. PDS/USC Execution Bases and Internal Init Polls ([P][D])

3.1. Execution Bases (40-bit virtual addresses from struct rogue_fwif_sysinit)

Register (Broadcast) Width Value
BCAST[0x0610] / BCAST[0x0614] 64-bit sysinit.pds_exec_base (lo / hi)
BCAST[0x4008] / BCAST[0x400C] 64-bit sysinit.usc_exec_base (lo / hi)
BCAST[0x4010] / BCAST[0x4014] 64-bit sysinit.usc_exec_base (lo / hi)
BCAST[0x4028] / BCAST[0x402C] 64-bit sysinit.usc_exec_base (lo / hi)
BCAST[0x6000] 32-bit 0x00000000
BCAST[0x4050] 32-bit temp_overalloc \| 0x2000 (USC overalloc control)
BCAST[0x06D8] 32-bit shared_overalloc (PDS/shared overalloc control)

3.2. Pre-Init PDS Setup and Mandatory Polls

Before triggering the USC bank and TE/PPP initialization polls, program the initial PDS control parameters and TPU tags:

Next, trigger and wait for the mandatory internal initialization polls:

  1. Write BCAST[0x4068] = 1 → Mandatory poll: wait for CR[0x4068] bit 0 == 0 (USC bank initialization).
  2. Write BCAST[0x0660] = 1 and BCAST[0x0670] = 1 (PDS buffer initialization).
  3. Write BCAST[0x0CD8] = 1 → Mandatory poll: wait for CR[0x0CD8] bit 0 == 0 (TE/PPP initialization).

4. Per-Subsystem Initialization Values (36.56.104.183) ([D])

After the 0x4068 and 0x0CD8 polls complete, configure the default values required by each subsystem of the BXM-4-64 (XE_TPU2 / PBE2_IN_XE) silicon:

4.1. BIF, Parameter Manager (PM), and Sidekick

| Register (Broadcast) | Operation / Value | Role | |—|—|—| | BCAST[0x13F8] | = 0x00000007 | BIF configuration | | BCAST[0x0358] | = 0x00000005 | PM / Sidekick configuration | | BCAST[0x0244] / BCAST[0x0240] | = 0x00000080 / = 0x00000000 | Initial PM control | | BCAST[0x20F8] | = 0x00000001 | PM-MMU control | | BCAST[0x2010], BCAST[0x2100] | = 0x00000000 | Initial PM-MMU state |

4.2. PDS, VDM/CDM, TE/PPP, ISP, and PBE (PBE2_IN_XE)

| Register (Broadcast) | Operation / Value | Role | |—|—|—| | BCAST[0x0700], BCAST[0x0708] | = 0x00000001 | Auxiliary PDS control | | BCAST[0x06B0], BCAST[0x0470] | = 0x00000000 | Initial PDS / VDM-CDM state | | BCAST[0x1498] | = 0x00000001 | Pipeline control | | BCAST[0x0C78] | = 0x00000088 | TE configuration | | BCAST[0x0C90], BCAST[0x0C94] | = 0x3089705F | BXM-4-64-specific TE / PPP parameters | | BCAST[0x0FA0] | = 0x00000088 | ISP configuration | | BCAST[0x1500] | = 0x00000080 | PBE configuration (PBE2_IN_XE) | | BCAST[0x15A0] .. BCAST[0x15DC] (16 dwords, stride 4) | = 0x00000000 | Zeroing of PBE / MRT state table |

4.3. TPU / MCU (XE_TPU2 + TPU_DM_GLOBAL_REGISTERS)

| Register (Broadcast) | Operation / Value | Role | |—|—|—| | BCAST[0x1710] / BCAST[0x1714] | = 0x90000000 / = 0x00000000 | TPU / MCU control | | BCAST[0x1780] | = 0x00000021 | Global TPU control | | BCAST[0x1788], BCAST[0x178C] | = 0x00000020 | TPU parameters | | BCAST[0x17B8] | \|= 0x00000002 | TPU enable (XE_TPU2) | | BCAST[0x17C8], BCAST[0x17D0] | = 0x00000004 | TPU configuration | | BCAST[0x1800], BCAST[0x1810] | = 0x00000020 | TPU configuration | | BCAST[0x1850] | \|= 0x00000002 | Per-DM TPU control (TPU_DM_GLOBAL) | | BCAST[0x1858] | \|= 0x00000002 | CDM TPU control (tpu_tag_cdm_ctrl) | | BCAST[0x1870], 0x1874, 0x1878, 0x187C | = 0x00000020 | TPU parameters | | BCAST[0x18E8], 0x18F0, 0x18F8, 0x1900 | = 0x0000000F | TPU / memory configuration |


5. Multicore, Event Clearing, and MTS Routing ([P][D])

5.1. Multicore Indices

Reads n = CR[0xF308] (ROGUE_CR_MULTICORE_SYSTEM; on K3 MC1, n = 1):

5.2. Event Clearing and MTS Interrupt Enables ([P][D])

Register Public Macro Value on K3 Semantics
BCAST[0x0138] ROGUE_CR_EVENT_CLEAR 0x000041FC Clears pending boot events (CDM, 3D, TA, PM_OOM, PM_3D_MEM_FREE, ISP_ZLS_END, etc.)
CR[0x0B58] ROGUE_CR_MTS_DM0_INTERRUPT_ENABLE 0x00089200 Enables events on DM0 (GP): MMU_PAGE_FAULT (b9 = 0x200), GPIO_REQ (b12 = 0x1000), USC_TRIGGER (b15 = 0x8000), SLAVE_REQ (b19 = 0x80000)
CR[0x0B68] ROGUE_CR_MTS_DM2_INTERRUPT_ENABLE 0x000000A0 Enables events on DM2 (GEOM): TA_FINISHED (b5 = 0x20), PM_OUT_OF_MEMORY (b7 = 0x80)
CR[0x0B70] ROGUE_CR_MTS_DM3_INTERRUPT_ENABLE 0x00000008 Enables event on DM3 (FRAG): PIXELBE_END_RENDER (b3 = 0x08)
CR[0x0B78] ROGUE_CR_MTS_DM4_INTERRUPT_ENABLE 0x00000004 Enables event on DM4 (CDM): COMPUTE_FINISHED (b2 = 0x04)
CR[0x0B40] ROGUE_CR_MTS_INTCTX_THREAD0_DM_ASSOC 0x0000FFFF Associates all DMs with thread 0 interrupt context (HW1)
CR[0x0128] ROGUE_CR_EVENT_ENABLE 0x00000000 GPU events are routed via MTS (HW1), not directly to external IRQ
CR[0x0B30] ROGUE_CR_MTS_BGCTX_THREAD0_DM_ASSOC 0x00000001 Associates BG scheduling (HW0) with thread 0

6. Completion and Publishing firmware_started ([P][D])

  1. Applies any optional register override list (sysinit.reg_cfg_fw_addr, offset +0x14C), if present.
  2. Reads ROGUE_CR_TIMER (CR[0x0160] lo, CR[0x0164] & 0xFFFF hi) and stores it in sysinit.firmware_started_timestamp (+0x168).
  3. Executes coherence barrier: D-cache flush on sysinit → *(volatile u32 *)0xBFC01800 = 1 → ehb → sync → dummy read of CR[0x0020].
  4. Writes sysinit.firmware_started = 1 (+0x160), flushes the cache line of firmware_started, writes 0xBFC01800 = 1, ehb, sync.
  5. Updates sysdata.pow_state = ROGUE_FWIF_POW_ON, enables CP0 interrupts, and waits for work (WAIT).