drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gr.c- Extension
.c- Size
- 6429 bytes
- Lines
- 222
- 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
rm/gr.hsubdev/mmu.hengine/fifo.hengine/fifo/chid.hengine/gr/priv.hnvrm/gr.hnvrm/engine.h
Detected Declarations
function Copyrightfunction r570_gr_gpc_maskfunction r570_gr_scrubber_ctrlfunction r570_gr_scrubber_finifunction r570_gr_scrubber_initfunction r570_gr_get_ctxbufs_and_zcull_info
Annotated Snippet
#include <rm/gr.h>
#include <subdev/mmu.h>
#include <engine/fifo.h>
#include <engine/fifo/chid.h>
#include <engine/gr/priv.h>
#include "nvrm/gr.h"
#include "nvrm/engine.h"
int
r570_gr_tpc_mask(struct nvkm_gsp *gsp, int gpc, u32 *pmask)
{
NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMS *ctrl;
int ret;
ctrl = nvkm_gsp_rm_ctrl_get(&gsp->internal.device.subdevice,
NV2080_CTRL_CMD_GPU_GET_FERMI_TPC_INFO, sizeof(*ctrl));
if (IS_ERR(ctrl))
return PTR_ERR(ctrl);
ctrl->gpcId = gpc;
ret = nvkm_gsp_rm_ctrl_push(&gsp->internal.device.subdevice, &ctrl, sizeof(*ctrl));
if (ret)
return ret;
*pmask = ctrl->tpcMask;
nvkm_gsp_rm_ctrl_done(&gsp->internal.device.subdevice, ctrl);
return 0;
}
int
r570_gr_gpc_mask(struct nvkm_gsp *gsp, u32 *pmask)
{
NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS *ctrl;
ctrl = nvkm_gsp_rm_ctrl_rd(&gsp->internal.device.subdevice,
NV2080_CTRL_CMD_GPU_GET_FERMI_GPC_INFO, sizeof(*ctrl));
if (IS_ERR(ctrl))
return PTR_ERR(ctrl);
*pmask = ctrl->gpcMask;
nvkm_gsp_rm_ctrl_done(&gsp->internal.device.subdevice, ctrl);
return 0;
}
static int
r570_gr_scrubber_ctrl(struct r535_gr *gr, bool teardown)
{
NV2080_CTRL_INTERNAL_GR_INIT_BUG4208224_WAR_PARAMS *ctrl;
ctrl = nvkm_gsp_rm_ctrl_get(&gr->scrubber.vmm->rm.device.subdevice,
NV2080_CTRL_CMD_INTERNAL_KGR_INIT_BUG4208224_WAR,
sizeof(*ctrl));
if (IS_ERR(ctrl))
return PTR_ERR(ctrl);
ctrl->bTeardown = teardown;
return nvkm_gsp_rm_ctrl_wr(&gr->scrubber.vmm->rm.device.subdevice, ctrl);
}
static void
r570_gr_scrubber_fini(struct r535_gr *gr)
{
/* Teardown scrubber channel on RM. */
if (gr->scrubber.enabled) {
WARN_ON(r570_gr_scrubber_ctrl(gr, true));
gr->scrubber.enabled = false;
}
/* Free scrubber channel. */
nvkm_gsp_rm_free(&gr->scrubber.threed);
nvkm_gsp_rm_free(&gr->scrubber.chan);
for (int i = 0; i < gr->ctxbuf_nr; i++) {
nvkm_vmm_put(gr->scrubber.vmm, &gr->scrubber.ctxbuf.vma[i]);
nvkm_memory_unref(&gr->scrubber.ctxbuf.mem[i]);
}
nvkm_vmm_unref(&gr->scrubber.vmm);
nvkm_memory_unref(&gr->scrubber.inst);
}
static int
r570_gr_scrubber_init(struct r535_gr *gr)
{
Annotation
- Immediate include surface: `rm/gr.h`, `subdev/mmu.h`, `engine/fifo.h`, `engine/fifo/chid.h`, `engine/gr/priv.h`, `nvrm/gr.h`, `nvrm/engine.h`.
- Detected declarations: `function Copyright`, `function r570_gr_gpc_mask`, `function r570_gr_scrubber_ctrl`, `function r570_gr_scrubber_fini`, `function r570_gr_scrubber_init`, `function r570_gr_get_ctxbufs_and_zcull_info`.
- 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.