mirror of
https://github.com/UniXNU/NativeAdreno.git
synced 2026-11-17 04:51:59 +03:00
1105b0ec8c
A thread checks the ring every 500 ms as msm's hangcheck_handler does: no fence progress with work pending and no CP progress (a6xx_progress, at most three retries) is a hang. Recovery follows recover_worker: the hung job's VM takes the fault and, unless it is the kernel's, becomes unusable; the fence moves past it; the board's restart hook resets the GPU and runs hw_init and CP init on the same ring; every later job is replayed with its own fence. Clients read the global fault count plus their own VM's, so only the guilty client sees its device lost. The ring gains restart, unfenced submission, a6xx_idle, progress state and the GBIF bus halt; CP init can run unfenced.
39 lines
2.1 KiB
C++
39 lines
2.1 KiB
C++
/* SPDX-License-Identifier: MIT */
|
|
#ifndef NATIVE_ADRENO_CPINIT_H
|
|
#define NATIVE_ADRENO_CPINIT_H
|
|
#include "NativeAdrenoRing.h"
|
|
struct NativeAdrenoCpInitConfig {
|
|
uint64_t sqe_iova; /* CP_SQE_INSTR_BASE, 4 KiB aligned, nonzero */
|
|
uint64_t pwrup_reglist_iova; /* Power-up register list, 4-byte aligned */
|
|
/* Nonzero when the caller already wrote CP_SQE_INSTR_BASE before CP_SQE_CNTL, as a6xx hw_init does: the base is
|
|
* then read back and compared instead of rewritten after the SQE started. */
|
|
uint32_t sqe_base_programmed;
|
|
};
|
|
/* One-shot A7XX command-processor start sequence, not a GPU power or reset
|
|
* driver. The caller must have completed GMU boot, powered GX/core clocks,
|
|
* released the CP reset, loaded and hash-verified the SQE microcode into the
|
|
* real IOVA given here, and hold exclusive MMIO. This programs
|
|
* CP_SQE_INSTR_BASE, then submits the pinned a7xx_cp_init sequence directly
|
|
* through the ring: CP_THREAD_CONTROL with concurrent binning disabled and
|
|
* CP_ME_INIT with the Linux mask, hardware-context count, operation mode and
|
|
* power-up register list. Completion is the ring timestamp fence, so a hung
|
|
* CP is reported as a timeout instead of a fabricated success. A second call
|
|
* cannot re-initialize the same object. */
|
|
class NativeAdrenoCpInit final {
|
|
bool done_=false,poisoned_=false;
|
|
IOReturn poison();
|
|
public:
|
|
NativeAdrenoCpInit()=default;
|
|
~NativeAdrenoCpInit()=default;
|
|
NativeAdrenoCpInit(const NativeAdrenoCpInit &)=delete;
|
|
NativeAdrenoCpInit &operator=(const NativeAdrenoCpInit &)=delete;
|
|
/* fenced false: the words go without a timestamp fence (*fence 0) and the caller waits with NativeAdrenoRing::idle, as a7xx_cp_init
|
|
* does with a6xx_idle; the restart after a hang uses it so the replayed submissions keep their fence numbers. */
|
|
IOReturn run(const NativeAdrenoRingIo *,NativeAdrenoRing *,
|
|
const NativeAdrenoCpInitConfig *,uint32_t *fence,bool fenced=true);
|
|
bool completed() const {return done_;}
|
|
bool poisoned() const {return poisoned_;}
|
|
static uint32_t meInitMask();
|
|
};
|
|
#endif
|