drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c- Extension
.c- Size
- 1963 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.
- 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
gr.hengine/fifo.hengine/gr/priv.h
Detected Declarations
function Copyrightfunction nvkm_rm_gr_finifunction nvkm_rm_gr_initfunction nvkm_rm_gr_new
Annotated Snippet
#include "gr.h"
#include <engine/fifo.h>
#include <engine/gr/priv.h>
static int
nvkm_rm_gr_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
struct nvkm_object **pobject)
{
struct r535_gr_chan *chan = container_of(oclass->parent, typeof(*chan), object);
return nvkm_rm_engine_obj_new(&chan->chan->rm.object, chan->chan->id, oclass, pobject);
}
static int
nvkm_rm_gr_fini(struct nvkm_gr *base, bool suspend)
{
struct nvkm_rm *rm = base->engine.subdev.device->gsp->rm;
struct r535_gr *gr = container_of(base, typeof(*gr), base);
if (rm->api->gr->scrubber.fini)
rm->api->gr->scrubber.fini(gr);
return 0;
}
static int
nvkm_rm_gr_init(struct nvkm_gr *base)
{
struct nvkm_rm *rm = base->engine.subdev.device->gsp->rm;
struct r535_gr *gr = container_of(base, typeof(*gr), base);
int ret;
if (rm->api->gr->scrubber.init) {
ret = rm->api->gr->scrubber.init(gr);
if (ret)
return ret;
}
return 0;
}
int
nvkm_rm_gr_new(struct nvkm_rm *rm)
{
const u32 classes[] = {
rm->gpu->gr.class.i2m,
rm->gpu->gr.class.twod,
rm->gpu->gr.class.threed,
rm->gpu->gr.class.compute,
};
struct nvkm_gr_func *func;
struct r535_gr *gr;
func = kzalloc_flex(*func, sclass, ARRAY_SIZE(classes) + 1);
if (!func)
return -ENOMEM;
func->dtor = r535_gr_dtor;
func->oneinit = r535_gr_oneinit;
func->init = nvkm_rm_gr_init;
func->fini = nvkm_rm_gr_fini;
func->units = r535_gr_units;
func->chan_new = r535_gr_chan_new;
for (int i = 0; i < ARRAY_SIZE(classes); i++) {
func->sclass[i].oclass = classes[i];
func->sclass[i].minver = -1;
func->sclass[i].maxver = 0;
func->sclass[i].ctor = nvkm_rm_gr_obj_ctor;
}
gr = kzalloc_obj(*gr);
if (!gr) {
kfree(func);
return -ENOMEM;
}
nvkm_gr_ctor(func, rm->device, NVKM_ENGINE_GR, 0, true, &gr->base);
gr->scrubber.chid = -1;
rm->device->gr = &gr->base;
return 0;
}
Annotation
- Immediate include surface: `gr.h`, `engine/fifo.h`, `engine/gr/priv.h`.
- Detected declarations: `function Copyright`, `function nvkm_rm_gr_fini`, `function nvkm_rm_gr_init`, `function nvkm_rm_gr_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.