hwperf-trace)This document describes the two shared telemetry mechanisms between firmware and host on the SpacemiT K3 (36.56.104.183): the FW Trace Buffer (structured event logs) and HWPerf V2B (timestamped event stream and hardware performance counters).
struct rogue_fwif_tracebuf) ([P][D])The mainline driver (pvr_fw_trace.c / pvr_fw_trace.h) exposes firmware logs via debugfs by reading a circular ring of dwords in shared memory:
| Field | Description |
|---|---|
log_type (u32) |
Bitmask of enabled log groups (updatable at runtime via KCCB_CMD_LOGTYPE_UPDATE) + ROGUE_FWIF_LOG_TYPE_TRACE flag |
tracebuf_space[0].trace_pointer (u32) |
Current write index (0 .. ROGUE_FW_TRACE_BUF_DEFAULT_SIZE_IN_DWORDS - 1) |
tracebuf_space[0].trace_buffer_fw_addr |
fw_addr of the 12,000-dword (48,000-byte) buffer for MIPS thread 0 |
[P])Each message written by the firmware consists of 3 + N 32-bit words (N = 0..20, parameter count encoded in the SF ID):
| Word | Content |
|---|---|
0 |
String Format ID (sf_id): 0x70000000 \| (N << 16) \| (group_id << 12) \| seq_id (see trace-ids.md) |
1 |
Timestamp Low (CR_TIMER bits [31:0]) |
2 |
Timestamp High (CR_TIMER bits [47:32] in bits [15:0]) + 16 bits of metadata/debug in bits [31:16] |
3 .. 3+N-1 |
The N u32 arguments corresponding to the format string in pvr_rogue_fwif_sf.h |
trace_pointer with wrap-around at 12000, the firmware must keep the buffer coherent (Write-Through) and never stall if the host is not reading (overwrites oldest entries circularly).[P][O][D])HWPerf provides high-resolution tracing of firmware events (HW0/HW1 start/end), hardware events (TA, 3D, PR, 3D-TQ, CDM kicks and completions), CSW events (store/resume), power/clock transitions, and performance counter samples.
[P])KCCB_CMD_HWPERF_UPDATE_CONFIG (0x2ABC00C9): enables/disables emission and updates the 64-bit filter mask (sysinit.hw_perf_filter).KCCB_CMD_HWPERF_CONFIG_BLKS (0x2ABC00DC) / HWPERF_CONFIG_ENABLE_BLKS (0x2ABC00D9): programs the counter selectors of the hardware mux blocks.KCCB_CMD_HWPERF_CTRL_BLKS (0x2ABC00CB): enables/disables sampling of the configured blocks.36.56.104.183) ([O])Validated on the SpacemiT K3 Pico ITX board (capture of 830 continuous periods):
| # | Mux Block | Measured Domain |
|---|---|---|
| 1 | TA_Blk |
Geometry / Tiling Engine / VDM |
| 2 | RASTER_Blk |
Rasterization / ISP (6 pipes) |
| 3 | HUB_Blk |
Memory Hub / BIF / PM |
| 4 | TPU_MCU_ALL |
Texture Processing Unit (TPU) and MCU |
| 5 | USC_ALL |
Unified Shading Cluster (shader ALU / cycles / slots) |
| 6 | PBE_ALL |
Pixel Back-End (render target writes / compression) |
[P][D])HW0) and IRQ (HW1) task start/end — e.g., event 3 (IRQ start) and 4 (IRQ end).TA start/end (7 OOM, 9 TA finished, 0x19 post-PR TA restart), 3D (0x0C 3D finished, 0x18 PR finished, 0x17 3D-TQ finished, 0x12 PM 3D memfree), CDM (0x0E CDM finished).0x30 (CSW store start), 0x31 (CSW store finished).ROGUE_FWIF_POW_NUM_UNITS_CHANGE) and frequency transitions (KCCB_CMD_CORECLKSPEEDCHANGE).log_type == 0 as silent) and HWPerf KCCB commands can accept configuration without blocking the pipeline.tracebuf writes using the public IDs from pvr_rogue_fwif_sf.h is highly recommended as early as M1, since the mainline Linux driver (debugfs fw_trace) automatically decodes logs into human-readable text during on-board debugging!log_type) increases write traffic to the FW Heap and can disturb APM timings; keep only relevant groups enabled in production.[O])The BXM-4-64 exposes 6 counter blocks with mux registers in broadcast space (plus 5 ID-only blocks without mux registers):
| Block | sel |
base (mux) |
counter enable |
|---|---|---|---|
TA_BLK |
0x7600 |
0x7608 |
— |
RASTER_BLK |
0x7700 |
0x7708 |
— |
HUB_BLK (BIF/PMCACHE) |
0x7800 |
0x7808 |
— |
TPU_MCU_ALL |
0x7900 |
0x7908 |
0x8028 |
USC_ALL |
0x8100 |
0x8108 |
0x8030 |
PBE_ALL |
0x83D8 |
0x8478 |
— |
Five ID-only blocks: TORNADO, JONES, TEXAS0, RASTER0, BLACKPEARL0.
if enable exists: BCAST[enable_off] = (block group)
for i in 0 .. num_mux-1:
addr = BCAST[mux_base + (i << shift)] # shift = 3, 8 B per mux
if (mask & (1 << i)): *(u64 *)addr = mux_value[i]
else: *(u64 *)addr = 0
BCAST[sel] = mask << 1
BCAST[sel] = (enable != 0)
After all blocks: counts active blocks, performs D-cache flush + fence + dynamic TLB invalidation, and, if HWPerf logging is enabled, emits the “mux configured” packet.
PBE detail: the 4th mux is at
0x84A0(not0x8498) — a documented exception for this block.
Individual enabling is dispatched by block_id (0..0x6F). The value written
to enable/disable counters is always 1 and requires no poll.