Imagination_BXM-4-64

Shared Data Structures (Mainline ABI 1.1)

This document lists the exact layouts and compile-time verified offsets (pvr_rogue_fwif_check.h, pvr_rogue_fwif_shared_check.h, pvr_rogue_mips_check.h) of structures in shared memory between the mainline drivers/gpu/drm/imagination driver and the MIPS firmware on the SpacemiT K3 (36.56.104.183).

All offsets below are normative ([P]), little-endian, with natural 8-byte alignment on u64 pointers (__aligned(8)).


1. Basic Primitives (pvr_rogue_fwif_shared_check.h)

struct rogue_fwif_dma_addr — 16 bytes

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u64 | dev_addr | GPU virtual address (40 bits) | | 0x08 | u32 | fw_addr | MIPS virtual address in FW Heap (32 bits) |

struct rogue_fwif_ufo — 8 bytes

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u32 | addr | fw_addr of the 32-bit synchronization value | | 0x04 | u32 | value | Expected value (check) or value to write (update) |

struct rogue_fwif_cleanup_ctl — 8 bytes

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u32 | submitted_commands | Counter incremented by host when submitting work referencing the object | | 0x04 | u32 | executed_commands | Counter incremented by firmware upon completing work; object can only be freed when executed == submitted |

struct rogue_fwif_cccb_ctl — 32 bytes

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u32 | write_offset (Woff) | Written by host after packing commands into the cCCB | | 0x04 | u32 | read_offset (Roff) | Written by firmware as commands are consumed/retired | | 0x08 | u32 | dep_offset (Doff) | Written by firmware when advancing past dependency barriers | | 0x0C | u32 | wrap_mask | cccb_size - 1 (power of 2 minus 1) | | 0x10 | u32 | read_offset2 | Auxiliary read offset | | 0x14 | u32 | read_offset3 | Auxiliary offset | | 0x18 | u32 | read_offset4 | Auxiliary offset |


2. Connection Control and Initialization (pvr_rogue_fwif_check.h)

struct rogue_fwif_connection_ctl — 16 bytes

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u32 | connection_fw_state | State confirmed by firmware | | 0x04 | u32 | connection_os_state | OS state written by host | | 0x08 | u32 | alive_fw_token | Liveness token updated by firmware | | 0x0C | u32 | alive_os_token | Liveness token updated by host |

struct rogue_fwif_osinit — 104 bytes (0x68)

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u32 | kernel_ccbctl_fw_addr | fw_addr of KCCB struct rogue_fwif_ccb_ctl | | 0x04 | u32 | kernel_ccb_fw_addr | fw_addr of KCCB command buffer | | 0x08 | u32 | kernel_ccb_rtn_slots_fw_addr | fw_addr of KCCB return slots array | | 0x0C | u32 | firmware_ccbctl_fw_addr | fw_addr of FWCCB struct rogue_fwif_ccb_ctl | | 0x10 | u32 | firmware_ccb_fw_addr | fw_addr of FWCCB command buffer | | 0x14 | u32 | work_est_firmware_ccbctl_fw_addr | Optional (Work Estimation) | | 0x18 | u32 | work_est_firmware_ccb_fw_addr | Optional | | 0x1C | u32 | rogue_fwif_hwr_info_buf_ctl_fw_addr | fw_addr of struct rogue_fwif_hwrinfobuf | | 0x20 | u32 | hwr_debug_dump_limit | HWR dump limit (ROGUE_FWIF_HWR_DEBUG_DUMP_ALL = 99999) | | 0x24 | u32 | fw_os_data_fw_addr | fw_addr of struct rogue_fwif_osdata | | 0x28 | struct | rogue_comp_checks | struct rogue_fwif_compchecks (mutual ABI/BVNC verification) |

struct rogue_fwif_sysinit — 544 bytes (0x220)

Exact offsets verified in pvr_rogue_fwif_check.h:

Offset Type Field Role on K3 (36.56.104.183)
0x000 u64 fault_phys_addr Physical address of the fault/dummy page
0x008 u64 pds_exec_base PDS execution base → written to BCAST[0x0610/0x0614]
0x010 u64 usc_exec_base USC execution base → written to BCAST[0x4008/0x4010/0x4028]
0x018 u64 fbcdc_state_table_base FBCDC table (when applicable)
0x020 u64 fbcdc_large_state_table_base FBCDC large table
0x028 u64 texture_heap_base Texture heap base
0x030 u64 hw_perf_filter Initial HWPerf filter mask (64 bits)
0x038 u64 slc3_fence_dev_addr SLC3 fence address
0x040 u64 tpu_trilinear_frac_mask TPU trilinear mask
0x050 array sigbuf_ctl Per-DM signature buffer control
0x098 struct pdvfs_opp_info OPP/PDVFS table information
0x120 struct coremem_data_store Coremem descriptor
0x130 struct counter_dump_ctl Counter dump control
0x138 u32 filter_flags Filter flags
0x13C u32 runtime_cfg_fw_addr fw_addr of struct rogue_fwif_runtime_cfg
0x140 u32 trace_buf_ctl_fw_addr fw_addr of struct rogue_fwif_tracebuf
0x144 u32 fw_sys_data_fw_addr fw_addr of struct rogue_fwif_sysdata
0x148 u32 gpu_util_fw_cb_ctl_fw_addr fw_addr of struct rogue_fwif_gpu_util_fwcb
0x14C u32 reg_cfg_fw_addr Optional list of register overrides applied at init
0x150 u32 hwperf_ctl_fw_addr HWPerf control
0x154 u32 align_checks Pointer to ABI alignment checks
0x158 u32 initial_core_clock_speed Initial frequency in Hz (e.g., 409600000)
0x15C u32 active_pm_latency_ms APM latency in ms (default 100)
0x160 u32 firmware_started Boot handshake: firmware writes 1 with barrier after completing init
0x164 u32 marker_val Diagnostic marker
0x168 u64 firmware_started_timestamp ROGUE_CR_TIMER value captured at end of boot
0x16C u32 jones_disable_mask Jones disable mask
0x170 u32 firmware_perf Firmware performance configuration
0x174 u32 core_clock_rate_fw_addr Pointer to clock rate
0x178 u32 gpio_validation_mode GPIO validation mode
0x17C struct bvnc_km_feature_flags Kernel BVNC feature flags
0x21C u32 tfbc_compression_control TFBC compression control

