drivers/gpu/drm/nouveau/nouveau_abi16.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_abi16.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nouveau_abi16.c- Extension
.c- Size
- 23776 bytes
- Lines
- 920
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
nvif/client.hnvif/driver.hnvif/fifo.hnvif/ioctl.hnvif/class.hnvif/cl0002.hnvif/unpack.hnouveau_drv.hnouveau_dma.hnouveau_exec.hnouveau_gem.hnouveau_chan.hnouveau_abi16.hnouveau_vmm.hnouveau_sched.h
Detected Declarations
struct nouveau_abi16_objenum nouveau_abi16_obj_typefunction filesfunction nouveau_abi16_getfunction nouveau_abi16_putfunction nouveau_abi16_obj_findfunction list_for_each_entryfunction nouveau_abi16_obj_delfunction nouveau_abi16_obj_newfunction nouveau_abi16_swclassfunction nouveau_abi16_ntfy_finifunction nouveau_abi16_chan_finifunction nouveau_abi16_finifunction getparam_dma_ib_maxfunction nouveau_abi16_ioctl_getparamfunction nouveau_abi16_ioctl_get_zcull_infofunction nouveau_abi16_ioctl_channel_allocfunction nouveau_abi16_getfunction nouveau_abi16_chanfunction list_for_each_entryfunction nouveau_abi16_ioctl_channel_freefunction nouveau_abi16_ioctl_grobj_allocfunction nouveau_abi16_ioctl_notifierobj_allocfunction nouveau_abi16_ioctl_gpuobj_freefunction list_for_each_entryfunction nouveau_abi16_ioctl_mthdfunction nouveau_abi16_ioctl_delfunction nouveau_abi16_ioctl_newfunction nouveau_abi16_ioctl_sclassfunction nouveau_abi16_ioctl
Annotated Snippet
struct nouveau_abi16_obj {
enum nouveau_abi16_obj_type {
DEVICE,
ENGOBJ,
} type;
u64 object;
struct nvif_object engobj;
struct list_head head; /* protected by nouveau_abi16.cli.mutex */
};
static struct nouveau_abi16_obj *
nouveau_abi16_obj_find(struct nouveau_abi16 *abi16, u64 object)
{
struct nouveau_abi16_obj *obj;
list_for_each_entry(obj, &abi16->objects, head) {
if (obj->object == object)
return obj;
}
return NULL;
}
static void
nouveau_abi16_obj_del(struct nouveau_abi16_obj *obj)
{
list_del(&obj->head);
kfree(obj);
}
static struct nouveau_abi16_obj *
nouveau_abi16_obj_new(struct nouveau_abi16 *abi16, enum nouveau_abi16_obj_type type, u64 object)
{
struct nouveau_abi16_obj *obj;
obj = nouveau_abi16_obj_find(abi16, object);
if (obj)
return ERR_PTR(-EEXIST);
obj = kzalloc_obj(*obj);
if (!obj)
return ERR_PTR(-ENOMEM);
obj->type = type;
obj->object = object;
list_add_tail(&obj->head, &abi16->objects);
return obj;
}
s32
nouveau_abi16_swclass(struct nouveau_drm *drm)
{
switch (drm->client.device.info.family) {
case NV_DEVICE_INFO_V0_TNT:
return NVIF_CLASS_SW_NV04;
case NV_DEVICE_INFO_V0_CELSIUS:
case NV_DEVICE_INFO_V0_KELVIN:
case NV_DEVICE_INFO_V0_RANKINE:
case NV_DEVICE_INFO_V0_CURIE:
return NVIF_CLASS_SW_NV10;
case NV_DEVICE_INFO_V0_TESLA:
return NVIF_CLASS_SW_NV50;
case NV_DEVICE_INFO_V0_FERMI:
case NV_DEVICE_INFO_V0_KEPLER:
case NV_DEVICE_INFO_V0_MAXWELL:
case NV_DEVICE_INFO_V0_PASCAL:
case NV_DEVICE_INFO_V0_VOLTA:
return NVIF_CLASS_SW_GF100;
}
return 0x0000;
}
static void
nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
struct nouveau_abi16_ntfy *ntfy)
{
nvif_object_dtor(&ntfy->object);
nvkm_mm_free(&chan->heap, &ntfy->node);
list_del(&ntfy->head);
kfree(ntfy);
}
static void
nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
struct nouveau_abi16_chan *chan)
{
struct nouveau_abi16_ntfy *ntfy, *temp;
Annotation
- Immediate include surface: `nvif/client.h`, `nvif/driver.h`, `nvif/fifo.h`, `nvif/ioctl.h`, `nvif/class.h`, `nvif/cl0002.h`, `nvif/unpack.h`, `nouveau_drv.h`.
- Detected declarations: `struct nouveau_abi16_obj`, `enum nouveau_abi16_obj_type`, `function files`, `function nouveau_abi16_get`, `function nouveau_abi16_put`, `function nouveau_abi16_obj_find`, `function list_for_each_entry`, `function nouveau_abi16_obj_del`, `function nouveau_abi16_obj_new`, `function nouveau_abi16_swclass`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.