drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c- Extension
.c- Size
- 7313 bytes
- Lines
- 276
- 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
priv.hcore/ramht.hsubdev/bar.h
Detected Declarations
struct nv04_instmemstruct nv04_instobjfunction nv04_instobj_wr32function nv04_instobj_rd32function nv04_instobj_releasefunction nv04_instobj_sizefunction nv04_instobj_addrfunction nv04_instobj_targetfunction nv04_instobj_dtorfunction nv04_instobj_newfunction nv04_instmem_rd32function nv04_instmem_wr32function nv04_instmem_resumefunction list_for_each_entryfunction list_for_each_entryfunction nv04_instmem_suspendfunction list_for_each_entryfunction list_for_each_entryfunction nv04_instmem_oneinitfunction nv04_instmem_dtorfunction nv04_instmem_new
Annotated Snippet
struct nv04_instmem {
struct nvkm_instmem base;
struct nvkm_mm heap;
};
/******************************************************************************
* instmem object implementation
*****************************************************************************/
#define nv04_instobj(p) container_of((p), struct nv04_instobj, base.memory)
struct nv04_instobj {
struct nvkm_instobj base;
struct nv04_instmem *imem;
struct nvkm_mm_node *node;
};
static void
nv04_instobj_wr32(struct nvkm_memory *memory, u64 offset, u32 data)
{
struct nv04_instobj *iobj = nv04_instobj(memory);
struct nvkm_device *device = iobj->imem->base.subdev.device;
nvkm_wr32(device, 0x700000 + iobj->node->offset + offset, data);
}
static u32
nv04_instobj_rd32(struct nvkm_memory *memory, u64 offset)
{
struct nv04_instobj *iobj = nv04_instobj(memory);
struct nvkm_device *device = iobj->imem->base.subdev.device;
return nvkm_rd32(device, 0x700000 + iobj->node->offset + offset);
}
static const struct nvkm_memory_ptrs
nv04_instobj_ptrs = {
.rd32 = nv04_instobj_rd32,
.wr32 = nv04_instobj_wr32,
};
static void
nv04_instobj_release(struct nvkm_memory *memory)
{
}
static void __iomem *
nv04_instobj_acquire(struct nvkm_memory *memory)
{
struct nv04_instobj *iobj = nv04_instobj(memory);
struct nvkm_device *device = iobj->imem->base.subdev.device;
return device->pri + 0x700000 + iobj->node->offset;
}
static u64
nv04_instobj_size(struct nvkm_memory *memory)
{
return nv04_instobj(memory)->node->length;
}
static u64
nv04_instobj_addr(struct nvkm_memory *memory)
{
return nv04_instobj(memory)->node->offset;
}
static enum nvkm_memory_target
nv04_instobj_target(struct nvkm_memory *memory)
{
return NVKM_MEM_TARGET_INST;
}
static void *
nv04_instobj_dtor(struct nvkm_memory *memory)
{
struct nv04_instobj *iobj = nv04_instobj(memory);
mutex_lock(&iobj->imem->base.mutex);
nvkm_mm_free(&iobj->imem->heap, &iobj->node);
mutex_unlock(&iobj->imem->base.mutex);
nvkm_instobj_dtor(&iobj->imem->base, &iobj->base);
return iobj;
}
static const struct nvkm_memory_func
nv04_instobj_func = {
.dtor = nv04_instobj_dtor,
.target = nv04_instobj_target,
.size = nv04_instobj_size,
.addr = nv04_instobj_addr,
.acquire = nv04_instobj_acquire,
.release = nv04_instobj_release,
};
Annotation
- Immediate include surface: `priv.h`, `core/ramht.h`, `subdev/bar.h`.
- Detected declarations: `struct nv04_instmem`, `struct nv04_instobj`, `function nv04_instobj_wr32`, `function nv04_instobj_rd32`, `function nv04_instobj_release`, `function nv04_instobj_size`, `function nv04_instobj_addr`, `function nv04_instobj_target`, `function nv04_instobj_dtor`, `function nv04_instobj_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.