include/fwif.h — Host interface structures

The host/firmware shared-memory interface: the subset this firmware uses.

Layouts follow the public upstream interface (drm/imagination pvr_rogue_fwif*.h); every offset used here is checked with static_assert against the values listed in the public check headers. Each structure names its public counterpart; fields keep the public names without their type prefixes.

type fwaddr_t

A firmware (MIPS) address in the 0xC0xxxxxx heap window, as the host writes it.

ROGUE_CMD_MAGIC_DWORD

Magic value in the upper half of every KCCB, FWCCB and client CCB command type.

ROGUE_CMD_MAGIC(id)

Build a command type from a command ID.

Parameters:
  • id – The command ID.

Returns:

ROGUE_CMD_MAGIC_DWORD << 16 | id.

ROGUE_CCB_TYPE_TASK

Client CCB command type flag: the command is a task for a data master.

enum [anonymous]

Kernel CCB command IDs (rogue_fwif_kccb_cmd_type).

KCCB_RTN_CMD_EXECUTED

KCCB return slot: the command was executed.

KCCB_RTN_CLEANUP_BUSY

KCCB return slot: the resource to clean up is still in use; the host retries.

KCCB_RTN_POLL_FAILURE

KCCB return slot: a register poll failed.

enum [anonymous]

Firmware CCB command IDs (rogue_fwif_fwccb_cmd_type).

enum [anonymous]

Client CCB command IDs (rogue_fwif_ccb_cmd_type, without the flag bits).

enum [anonymous]

Firmware power states (rogue_fwif_pow_state).

enum [anonymous]

KCCB POW request types.

enum [anonymous]

Arguments of a POW_FORCED_IDLE_REQ.

enum [anonymous]

KCCB CLEANUP resource types (rogue_fwif_cleanup_type). The public enum has no explicit values, so it starts at 0 (FW 0002: it was numbered from 1, and every cleanup was taken for the next type).

HWR_HARDWARE_OK

sysdata.hwr_state_flags: the hardware is healthy.

HWR_RESET_IN_PROGRESS

hwr_state_flags: a recovery is in progress.

HWR_GENERAL_LOCKUP

hwr_state_flags: the recovery is for a lockup.

HWR_DM_RUNNING_OK

hwr_state_flags: the data masters run normally.

HWR_DM_STALLING

hwr_state_flags: a data master is stalling.

HWR_FW_FAULT

hwr_state_flags: the firmware took a fatal exception.

HWR_RESTART_REQUESTED

hwr_state_flags: a GPU restart was requested.

SYNC_CHECKPOINT_ACTIVE

Sync checkpoint value: not signalled yet.

SYNC_CHECKPOINT_SIGNALED

Sync checkpoint value: signalled.

SYNC_CHECKPOINT_ERRORED

Sync checkpoint value: errored (satisfies a fence too).

UFO_ADDR_IS_SYNC_CHECKPOINT

UFO address bit: the address is a sync checkpoint, not a counter.

enum [anonymous]

Data masters (PVR_FWIF_DM_*): the index of dms.

struct ccb_ctl

Control block of the Kernel CCB and the Firmware CCB (rogue_fwif_ccb_ctl).

volatile uint32_t write_offset

Written by the producer.

uint32_t pad0[31]

Keeps the two offsets in separate cache lines.

volatile uint32_t read_offset

Written by the consumer.

uint32_t wrap_mask

Ring size in commands, minus one.

uint32_t cmd_size

Command size in bytes.

uint32_t pad1

Padding.

struct cccb_ctl

Control block of a client CCB (rogue_fwif_cccb_ctl); offsets in bytes.

volatile uint32_t write_offset

Written by the host.

volatile uint32_t read_offset

The next command the firmware consumes.

volatile uint32_t dep_offset

The command the context waits on (for the host’s debug dump).

uint32_t wrap_mask

Ring size in bytes, minus one.

struct kick_data

A KCCB kick (rogue_fwif_kccb_cmd_kick_data).

fwaddr_t context_fw_addr

The context whose client CCB has new commands.

uint32_t client_woff_update

The client CCB’s new write offset.

uint32_t client_wrap_mask_update

The client CCB’s wrap mask.

uint32_t num_cleanup_ctl

Number of cleanup control blocks.

fwaddr_t cleanup_ctl_fw_addr[3]

Cleanup control blocks of the resources the commands use.

struct kccb_cmd

A Kernel CCB command (rogue_fwif_kccb_cmd, 88 bytes).

uint32_t cmd_type

ROGUE_CMD_MAGIC(KCCB_*).

uint32_t kccb_flags

Command flags.

union [anonymous]

The command’s data, by type.

struct [anonymous]

rogue_fwif_zsbuffer_backing_data: the buffer, and whether the host succeeded.

struct [anonymous]

rogue_fwif_freelists_reconstruction_data: the rebuilt free lists.

struct fwccb_cmd

A Firmware CCB command (rogue_fwif_fwccb_cmd, 88 bytes).

uint32_t cmd_type

