drivers/gpu/drm/nouveau/nvkm/core/object.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/core/object.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/core/object.c- Extension
.c- Size
- 8016 bytes
- Lines
- 313
- 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
core/object.hcore/client.hcore/engine.h
Detected Declarations
function filesfunction nvkm_object_removefunction nvkm_object_insertfunction nvkm_object_mthdfunction nvkm_object_ntfyfunction nvkm_object_mapfunction nvkm_object_unmapfunction nvkm_object_bindfunction nvkm_object_finifunction nvkm_object_initfunction nvkm_object_dtorfunction nvkm_object_delfunction nvkm_object_ctorfunction nvkm_object_new_function nvkm_object_new
Annotated Snippet
while (node) {
object = rb_entry(node, typeof(*object), node);
if (handle < object->object)
node = node->rb_left;
else
if (handle > object->object)
node = node->rb_right;
else {
spin_unlock_irqrestore(&client->obj_lock, flags);
goto done;
}
}
spin_unlock_irqrestore(&client->obj_lock, flags);
return ERR_PTR(-ENOENT);
} else {
object = &client->object;
}
done:
if (unlikely(func && object->func != func))
return ERR_PTR(-EINVAL);
return object;
}
void
nvkm_object_remove(struct nvkm_object *object)
{
unsigned long flags;
spin_lock_irqsave(&object->client->obj_lock, flags);
if (!RB_EMPTY_NODE(&object->node))
rb_erase(&object->node, &object->client->objroot);
spin_unlock_irqrestore(&object->client->obj_lock, flags);
}
bool
nvkm_object_insert(struct nvkm_object *object)
{
struct rb_node **ptr;
struct rb_node *parent = NULL;
unsigned long flags;
spin_lock_irqsave(&object->client->obj_lock, flags);
ptr = &object->client->objroot.rb_node;
while (*ptr) {
struct nvkm_object *this = rb_entry(*ptr, typeof(*this), node);
parent = *ptr;
if (object->object < this->object) {
ptr = &parent->rb_left;
} else if (object->object > this->object) {
ptr = &parent->rb_right;
} else {
spin_unlock_irqrestore(&object->client->obj_lock, flags);
return false;
}
}
rb_link_node(&object->node, parent, ptr);
rb_insert_color(&object->node, &object->client->objroot);
spin_unlock_irqrestore(&object->client->obj_lock, flags);
return true;
}
int
nvkm_object_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
{
if (likely(object->func->mthd))
return object->func->mthd(object, mthd, data, size);
return -ENODEV;
}
int
nvkm_object_ntfy(struct nvkm_object *object, u32 mthd,
struct nvkm_event **pevent)
{
if (likely(object->func->ntfy))
return object->func->ntfy(object, mthd, pevent);
return -ENODEV;
}
int
nvkm_object_map(struct nvkm_object *object, void *argv, u32 argc,
enum nvkm_object_map *type, u64 *addr, u64 *size)
{
if (likely(object->func->map))
return object->func->map(object, argv, argc, type, addr, size);
return -ENODEV;
}
int
Annotation
- Immediate include surface: `core/object.h`, `core/client.h`, `core/engine.h`.
- Detected declarations: `function files`, `function nvkm_object_remove`, `function nvkm_object_insert`, `function nvkm_object_mthd`, `function nvkm_object_ntfy`, `function nvkm_object_map`, `function nvkm_object_unmap`, `function nvkm_object_bind`, `function nvkm_object_fini`, `function nvkm_object_init`.
- 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.