drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c- Extension
.c- Size
- 4415 bytes
- Lines
- 190
- 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.
- 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
engine.hgpu.hcore/object.hengine/fifo/chan.h
Detected Declarations
struct nvkm_rm_enginestruct nvkm_rm_engine_objfunction nvkm_rm_engine_obj_dtorfunction nvkm_rm_engine_obj_newfunction nvkm_rm_engine_obj_ctorfunction nvkm_rm_engine_dtorfunction nvkm_rm_engine_ctorfunction nvkm_rm_engine_new_function nvkm_rm_engine_new
Annotated Snippet
struct nvkm_rm_engine {
struct nvkm_engine engine;
struct nvkm_engine_func func;
};
struct nvkm_rm_engine_obj {
struct nvkm_object object;
struct nvkm_gsp_object rm;
};
static void*
nvkm_rm_engine_obj_dtor(struct nvkm_object *object)
{
struct nvkm_rm_engine_obj *obj = container_of(object, typeof(*obj), object);
nvkm_gsp_rm_free(&obj->rm);
return obj;
}
static const struct nvkm_object_func
nvkm_rm_engine_obj = {
.dtor = nvkm_rm_engine_obj_dtor,
};
int
nvkm_rm_engine_obj_new(struct nvkm_gsp_object *chan, int chid, const struct nvkm_oclass *oclass,
struct nvkm_object **pobject)
{
struct nvkm_rm *rm = chan->client->gsp->rm;
const int inst = oclass->engine->subdev.inst;
const u32 class = oclass->base.oclass;
const u32 handle = oclass->handle;
struct nvkm_rm_engine_obj *obj;
int ret;
obj = kzalloc_obj(*obj);
if (!obj)
return -ENOMEM;
switch (oclass->engine->subdev.type) {
case NVKM_ENGINE_CE:
ret = rm->api->ce->alloc(chan, handle, class, inst, &obj->rm);
break;
case NVKM_ENGINE_GR:
ret = nvkm_gsp_rm_alloc(chan, handle, class, 0, &obj->rm);
break;
case NVKM_ENGINE_NVDEC:
ret = rm->api->nvdec->alloc(chan, handle, class, inst, &obj->rm);
break;
case NVKM_ENGINE_NVENC:
ret = rm->api->nvenc->alloc(chan, handle, class, inst, &obj->rm);
break;
case NVKM_ENGINE_NVJPG:
ret = rm->api->nvjpg->alloc(chan, handle, class, inst, &obj->rm);
break;
case NVKM_ENGINE_OFA:
ret = rm->api->ofa->alloc(chan, handle, class, inst, &obj->rm);
break;
default:
ret = -EINVAL;
WARN_ON(1);
break;
}
if (ret) {
kfree(obj);
return ret;
}
nvkm_object_ctor(&nvkm_rm_engine_obj, oclass, &obj->object);
*pobject = &obj->object;
return 0;
}
static int
nvkm_rm_engine_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
struct nvkm_object **pobject)
{
struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
return nvkm_rm_engine_obj_new(&chan->rm.object, chan->id, oclass, pobject);
}
static void *
nvkm_rm_engine_dtor(struct nvkm_engine *engine)
{
kfree(engine->func);
return engine;
}
Annotation
- Immediate include surface: `engine.h`, `gpu.h`, `core/object.h`, `engine/fifo/chan.h`.
- Detected declarations: `struct nvkm_rm_engine`, `struct nvkm_rm_engine_obj`, `function nvkm_rm_engine_obj_dtor`, `function nvkm_rm_engine_obj_new`, `function nvkm_rm_engine_obj_ctor`, `function nvkm_rm_engine_dtor`, `function nvkm_rm_engine_ctor`, `function nvkm_rm_engine_new_`, `function nvkm_rm_engine_new`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.