bvnc/<bvnc>/seq.c — Per-GPU sequences
Each GPU implements the functions of bvnc_seq.h — Per-BVNC hardware sequences (and
dust_power) in its own src/bvnc/<b.v.n.c>/seq.c, from its own
specification only. The two files use the same function names, so each is
documented under its own C namespace.
BXE-2-32 (36.29.52.182)
Hardware sequences of the BXE-2-32 (36.29.52.182, SpacemiT K1), from
docsClean/BXE-2-32 only: the functions of bvnc_seq.h, plus
dust_power().
-
CR_TPU_FILTER_MODE
TPU filter/truncation mode (boot-gpu-init.md step 9).
-
CR_MULTICORE_COMPUTE_CTRL
Multicore compute control (
MULTICORE_COMPUTE_CTRL_COMMON).
-
CR_ISP_RENDER
ISP_RENDER(public).
-
CR_PIXEL_LAUNCH
Pixel-pipe launch (no public name).
-
CR_TA_CACHE_INIT_FIRST
PM trigger of the first geometry kick (no public name, E043).
-
SOFT_RESET_HWR_LO
CR_SOFT_RESETlow word, first stage of the HWR reset: every GPU unit except the MIPS and MTS wrapper.
-
SOFT_RESET_HWR_HI
CR_SOFT_RESEThigh word, first stage.
-
SOFT_RESET_HWR_LO2
Low-word bits added in the second stage.
-
SOFT_RESET_HWR_HI2
High-word bits added in the second stage.
-
bool dust_power(bool on)
Request a dust power-island transition.
Powering up first marks the dusts active. The request is written, then the firmware waits (10 ms at most) for
POWER_COMPLETE.- Parameters:
on – Power the dusts up (
true) or down.
- Returns:
truewhen the transition completed withoutPOWER_ABORT.
-
bool bvnc_units_init(struct sysinit *si)
Initialise the GPU units (
boot-gpu-init.mdsection A, steps 3-10).Configures the SLC bypass, pulses the unit reset, sets the PDS and USC execution bases, writes the unit defaults before and after the init-done handshakes, and sets the TPU filter mode and the TPU, PBE, ISP and TE defaults.
- Parameters:
si – The host’s
sysinit.
- Returns:
truewhen both init-done polls completed.
-
bool bvnc_hwr_reset(void)
Reset part of a recovery (
hardware-recovery.md, answer to Q29b item 4): stall the BIF and wait for it and the SLC to drain, invalidate the MMU caches, disable partial renders, two-stage soft reset (every unit except the MIPS and MTS wrapper, then the second-stage bits, 10 us, release), re-initialise the units, unstall the BIF, TPU clean-up, SLC flush.- Returns:
a failed poll is traced and the recovery goes on.
- Return type:
true
-
void bvnc_reg_cfg_apply(void)
No register-override list in the BXE-2-32 specification (
REGCONFIGis “not sent by mainline”).
-
bool bvnc_mmu_cache_inval(uint32_t bif_bits, bool pm_tlb)
MMUCACHE(E015): flush and invalidate the SLC first, so that the MMU does not walk stale lines, then the MMU caches, then the PM TLB.- Parameters:
bif_bits –
CR_BIF_CTRL_INVALbits.pm_tlb – Also invalidate the PM TLB.
- Returns:
failed polls are only traced.
- Return type:
true
-
bool bvnc_kick_admit(uint32_t dm, const struct fwcommoncontext *ctx, uint32_t cmd_id, const void *payload)
Every task is admitted when its data master is idle: the overlap rules of
scheduler.mdare not implemented for this GPU yet (the mainline host on the K1 sets noDISABLE_DM_OVERLAP; Mesa sends equal priorities).- Returns:
true.
-
void bvnc_gp_events(uint32_t ev)
Nothing: the BXE-2-32 specification gives no handling for
GPIO_REQorUSC_TRIGGER(routed to DM0, never seen on the K1).- Parameters:
ev – The
CR_EVENT_STATUSbits that were set.
-
void bvnc_pow_off(void)
Nothing beyond the shared state teardown (
power-management.md).
-
void bvnc_dm_cache_flush(uint32_t dm)
Per-job cache flush on completion, before the command is retired.
Follows
kick-compute-and-3d.md“Completion: per-job cache flush” (answer to Q14; geometry values from Q19b): front end, USC, PDS and TPU flushes, the MCU fence for the data master, then an SLC flush. Data masters other than geometry, fragment and compute only flush the SLC.- Parameters:
dm – The data master that finished.
-
void bvnc_tq_launch(uint32_t isp_render)
Start a TQ_3D:
ISP_RENDER, then0x0F00 = 1as the last write (answer to Q14).- Parameters:
isp_render – The
ISP_RENDERvalue (without the resume bit).
-
void bvnc_cdm_multicore_ctrl(const struct cmd_compute *cmd)
MULTICORE_COMPUTE_CTRL_COMMON = (execute_count << 8) | 1(one core).- Parameters:
cmd – The compute command.
-
void bvnc_frag_end_sync(uint32_t ev)
Nothing to wait for: the BXE-2-32 specification has no end-of-render sync.
- Parameters:
ev – The events seen (unused).
-
void bvnc_geom_first_kick_pm(void)
First geometry kick: PM trigger
0x0258and its poll (E043).
BXM-4-64 (36.56.104.183)
Hardware sequences of the BXM-4-64 (36.56.104.183, SpacemiT K3), from
docsClean/BXM-4-64 only: the functions of bvnc_seq.h, plus
dust_power(). Nothing here has run on a K3 yet.
-
CR_CORE_INDEX_COMPUTE
Per-core compute and fragment core-index registers (boot-gpu-init.md section 5.1).
-
CR_CORE_BANK_STRIDE
Stride between the register banks of two cores.
-
CR_MAX_CORE_BANKS
Core banks reachable in the wired register window: the broadcast bank starts at 4 strides (0xCFA00000).
-
CR_MULTICORE_COMPUTE_CTRL
Multicore compute control (
MULTICORE_COMPUTE_CTRL_COMMON).
-
CR_ISP_RENDER
ISP_RENDER(public).
-
CR_PIXEL_LAUNCH
ISP_START_RENDERtrigger (no public name).
-
CR_ISP_ZLSCTL
ISP_ZLSCTL.
-
ZLSCTL_STORE_EN
ISP_ZLSCTLbit 2: a Z/S store is enabled.
-
COMPUTE_FLAG_SINGLE_CORE
ROGUE_COMPUTE_FLAG_SINGLE_CORE(pvr_rogue_fwif_client.h).
-
EV_ISP_ZLS_END
CR_EVENT_STATUSbit 14: end of the Z/S store (ISP_ZLS_END).
-
SOFT_RESET_HWR_LO
CR_SOFT_RESETfirst stage of the HWR reset: the “standard” assert value0xFFEFFFF8F3FFFC1D(power-management.md section 2.2, hardware-recovery.md step 9; see open point 7 ofbvnc.h).
-
SOFT_RESET_HWR_HI
High word of the first stage.
-
SOFT_RESET_HWR_LO2
Low-word bits ORed in: FB_TLCACHE, FBDC, FBC, BIF.
-
SOFT_RESET_HWR_HI2
High-word bits ORed in: PBE, TPU.
-
CR_CLK_CTRL
ROGUE_CR_CLK_CTRL(64-bit).
-
CR_CLK_CTRL_AUX
Auxiliary clock control (no public name).
-
INICFG_DISABLE_CLKGATING_EN
ROGUE_FWIF_INICFG_DISABLE_CLKGATING_EN(pvr_rogue_fwif.h).
-
POWER_REQ_ON
CR_POWER_REQbit 0: power on.
-
POWER_REQ_TRIGGER
CR_POWER_REQbit 1: trigger.
-
POWER_REQ_ALL
CR_POWER_REQbit 9: present in every observed request.
-
POWER_REQ_DUST_SHIFT
CR_POWER_REQbits [24 + d]: dust mask.
-
EV_POWER_DONE
Completion bits of a power request in
CR_EVENT_STATUS.
-
POWER_REQ_TRIES
Attempts of a power request that ends in
POWER_ABORT(a finite limit; the value is ours).
-
HWR_RESET_TRIES
Attempts of the reset of one core in a recovery (hardware-recovery.md section 2.2: “e.g., 3”).
-
REG_CFG_TYPE_PWR_ON
ROGUE_FWIF_REG_CFG_TYPE_PWR_ON: index of its count innum_regs_type.
-
REG_CFG_RECORDS
Offset of
reg_configs[](num_regs_type[8], 8-byte aligned).
-
REG_CFG_RECORD_SIZE
Size of a
rogue_fwif_reg_cfg_rec(sddr,mask,value).
-
REG_CFG_MAX_SIZE
ROGUE_FWIF_REG_CFG_MAX_SIZE.
-
INIT_SET
Operation of a
BVNC_INIT_POST_POLLentry: write the value.
-
INIT_OR
Operation of a
BVNC_INIT_POST_POLLentry: OR the value into the register.
-
static uint32_t num_cores(void)
Number of cores (
ROGUE_CR_MULTICORE_SYSTEM), as the per-core loops of the specification use it.- Returns:
The core count, or 1 when it reads 0 or more than the register window holds.
-
static void timer_tick(void)
Wait for
ROGUE_CR_TIMERto advance by one tick (at most 1 ms).
-
static void clock_gating(void)
Force the clocks on when the host asks for it (
boot-gpu-init.mdsection 2.1,DISABLE_CLKGATING_EN).
-
static uint32_t power_request(uint32_t req)
One power request (
power-management.mdsection 2.3, steps 1-10).Holds the GPU blocks in reset except those the request needs, writes the mask, then the trigger one timer tick later, waits for
POWER_COMPLETEorPOWER_ABORT, releases the reset, clears the request and the events.- Parameters:
req – The request without the trigger bit.
- Returns:
timeout).
- Return type:
The
EV_POWER_COMPLETE/EV_POWER_ABORTbits seen (0
-
bool dust_power(bool on)
Request a dust power-island transition (
power-management.mdsection 2.3).Powering up first forces the clocks on when asked (section 2.1) and marks the dusts active. The request is
DIR | ALL | units | dusts << 24; aPOWER_ABORTis retried. The unit mask isBVNC_POWER_UNITS_MASK: the specification does not give the number of units (open point 6 ofbvnc.h).- Parameters:
on – Power the dusts up (
true) or down.
- Returns:
truewhen the transition completed withoutPOWER_ABORT.
-
static void slc_bypass_from_size(void)
Set the SLC bypass from the SLC size the hardware reports.
boot-gpu-init.mdsection 2.3: withSLC_SIZE_CONFIGURABLEthe size in KiB is read fromBVNC_SLC_SIZE_REG. A small SLC (32 KiB or less, or 0) sets both bypass bits, a medium one sets only the low bit, and 128 KiB or more (the K3) clears both.
-
static void core_indices(void)
Number the cores and open the broadcast to all of them.
boot-gpu-init.mdsection 5.1: coreigets indexiin its compute and fragment core-index registers, thenXPU_BROADCASTselects every core. A core count of 0, or one beyond the register window, is treated as one core.
-
bool bvnc_units_init(struct sysinit *si)
Initialise the GPU units.
boot-gpu-init.mdsections 2.2 to 5.1, after the dusts are powered: MMU cache invalidation, SLC bypass from the SLC size, PDS and USC execution bases,0x6000 = 0, PDS and TPU defaults, the init-done handshakes, the per-unit defaults (plain and ORed writes) with the PBE state table cleared, and the core indices.Not written: the USC and PDS overalloc controls (
0x4050,0x06D8), whose values the specification does not give (open point 3 of the BVNC header); they keep their reset values, as on the BXE-2-32.- Parameters:
si – The host’s
sysinit.
- Returns:
truewhen every poll completed.
-
bool bvnc_hwr_reset(void)
Reset part of a recovery (
hardware-recovery.mdsection 2.2, then section 2.3 step 1 and the0x0338part of step 3).For each core, up to
HWR_RESET_TRIEStimes while a poll fails: select the core, stall the BIF and wait for the PM MMU and external reads to drain, invalidate the MMU caches, drain the wrapper, wait for the sidekick and the SLC to go idle, soft reset (standard value, then the extra bits ORed in), release, run the whole unit initialisation, unstall the BIF, post-HWR TPU/USC block reset, SLC flush. Then the broadcast mask is restored and partial renders are disabled.- Returns:
falseon a fatal failure (MMU invalidation or SLC idle) or when the polls still fail after the last attempt.
-
void bvnc_reg_cfg_apply(void)
Apply the PWR_ON group of the host’s register overrides (
boot-gpu-init.mdsection 6 step 1,sysinit.reg_cfg_fw_addr).The list is
struct rogue_fwif_reg_cfg(pvr_rogue_fwif.h): a count per type, then the records grouped by type,PWR_ONfirst. Each record writesvalueundermask(read-modify-write, a 32-bit word at a time, skipping a word whose mask is 0) to the register at offsetsddr. The mainline host never sets the address.
-
bool bvnc_mmu_cache_inval(uint32_t bif_bits, bool pm_tlb)
MMUCACHE(kernel-ccb.mdsection 3): SLC flush and invalidate (0x10), the MMU caches, the PM/BIF memory when asked (0x1348), each polled, then the wrapper drain.- Parameters:
bif_bits –
CR_BIF_CTRL_INVALbits (flags & 0xF).pm_tlb –
flags & 0x10: also invalidate the PM/BIF memory.
- Returns:
falsewhen a poll timed out (the host then seesPOLL_FAILURE).
-
INICFG_DISABLE_DM_OVERLAP_BIT
ROGUE_FWIF_INICFG_DISABLE_DM_OVERLAP(sysdata.config_flags bit 19).
-
FRAG_FLAG_PREVENT_CDM_OVERLAP
ROGUE_FRAG_FLAGS_PREVENT_CDM_OVERLAP(pvr_rogue_fwif_client.h).
-
COMPUTE_FLAG_PREVENT_ALL_OVERLAP
ROGUE_COMPUTE_FLAG_PREVENT_ALL_OVERLAP(pvr_rogue_fwif_client.h): the public flag mapped to the compute exclusivity bits of scheduler.md 5.3.
-
CMD_FRAG_FLAGS
Offset of
flagsinrogue_fwif_cmd_frag.
-
static bool frag_prevents_cdm
The running 3D task asked to keep compute out (
PREVENT_CDM_OVERLAP).
-
bool bvnc_kick_admit(uint32_t dm, const struct fwcommoncontext *ctx, uint32_t cmd_id, const void *payload)
Kick admission test (
scheduler.mdsection 5).Serialised mode (
DISABLE_DM_OVERLAP): no other data master may run, except a geometry held by an out-of-memory (SPM).Overlapped mode: on one core every data master shares the core, so a task waits while another data master runs a context of strictly higher priority; a 3D task with
PREVENT_CDM_OVERLAPkeeps compute out, and a compute task withPREVENT_ALL_OVERLAPruns alone.
Not implemented: the core partitioning of several cores and the global parameter-buffer check of geometry (one core, one buffer on the K3).
- Parameters:
dm – The data master the task needs (its own is idle).
ctx – The task’s context.
cmd_id – The command type.
payload – The command.
- Returns:
falseto keep the task queued for now.
-
void bvnc_gp_events(uint32_t ev)
USC_TRIGGER(event bit 15,observed-sequences.mdsection 4): clear it and interrupt the host (notify_host()increments the interrupt counter and writesCR[0x08A8] = 1).GPIO_REQ(bit 12) is left alone: its handler is not specified.- Parameters:
ev – The
CR_EVENT_STATUSbits that were set.
-
void bvnc_pow_off(void)
POW_OFFhardware steps (power-management.mdsection 3, steps 2-3): power the dusts down, flush the SLC and wait for it to go idle.
-
void bvnc_dm_cache_flush(uint32_t dm)
Per-job cache flush on completion, before the command is retired.
Follows
data-masters.mdsection 4.1: front end, USC, PDS and TPU flushes, the 3D-only internal caches (0x1470/0x1478/0x1480), the MCU fence for the data master, the wrapper barrier, then an SLC flush. Data masters other than geometry, fragment and compute only flush the SLC.- Parameters:
dm – The data master that finished.
-
void bvnc_tq_launch(uint32_t isp_render)
Start a TQ_3D:
0x0F00 = 1, thenISP_RENDER(kick-compute-and-3d.mdsection 3.1 step 13).- Parameters:
isp_render – The
ISP_RENDERvalue (without the resume bit).
-
void bvnc_cdm_multicore_ctrl(const struct cmd_compute *cmd)
MULTICORE_COMPUTE_CTRL_COMMON(kick-compute-and-3d.mdsection 1.1.1):(execute_count << 8) | core_maskwhen the command may use several cores and there are several,1otherwise.- Parameters:
cmd – The compute command.
-
void bvnc_frag_end_sync(uint32_t ev)
With a Z/S store enabled (
ISP_ZLSCTLbit 2), wait forISP_ZLS_ENDand clear it (kick-compute-and-3d.mdsection 2.2 step 3). The interrupt task clears every event it sees, so anISP_ZLS_ENDthat came with the end of render is taken fromev.- Parameters:
ev – The
CR_EVENT_STATUSbits the interrupt task saw.
-
void bvnc_geom_first_kick_pm(void)
Nothing beyond the shared PM steps:
0x0258is not used (kick-geometry-ta.mdsection 3.1, correction of 2026-11-28).