This document specifies the initialization, communication, and synchronization contract between the Linux host driver (drivers/gpu/drm/imagination) and the MIPS firmware of the SpacemiT K3 (36.56.104.183) GPU.
pvr_fw_start) ([P])Before the firmware executes its first instruction, the host performs the following sequence on the GPU hardware:
K3_PMU_GPU_PWR_DOMAIN, enables CLK_APMU_GPU, deasserts RESET_APMU_GPU.ROGUE_CR_SOFT_RESET (0x0100).pvr_fw_mips.c):
ROGUE_CR_MIPS_WRAPPER_CONFIG (0x1800) with the base physical boot address.MIPS_ADDR_REMAP1..4 with code, data, exceptions, and MMIO.MIPS_ADDR_REMAP5 (0x1880/0x1888) mapping 0x0 → boot code DMA (BRN 63553).MIPS_BOOT_DATA in shared DRAM with:
page_table_phys) and number of FW Heap pages.fw_addr) to struct rogue_fwif_sysinit and struct rogue_fwif_osinit (or boot pointer leading to sysinit).ROGUE_CR_MTS_GARTEN_WRAPPER_CONFIG (0x0BE0) defining the catalogue/OSID0 and SLC access policy.ROGUE_CR_BIF_CAT_BASE0 (0x1200) if applicable to OSID 0.0 to sysinit.firmware_started and 0 to FW_BOOT_STAGE (ROGUE_CR_SCRATCH0 or stage field depending on version).SOFT_RESET controlled per the pvr_fw_startstop.c sequence).sysinit.firmware_started (offset 0x160 in struct rogue_fwif_sysinit) waiting for the value 1 (typical driver timeout: several seconds; real boot on K3 takes < 2 ms).[P][D])After leaving the reset vector (0xBFC00000) and initializing CP0, I$/D$, TLB, and stack (see execution-environment.md):
MIPS_BOOT_DATA:
page_table_phys and enables dynamic FW Heap translation via TLB Refill.fw_addr pointers to struct rogue_fwif_sysinit, struct rogue_fwif_sysdata, struct rogue_fwif_osinit, and struct rogue_fwif_osdata (OSID 0).FW_BOOT_STAGE):
firmware_started = 1).compchecks):
osinit.rogue_comp_checks (offset 0x28 in struct rogue_fwif_osinit) with the firmware’s compiled values (hw_bvnc, fw_bvnc, fw_build_options, ddk_version, ddk_build, and updated = 1).sysinit (initial_core_clock_speed at +0x158, active_pm_latency_ms at +0x15C, runtime_cfg_fw_addr at +0x13C).0x3970, PDS/USC bases, BXM-4-64 unit defaults table, polls 0x4068/0x0CD8, event clear 0x0138 = 0x41FC, configuration of MTS_DM0..4_INTERRUPT_ENABLE and MTS_BGCTX/MTS_INTCTX).firmware_started = 1 with Mandatory Barrier ([D]):
ROGUE_CR_TIMER (0x0160/0x0164) and writes it to sysinit.firmware_started_timestamp (+0x168).sysinit (16 B lines).1 to 0xBFC01800 (MIPS wrapper fence), followed by ehb and sync.CR[0x0020]) to drain the MMIO path.sysinit.firmware_started = 1 (+0x160).firmware_started, writes 1 to 0xBFC01800, ehb + sync.HW0, HW1, HW2) and enters WAIT until the first host kick.[P][D])The host never interrupts MIPS by writing directly to CP0 registers. All Host → FW signaling goes through MTS (ROGUE_CR_MTS_SCHEDULE, offset 0x0B00):
Write to 0x0B00 |
Relevant Bits | Effect in Firmware |
|---|---|---|
dm (0..4) + OSID (0..7) + BG flag |
ROGUE_CR_MTS_SCHEDULE_DM_SHIFT, TASK_NON_COUNTED / COUNTED |
Enqueues a Background (BG, HW0) task in MTS; MIPS wakes from WAIT and enters the BG handler |
KCCB kick (DM0 / GP) |
DM = 0 (GP) |
Signals that kccb_ctl.write_offset advanced and there are new KCCB commands to drain |
| Specific DM kick | DM = 2 (GEOM), 3 (FRAG), 4 (CDM) |
Can be issued by the host or by the firmware itself (CR[0x0B00] = 0) to re-evaluate queues |
MTS_SCHEDULE..MTS_SCHEDULE7 map 1 window per OSID; on standard Linux K3, OSID 0 (0x0B00) is used.[P][D])To wake the Linux driver (after completing work and updating UFOs/Sync Checkpoints, enqueuing a command in FWCCB, or reporting HWR/Power):
fwccb_ctl.write_offset / sysdata (D-cache flush + 0xBFC01800 = 1 + ehb + sync).ROGUE_CR_MIPS_WRAPPER_IRQ_STATUS / ROGUE_CR_IRQ_OS0_EVENT_STATUS register — in the MIPS wrapper, writing the host IRQ trigger register, and the host acknowledges/clears it in ROGUE_CR_IRQ_OS0_EVENT_CLEAR when handling Linux IRQ 53 / APLIC hwirq 75).IRQ_OS0_EVENT_STATUS, clears the corresponding bit, drains the FWCCB ring (pvr_ccb.c), and signals the dma_fence objects of completed jobs.pvr_fw_stop) and Warm Boot ([P][D])active_pm_latency_ms, default 100 ms) expires — or when the host sends KCCB_CMD_POW with ROGUE_FWIF_POW_OFF_REQ / ROGUE_FWIF_POW_FORCED_IDLE_REQ:sysdata.pow_state = ROGUE_FWIF_POW_OFF, and writes the marker at osdata.power_sync_fw_addr (offset 0x23C of struct rogue_fwif_osdata, if configured).WAIT.CLK_APMU_GPU, reprograms MIPS_ADDR_REMAP1..5 (including REMAP5 BRN 63553), and releases MIPS.boot-gpu-init (all GPU units lost state during the power gate!).sysinit/osinit already contain an active connection_ctl and existing contexts, the firmware preserves the logical state of contexts and immediately resumes scheduling after signaling firmware_started = 1.