drivers/gpu/drm/nouveau/nvkm/falcon/qmgr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/falcon/qmgr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/falcon/qmgr.c- Extension
.c- Size
- 2616 bytes
- Lines
- 88
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qmgr.h
Detected Declarations
function Copyrightfunction nvkm_falcon_qmgr_seq_releasefunction nvkm_falcon_qmgr_delfunction nvkm_falcon_qmgr_new
Annotated Snippet
#include "qmgr.h"
struct nvkm_falcon_qmgr_seq *
nvkm_falcon_qmgr_seq_acquire(struct nvkm_falcon_qmgr *qmgr)
{
const struct nvkm_subdev *subdev = qmgr->falcon->owner;
struct nvkm_falcon_qmgr_seq *seq;
u32 index;
mutex_lock(&qmgr->seq.mutex);
index = find_first_zero_bit(qmgr->seq.tbl, NVKM_FALCON_QMGR_SEQ_NUM);
if (index >= NVKM_FALCON_QMGR_SEQ_NUM) {
nvkm_error(subdev, "no free sequence available\n");
mutex_unlock(&qmgr->seq.mutex);
return ERR_PTR(-EAGAIN);
}
set_bit(index, qmgr->seq.tbl);
mutex_unlock(&qmgr->seq.mutex);
seq = &qmgr->seq.id[index];
seq->state = SEQ_STATE_PENDING;
return seq;
}
void
nvkm_falcon_qmgr_seq_release(struct nvkm_falcon_qmgr *qmgr,
struct nvkm_falcon_qmgr_seq *seq)
{
/* no need to acquire seq.mutex since clear_bit is atomic */
seq->state = SEQ_STATE_FREE;
seq->callback = NULL;
reinit_completion(&seq->done);
clear_bit(seq->id, qmgr->seq.tbl);
}
void
nvkm_falcon_qmgr_del(struct nvkm_falcon_qmgr **pqmgr)
{
struct nvkm_falcon_qmgr *qmgr = *pqmgr;
if (qmgr) {
kfree(*pqmgr);
*pqmgr = NULL;
}
}
int
nvkm_falcon_qmgr_new(struct nvkm_falcon *falcon,
struct nvkm_falcon_qmgr **pqmgr)
{
struct nvkm_falcon_qmgr *qmgr;
int i;
if (!(qmgr = *pqmgr = kzalloc_obj(*qmgr)))
return -ENOMEM;
qmgr->falcon = falcon;
mutex_init(&qmgr->seq.mutex);
for (i = 0; i < NVKM_FALCON_QMGR_SEQ_NUM; i++) {
qmgr->seq.id[i].id = i;
init_completion(&qmgr->seq.id[i].done);
}
return 0;
}
Annotation
- Immediate include surface: `qmgr.h`.
- Detected declarations: `function Copyright`, `function nvkm_falcon_qmgr_seq_release`, `function nvkm_falcon_qmgr_del`, `function nvkm_falcon_qmgr_new`.
- 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.
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.