Commit Graph

13 Commits

  • fix(submit): count the BV thread's progress as GPU progress
    With concurrent binning BR waits for the visibility pass that BV runs,
    so BR's ring and IB words stand still while the GPU works. The hang
    check and the stall handler read the BV read pointer, IB bases and
    dwords left as well, and treat a change in them as progress.
  • feat(preempt): give up a second ring the CP cannot reach
    A switch that does not complete, a trigger whose register writes were
    refused, or a low-ring job left waiting with the high ring idle ends the
    second ring for good. recover() then starts from the oldest job that never
    ran and replays it on the first ring, whichever ring it sat on, so a
    broken switch costs the background work and not the session.
    
    Ring 0 is the high ring: ring 1 is only switched to when ring 0 has no
    pending job, or the low job has waited PreemptAgingUs. Only priorities 2
    and 3 take ring 1.
    
    A ring the CP does not run keeps its write pointer for the switch to
    give, and every framed submission on a ring with a preemption record ends
    with the yield.
    
    The preemption record keeps what the CP saved into it; only the write
    pointer is rewritten before a switch.
    
    The switch log records the registers and both records around each switch,
    and a switch that times out carries the CP's IB state.
  • feat(gpu): CP preemption between two rings (A1)
    Add hardware CP context switch via CP_CONTEXT_SWITCH_CNTL on a second
    ring. Use a conservative BO-disjoint rule: only allow a queued job to
    preempt the running ring when their buffer sets share no handle. Two
    4192 KiB preemption records and two a7xx_cp_smmu_info pages are mapped
    at fixed IOVAs. Ring priority comes from the kernel GPU role of the
    submitting task (BACKGROUND/UTILITY → ring 1, UI/focal/realtime → ring 0).
    Diagnostics gated on sheng-diag=1; feature gated on sheng-gpu-preempt=1.
  • feat(adreno): job timeline, stall ring and CP counter stamps
    Framed submissions stamp the CP always-on counter before and after their buffers (sheng-gpu-timeline, default on); the retired jobs, the stall handler's actions and a ring status word are kept for the boot export. Drops the large-import record. Host tests cover the stamps and the shim symbols.
  • feat(adreno): msm hangcheck and GPU restart with replay
    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.
  • perf(adreno): count cache maintenance per phase and skip uncached imports
    Phase counters for the pool, allocate, map, submit, unmap, complete and table passes. Imports the owner maps uncached need no maintenance. Process page tables come from cacheable blocks with the walk coherence proved at board start, so a table page is ordered instead of cleaned. A freed BO whose first pages a user task still maps is counted. Submit records, handle index and user client changes of the iPadOS 27 bring-up are included.
  • fix(ring): write WPTR as a fenced register and keep the ring's register window alive
    The ring kept a pointer to a register window on the stack of the service's
    start routine. The window is a service member now. WPTR writes check the
    GMU AHB fence status and are given again while it reports the write
    dropped.
  • feat(submit): drain the GPU bus and re-issue the write pointer when a fence stalls
    After 100 timed-out waits the GPU's translations are dropped and CP_RB_WPTR is written again; after 400 the GBIF client and AXI requests are halted and released as before a GPU reset. The counters are exported for the board log. GPU-written imports are mapped non-coherent and skipped by the per-submission cache work.
  • Import NativeAdreno
    Co-authored-by: rpone <rponeawa@qq.com>