drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c- Extension
.c- Size
- 9016 bytes
- Lines
- 347
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
gf100.hctxgf100.hcore/firmware.hsubdev/timer.hnvif/class.h
Detected Declarations
struct gk20a_fw_avstruct gk20a_fw_aivfunction gk20a_gr_av_to_init_function gk20a_gr_av_to_initfunction gk20a_gr_aiv_to_initfunction gk20a_gr_av_to_methodfunction gk20a_gr_wait_mem_scrubbingfunction gk20a_gr_set_hww_esr_report_maskfunction gk20a_gr_initfunction gk20a_gr_load_netfunction gk20a_gr_load_swfunction gk20a_gr_loadfunction gk20a_gr_new
Annotated Snippet
if (prevclass != class) {
if (prevclass) /* Add terminator to the method list. */
init++;
pack[classidx].init = init;
pack[classidx].type = class;
prevclass = class;
if (++classidx >= max_classes) {
vfree(pack);
return -ENOSPC;
}
}
init->addr = addr;
init->data = av->data;
init->count = 1;
init->pitch = 1;
}
*ppack = pack;
return 0;
}
static int
gk20a_gr_wait_mem_scrubbing(struct gf100_gr *gr)
{
struct nvkm_subdev *subdev = &gr->base.engine.subdev;
struct nvkm_device *device = subdev->device;
if (nvkm_msec(device, 2000,
if (!(nvkm_rd32(device, 0x40910c) & 0x00000006))
break;
) < 0) {
nvkm_error(subdev, "FECS mem scrubbing timeout\n");
return -ETIMEDOUT;
}
if (nvkm_msec(device, 2000,
if (!(nvkm_rd32(device, 0x41a10c) & 0x00000006))
break;
) < 0) {
nvkm_error(subdev, "GPCCS mem scrubbing timeout\n");
return -ETIMEDOUT;
}
return 0;
}
static void
gk20a_gr_set_hww_esr_report_mask(struct gf100_gr *gr)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
nvkm_wr32(device, 0x419e44, 0x1ffffe);
nvkm_wr32(device, 0x419e4c, 0x7f);
}
int
gk20a_gr_init(struct gf100_gr *gr)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
int ret;
/* Clear SCC RAM */
nvkm_wr32(device, 0x40802c, 0x1);
gf100_gr_mmio(gr, gr->sw_nonctx);
ret = gk20a_gr_wait_mem_scrubbing(gr);
if (ret)
return ret;
ret = gf100_gr_wait_idle(gr);
if (ret)
return ret;
/* MMU debug buffer */
if (gr->func->init_gpc_mmu)
gr->func->init_gpc_mmu(gr);
/* Set the PE as stream master */
nvkm_mask(device, 0x503018, 0x1, 0x1);
/* Zcull init */
gr->func->init_zcull(gr);
gr->func->init_rop_active_fbps(gr);
/* Enable FIFO access */
nvkm_wr32(device, 0x400500, 0x00010001);
/* Enable interrupts */
Annotation
- Immediate include surface: `gf100.h`, `ctxgf100.h`, `core/firmware.h`, `subdev/timer.h`, `nvif/class.h`.
- Detected declarations: `struct gk20a_fw_av`, `struct gk20a_fw_aiv`, `function gk20a_gr_av_to_init_`, `function gk20a_gr_av_to_init`, `function gk20a_gr_aiv_to_init`, `function gk20a_gr_av_to_method`, `function gk20a_gr_wait_mem_scrubbing`, `function gk20a_gr_set_hww_esr_report_mask`, `function gk20a_gr_init`, `function gk20a_gr_load_net`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.