drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c- Extension
.c- Size
- 4531 bytes
- Lines
- 165
- 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/firmware.hsubdev/mc.hsubdev/timer.hnvfw/sec2.h
Detected Declarations
function Copyrightfunction nvkm_sec2_finifunction nvkm_sec2_initfunction nvkm_sec2_oneinitfunction nvkm_sec2_dtorfunction nvkm_sec2_new_
Annotated Snippet
#include "priv.h"
#include <core/firmware.h>
#include <subdev/mc.h>
#include <subdev/timer.h>
#include <nvfw/sec2.h>
static int
nvkm_sec2_finimsg(void *priv, struct nvfw_falcon_msg *hdr)
{
struct nvkm_sec2 *sec2 = priv;
atomic_set(&sec2->running, 0);
return 0;
}
static int
nvkm_sec2_fini(struct nvkm_engine *engine, enum nvkm_suspend_state suspend)
{
struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
struct nvkm_subdev *subdev = &sec2->engine.subdev;
struct nvkm_falcon *falcon = &sec2->falcon;
struct nvkm_falcon_cmdq *cmdq = sec2->cmdq;
struct nvfw_falcon_cmd cmd = {
.unit_id = sec2->func->unit_unload,
.size = sizeof(cmd),
};
int ret;
if (!subdev->use.enabled)
return 0;
if (atomic_read(&sec2->initmsg) == 1) {
ret = nvkm_falcon_cmdq_send(cmdq, &cmd, nvkm_sec2_finimsg, sec2,
msecs_to_jiffies(1000));
WARN_ON(ret);
nvkm_msec(subdev->device, 2000,
if (nvkm_falcon_rd32(falcon, 0x100) & 0x00000010)
break;
);
}
nvkm_inth_block(&subdev->inth);
nvkm_falcon_cmdq_fini(cmdq);
falcon->func->disable(falcon);
nvkm_falcon_put(falcon, subdev);
return 0;
}
static int
nvkm_sec2_init(struct nvkm_engine *engine)
{
struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
struct nvkm_subdev *subdev = &sec2->engine.subdev;
struct nvkm_falcon *falcon = &sec2->falcon;
int ret;
ret = nvkm_falcon_get(falcon, subdev);
if (ret)
return ret;
nvkm_falcon_wr32(falcon, 0x014, 0xffffffff);
atomic_set(&sec2->initmsg, 0);
atomic_set(&sec2->running, 1);
nvkm_inth_allow(&subdev->inth);
nvkm_falcon_start(falcon);
return 0;
}
static int
nvkm_sec2_oneinit(struct nvkm_engine *engine)
{
struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
struct nvkm_subdev *subdev = &sec2->engine.subdev;
struct nvkm_intr *intr = &sec2->engine.subdev.device->mc->intr;
enum nvkm_intr_type type = NVKM_INTR_SUBDEV;
if (sec2->func->intr_vector) {
intr = sec2->func->intr_vector(sec2, &type);
if (IS_ERR(intr))
return PTR_ERR(intr);
}
return nvkm_inth_add(intr, type, NVKM_INTR_PRIO_NORMAL, subdev, sec2->func->intr,
&subdev->inth);
}
Annotation
- Immediate include surface: `priv.h`, `core/firmware.h`, `subdev/mc.h`, `subdev/timer.h`, `nvfw/sec2.h`.
- Detected declarations: `function Copyright`, `function nvkm_sec2_fini`, `function nvkm_sec2_init`, `function nvkm_sec2_oneinit`, `function nvkm_sec2_dtor`, `function nvkm_sec2_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.