ROGUE_CMD_MAGIC(FWCCB_*).

uint32_t fwccb_flags

Command flags.

uint32_t data[20]

The command’s data.

struct osinit

Per-OS initialisation data (rogue_fwif_osinit): the CCBs, the HWR buffer and osdata.

struct sysinit

System initialisation data (rogue_fwif_sysinit): the fault page, the PDS and USC execution bases, the runtime configuration, trace, sysdata and utilisation buffers, and the firmware_started handshake.

struct runtime_cfg

Runtime configuration written by the host (rogue_fwif_runtime_cfg): clock, dusts.

struct sysdata

System data the firmware reports (rogue_fwif_sysdata): power and HWR state, faults, polls.

struct osdata

Per-OS data the firmware reports (rogue_fwif_osdata): interrupt count, KCCB count, power sync.

struct tracebuf_space

One thread’s trace ring (rogue_fwif_tracebuf_space).

struct tracebuf

Trace control (rogue_fwif_tracebuf): the enabled log groups and the rings.

INICFG_DISABLE_DM_OVERLAP

sysdata.config_flags: do not overlap data masters.

struct dllist_node

A firmware list node (rogue_fwif_dllist_node); not used by this firmware.

struct ufo

A UFO: a fence or update on a counter or sync checkpoint (rogue_fwif_ufo).

fwaddr_t addr

Firmware address, with UFO_ADDR_IS_SYNC_CHECKPOINT for a checkpoint.

uint32_t value

The value to wait for, write or add.

struct fwcommoncontext

The part common to every firmware context (rogue_fwif_fwcommoncontext): its client CCB, data master, priority, deadline, memory context and PID.

struct cdm_registers_cswitch

Compute context-switch programs (rogue_fwif_cdm_registers_cswitch).

struct fwcomputecontext

A compute context (rogue_fwif_fwcomputecontext).

struct fwmemcontext

A GPU memory context (rogue_fwif_fwmemcontext).

uint64_t pc_dev_paddr

Bus address of the page catalogue.

uint32_t page_cat_base_reg_set

The BIF slot the firmware bound it to.

struct ccb_cmd_header

Header of a client CCB command (rogue_fwif_ccb_cmd_header); the command follows.

uint32_t cmd_type

ROGUE_CMD_MAGIC(CCB_CMD_*), with ROGUE_CCB_TYPE_TASK for a task.

uint32_t cmd_size

Size of the command after the header, in bytes.

uint32_t ext_job_ref

Job reference reported to the host.

uint32_t int_job_ref

Internal job reference.

uint32_t work_est[6]

Work estimation data (not used).

struct cleanup_ctl

Cleanup control block (rogue_fwif_cleanup_ctl): a resource may be freed once executed_commands reaches submitted_commands.

struct compute_regs

Registers of a compute command (rogue_fwif_compute_regs).

struct cmd_compute

A compute command (rogue_fwif_cmd_compute).

struct transfer_regs

Registers of a transfer command (rogue_fwif_transfer_regs).

struct cmd_transfer

A transfer command, the TQ_3D payload (rogue_fwif_cmd_transfer, 192 bytes).

struct time_corr

A time-correlation entry (rogue_fwif_time_corr).

TIME_CORR_ARRAY_SIZE

Entries in time_corr[].

CRDELTA_ACCURACY_SHIFT

Fixed-point shift of the timer-to-nanoseconds factor.

GPU_UTIL_STATE_IDLE

Utilisation state: idle.

GPU_UTIL_STATE_ACTIVE

Utilisation state: work runs or waits.

GPU_UTIL_STATE_BLOCKED

Utilisation state: work is held back (forced idle).

GPU_UTIL_STATE_MASK

The state bits of last_word; the rest is the time in ns.

struct gpu_util_fwcb

Utilisation control block (rogue_fwif_gpu_util_fwcb).

HWRTYPE_OVERRUN

HWR log type: a data master overran its deadline.

HWRTYPE_BIF0FAULT

HWR log type: an MMU fault on BIF bank 0.

FW_DM_MAX

Size of the per-DM counters in the HWR buffer (PVR_FWIF_DM_MAX).

struct hwrinfo

An HWR log entry (rogue_hwrinfo with the rogue_bifinfo union member).

HWINFO_MAX_FIRST

HWR log entries kept forever.

HWINFO_MAX

HWR log entries in all; the last 8 form a ring.

struct hwrinfobuf

The HWR log and per-DM counters (rogue_fwif_hwrinfobuf).

FWCCB_CMD_CONTEXT_RESET_NOTIFICATION

FWCCB command ID of a context reset notification.

CONTEXT_RESET_FLAG_PF

Context reset flag: the job hit a page fault.

CONTEXT_RESET_REASON_GUILTY_LOCKUP

Context reset reason: the context locked up (used for page faults).

CONTEXT_RESET_REASON_GUILTY_OVERRUNING

Context reset reason: the context overran its deadline.

struct fwccb_context_reset

Data of a context reset notification (rogue_fwif_fwccb_cmd_context_reset_data).