Note for the clean team: Directly include the public layouts from pvr_rogue_fwif.h and validate with OFFSET_CHECK/SIZE_CHECK from pvr_rogue_fwif_check.h in the MIPS build to guarantee bit-exact binary compatibility.


3. Dynamic State Structures (sysdata, osdata, runtime_cfg) ([P])

struct rogue_fwif_sysdata — 3624 bytes (0xE28)

Maintained in real time by the firmware and read by the host for diagnostics, APM, and HWR:

struct rogue_fwif_osdata — 584 bytes (0x248)

struct rogue_fwif_runtime_cfg — 72 bytes (0x48)

Updated by the host (via KCCB_CMD_CORECLKSPEEDCHANGE or directly):


4. Execution and Memory Contexts ([P])

struct rogue_fwif_fwmemcontext — 32 bytes (0x20)

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u64 | pc_dev_paddr | Physical address (36 bits, 4 KiB-aligned) of the GPU MMU Page Catalogue (PC) | | 0x08 | u32 | page_cat_base_reg_set | Assigned BIF bank index (0..6 corresponding to BIF_CAT_BASE1..7, or unassigned) | | 0x0C | u32 | breakpoint_addr | Breakpoint address (optional) | | 0x10 | u32 | bp_handler_addr | Breakpoint handler (optional) | | 0x14 | u32 | breakpoint_ctl | Breakpoint control | | 0x18 | u32 | fw_mem_ctx_flags | Memory context flags |

struct rogue_fwif_fwcommoncontext — 152 bytes (0x98)

Represents a submission queue (a GEOM, FRAG, or CDM context):


5. Rendering Structures (HWRTData and Freelist) ([P])

struct rogue_fwif_hwrtdata — 384 bytes (0x180)

Represents an in-flight render target instance (TA + 3D):

struct rogue_fwif_freelist — 64 bytes (0x40)

| Offset | Type | Field | Description | |—:|—|—|—| | 0x00 | u64 | freelist_dev_addr | GPU virtual base of the freelist page buffer | | 0x08 | u64 | current_dev_addr | Current virtual address of the freelist stack | | 0x10 | u32 | current_stack_top | Current stack top in PM (CR 0x0224 in context 0/2; CR[0x0230] = top << 22 in context 1) | | 0x14 | u32 | max_pages | Maximum page capacity | | 0x18 | u32 | grow_pages | Growth increment in case of OOM | | 0x1C | u32 | current_pages | Pages currently available to PM | | 0x20 | u32 | allocated_page_count | Count of allocated pages | | 0x24 | u32 | allocated_mmu_page_count | Count of PM MMU table pages | | 0x28 | u32 | freelist_id | Unique identifier used in FWCCB FREELIST_GROW / FREELISTS_RECONSTRUCTION requests | | 0x2C | u32 | grow_pending | Indicates whether a grow operation is in progress | | 0x30 | u32 | ready_pages | Reserve pages ready for immediate use on OOM (before triggering PR) | | 0x34 | u32 | freelist_flags | Freelist state flags | | 0x38 | u32 | pm_global_pb | Global parameter buffer indicator |


6. Diagnostics, Utilization, and MIPS State ([P])

Structure Size Purpose
struct rogue_fwif_hwrinfobuf 2336 bytes Ring of HWR fault records per DM (hwr_counter at +2176, write_index at +2180, dd_req_count at +2184, per-DM counters at +2192..2300)
struct rogue_fwif_tracebuf 864 bytes Control structure (log_type at +0, per-thread tracebuf at +8, tracebuf_size_in_dwords at +856, tracebuf_flags at +860), pointing to the 12000-dword circular buffer
struct rogue_fwif_gpu_util_fwcb 10280 bytes time_corr ring (+0) + time_corr_seq_count (+10240) + gpu_util_flags (+10244) + last_word (+10248) + stats_counters (+10256) for utilization calculation and DVFS
struct rogue_mips_state 684 bytes Exception/NMI dump: 11 CP0 regs (0x00..0x28), tlb[16] (0x2C, 256 B), remap[32] (0x12C, 384 B)