Imagination_BXM-4-64

Firmware CCB (FWCCB — Firmware → Host Notifications)

The FWCCB (Firmware Command Control Buffer) is the unidirectional ring buffer through which the firmware sends asynchronous notifications to the Linux driver (pvr_ccb.c), such as freelist grow requests (OOM/SPM), on-demand Z/S buffer backing, HWR alerts, firmware page faults, and freelist reconstruction requests.


1. Control Structure and Acquisition Protocol ([P][D])

The FWCCB uses the same struct rogue_fwif_ccb_ctl (144 bytes, write_offset at +0x00, read_offset at +0x80, wrap_mask at +0x84, cmd_size at +0x88) as the KCCB, with reversed roles:

Mandatory Sequence to Send an FWCCB Command ([D])

  1. Acquire slot: Check that ((write_offset + 1) & wrap_mask) != read_offset.
    • If the ring is full, the firmware must wait or record a backpressure condition (never overwriting a slot not yet consumed by the host).
  2. Populate command: Write cmd_type (0x2ABC0000 | id), fwccb_flags, and the corresponding payload at firmware_ccb_fw_addr + (write_offset * cmd_size).
  3. Publish and notify:
    • Ensure visibility of the slot contents before advancing write_offset.
    • Update fwccb_ctl.write_offset = (write_offset + 1) & wrap_mask.
    • Execute the visibility barrier (0xBFC01800 = 1, ehb, sync) and trigger the host interrupt (target OSID → APLIC hwirq 75).

2. FWCCB Command Catalog (Mainline ABI 1.1) ([P][D])

The codes match enum rogue_fwif_fwccb_cmd_type (pvr_rogue_fwif.h) exactly:

Public Command (ROGUE_FWIF_FWCCB_CMD_*) ID (0x2ABC00..) Member in cmd_data When the Firmware Must Emit
ZSBUFFER_BACKING 0x2ABC0065 (101) cmd_zs_buffer_backing During SPM/Partial Render when the render target needs physical backing for on-demand Z/S or MSAA
ZSBUFFER_UNBACKING 0x2ABC0066 (102) cmd_zs_buffer_backing After the full render completes and the on-demand Z/S buffer is no longer needed
FREELIST_GROW 0x2ABC0067 (103) cmd_free_list_gs During PM Out-of-Memory (EVENT_STATUS bit 7) to ask the host to allocate more pages to the freelist (see partial-render-spm.md)
FREELISTS_RECONSTRUCTION 0x2ABC0068 (104) cmd_freelists_reconstruction After an HWR reset when one or more freelists are left in an inconsistent state and must be reconstructed by the host (see hardware-recovery.md)
CONTEXT_RESET_NOTIFICATION 0x2ABC0069 (105) cmd_context_reset_notification Whenever a context is reset due to HWR, timeout, or unrecoverable fatal OOM error (GUILTY_LOCKUP, INNOCENT_LOCKUP, GUILTY_OVERRUNING, INNOCENT_OVERRUNING, HARD_CONTEXT_SWITCH, GPU_ECC_HWR)
DEBUG_DUMP 0x2ABC006A (106) — Emitted upon detecting HWR respecting osinit.hwr_debug_dump_limit (or ROGUE_FWIF_HWR_DEBUG_DUMP_ALL = 99999 for unlimited), requesting the Linux driver to capture a state/register dump
UPDATE_STATS 0x2ABC006B (107) cmd_update_stats_data Asynchronous context statistics update (e.g., per-process CSW / OOM / reset counters)
CORE_CLK_RATE_CHANGE 0x2ABC006C (108) cmd_core_clk_rate_change Core clock rate change notification (when applicable to the PDVFS/DVFS flow)
REQUEST_GPU_RESTART 0x2ABC006D (109) — Unrecoverable hardware error (e.g., persistent failure in HWR soft reset after exhausting retries or fatal poll): requests a full GPU hard reset from the host
CONTEXT_FW_PF_NOTIFICATION 0x2ABC0070 (112) cmd_fw_pagefault Page fault notification in the firmware memory context

Note on APM (POW_IDLE): In the mainline contract (pvr_power.c), idle notification for APM does not use a dedicated FWCCB command: the firmware updates sysdata.pow_state = ROGUE_FWIF_POW_IDLE, ensures memory visibility, and triggers the host interrupt (hwirq 75); the driver observes pow_state == ROGUE_FWIF_POW_IDLE with an idle KCCB and sends KCCB_CMD_POW (ROGUE_FWIF_POW_OFF_REQ).


3. Reentrancy Rules and Emission Context ([D])