drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c- Extension
.c- Size
- 6445 bytes
- Lines
- 256
- 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.hsubdev/bar.h
Detected Declarations
function filesfunction nvkm_instobj_savefunction nvkm_instobj_dtorfunction nvkm_instobj_ctorfunction nvkm_instobj_wrapfunction nvkm_instobj_newfunction nvkm_instmem_rd32function nvkm_instmem_wr32function nvkm_instmem_bootfunction nvkm_instmem_finifunction nvkm_instmem_initfunction nvkm_instmem_oneinitfunction nvkm_instmem_dtorfunction nvkm_instmem_ctor
Annotated Snippet
if (unlikely(!map)) {
for (offset = 0; offset < size; offset += 4)
nvkm_wo32(memory, offset, 0x00000000);
} else {
memset_io(map, 0x00, size);
}
nvkm_done(memory);
}
container_of(memory, struct nvkm_instobj, memory)->preserve = preserve;
done:
if (ret)
nvkm_memory_unref(&memory);
*pmemory = memory;
return ret;
}
/******************************************************************************
* instmem subdev base implementation
*****************************************************************************/
u32
nvkm_instmem_rd32(struct nvkm_instmem *imem, u32 addr)
{
return imem->func->rd32(imem, addr);
}
void
nvkm_instmem_wr32(struct nvkm_instmem *imem, u32 addr, u32 data)
{
return imem->func->wr32(imem, addr, data);
}
void
nvkm_instmem_boot(struct nvkm_instmem *imem)
{
/* Separate bootstrapped objects from normal list, as we need
* to make sure they're accessed with the slowpath on suspend
* and resume.
*/
struct nvkm_instobj *iobj, *itmp;
spin_lock(&imem->lock);
list_for_each_entry_safe(iobj, itmp, &imem->list, head) {
list_move_tail(&iobj->head, &imem->boot);
}
spin_unlock(&imem->lock);
}
static int
nvkm_instmem_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
{
struct nvkm_instmem *imem = nvkm_instmem(subdev);
int ret;
if (suspend) {
if (imem->func->suspend) {
ret = imem->func->suspend(imem);
if (ret)
return ret;
}
imem->suspend = true;
}
if (imem->func->fini)
imem->func->fini(imem);
return 0;
}
static int
nvkm_instmem_init(struct nvkm_subdev *subdev)
{
struct nvkm_instmem *imem = nvkm_instmem(subdev);
if (imem->suspend) {
if (imem->func->resume)
imem->func->resume(imem);
imem->suspend = false;
return 0;
}
nvkm_bar_bar2_init(subdev->device);
return 0;
}
static int
nvkm_instmem_oneinit(struct nvkm_subdev *subdev)
{
Annotation
- Immediate include surface: `priv.h`, `subdev/bar.h`.
- Detected declarations: `function files`, `function nvkm_instobj_save`, `function nvkm_instobj_dtor`, `function nvkm_instobj_ctor`, `function nvkm_instobj_wrap`, `function nvkm_instobj_new`, `function nvkm_instmem_rd32`, `function nvkm_instmem_wr32`, `function nvkm_instmem_boot`, `function nvkm_instmem_fini`.
- 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.