drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c- Extension
.c- Size
- 21708 bytes
- Lines
- 834
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.hcgrp.hchan.hchid.hrunl.hrunq.hcore/gpuobj.hsubdev/mc.hsubdev/mmu.hsubdev/top.hnvif/class.hnvif/if900d.h
Detected Declarations
struct gk104_engn_statusfunction filesfunction gk104_chan_startfunction gk104_chan_unbindfunction gk104_chan_bind_instfunction gk104_chan_bindfunction gk104_chan_ramfc_writefunction gk104_ectx_bindfunction gk104_ectx_ctorfunction gk104_engn_statusfunction gk104_engn_cxidfunction gk104_engn_chswfunction gk104_runq_idlefunction gk104_runq_intr_1function gk104_runq_intrfunction gk104_runq_initfunction gk104_runq_runmfunction gk104_runl_fault_clearfunction gk104_runl_allowfunction gk104_runl_blockfunction gk104_runl_pendingfunction gk104_runl_commitfunction gk104_runl_insert_chanfunction gk104_fifo_intr_bindfunction gk104_fifo_intr_chswfunction gk104_fifo_intr_dropped_faultfunction gk104_fifo_intr_runlistfunction nvkm_runl_foreach_condfunction gk104_fifo_intrfunction gk104_fifo_init_pbdmasfunction gk104_fifo_initfunction gk104_fifo_runl_ctorfunction nvkm_list_foreachfunction nvkm_runq_foreach_condfunction gk104_fifo_chid_nrfunction gk104_fifo_new
Annotated Snippet
struct gk104_engn_status {
bool busy;
bool faulted;
bool chsw;
bool save;
bool load;
struct {
bool tsg;
u32 id;
} prev, next, *chan;
};
static void
gk104_engn_status(struct nvkm_engn *engn, struct gk104_engn_status *status)
{
u32 stat = nvkm_rd32(engn->runl->fifo->engine.subdev.device, 0x002640 + (engn->id * 0x08));
status->busy = !!(stat & 0x80000000);
status->faulted = !!(stat & 0x40000000);
status->next.tsg = !!(stat & 0x10000000);
status->next.id = (stat & 0x0fff0000) >> 16;
status->chsw = !!(stat & 0x00008000);
status->save = !!(stat & 0x00004000);
status->load = !!(stat & 0x00002000);
status->prev.tsg = !!(stat & 0x00001000);
status->prev.id = (stat & 0x00000fff);
status->chan = NULL;
if (status->busy && status->chsw) {
if (status->load && status->save) {
if (nvkm_engine_chsw_load(engn->engine))
status->chan = &status->next;
else
status->chan = &status->prev;
} else
if (status->load) {
status->chan = &status->next;
} else {
status->chan = &status->prev;
}
} else
if (status->load) {
status->chan = &status->prev;
}
ENGN_DEBUG(engn, "%08x: busy %d faulted %d chsw %d save %d load %d %sid %d%s-> %sid %d%s",
stat, status->busy, status->faulted, status->chsw, status->save, status->load,
status->prev.tsg ? "tsg" : "ch", status->prev.id,
status->chan == &status->prev ? "*" : " ",
status->next.tsg ? "tsg" : "ch", status->next.id,
status->chan == &status->next ? "*" : " ");
}
int
gk104_engn_cxid(struct nvkm_engn *engn, bool *cgid)
{
struct gk104_engn_status status;
gk104_engn_status(engn, &status);
if (status.chan) {
*cgid = status.chan->tsg;
return status.chan->id;
}
return -ENODEV;
}
bool
gk104_engn_chsw(struct nvkm_engn *engn)
{
struct gk104_engn_status status;
gk104_engn_status(engn, &status);
if (status.busy && status.chsw)
return true;
return false;
}
const struct nvkm_engn_func
gk104_engn = {
.chsw = gk104_engn_chsw,
.cxid = gk104_engn_cxid,
.mmu_fault_trigger = gf100_engn_mmu_fault_trigger,
.mmu_fault_triggered = gf100_engn_mmu_fault_triggered,
.ctor = gk104_ectx_ctor,
.bind = gk104_ectx_bind,
};
const struct nvkm_engn_func
Annotation
- Immediate include surface: `priv.h`, `cgrp.h`, `chan.h`, `chid.h`, `runl.h`, `runq.h`, `core/gpuobj.h`, `subdev/mc.h`.
- Detected declarations: `struct gk104_engn_status`, `function files`, `function gk104_chan_start`, `function gk104_chan_unbind`, `function gk104_chan_bind_inst`, `function gk104_chan_bind`, `function gk104_chan_ramfc_write`, `function gk104_ectx_bind`, `function gk104_ectx_ctor`, `function gk104_engn_status`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.