drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c- Extension
.c- Size
- 6248 bytes
- Lines
- 217
- 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/rm.hrm/rpc.hasm-generic/video.hnvrm/gsp.hnvrm/rpcfn.hnvrm/msgfn.hcore/pci.hsubdev/pci/priv.h
Detected Declarations
function Copyrightfunction r570_gsp_drop_post_nocat_recordfunction r570_gsp_xlat_mc_engine_idxfunction r570_gsp_get_static_infofunction r570_gsp_acpi_infofunction r570_gsp_set_system_infofunction r570_gsp_set_rmargs
Annotated Snippet
if (gpc_mask & BIT(gpc)) {
ret = r570_gr_tpc_mask(gsp, gpc, &tpc_mask);
if (ret)
return ret;
gsp->gr.tpcs += hweight32(tpc_mask);
gsp->gr.gpcs++;
}
}
return 0;
}
static void
r570_gsp_acpi_info(struct nvkm_gsp *gsp, ACPI_METHOD_DATA *acpi)
{
#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
acpi_handle handle = ACPI_HANDLE(gsp->subdev.device->dev);
if (!handle)
return;
acpi->bValid = 1;
r535_gsp_acpi_dod(handle, &acpi->dodMethodData);
r535_gsp_acpi_jt(handle, &acpi->jtMethodData);
r535_gsp_acpi_caps(handle, &acpi->capsMethodData);
#endif
}
static int
r570_gsp_set_system_info(struct nvkm_gsp *gsp)
{
struct nvkm_device *device = gsp->subdev.device;
struct pci_dev *pdev = container_of(device, struct nvkm_device_pci, device)->pdev;
GspSystemInfo *info;
if (WARN_ON(device->type == NVKM_DEVICE_TEGRA))
return -ENOSYS;
info = nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_GSP_SET_SYSTEM_INFO, sizeof(*info));
if (IS_ERR(info))
return PTR_ERR(info);
info->gpuPhysAddr = device->func->resource_addr(device, NVKM_BAR0_PRI);
info->gpuPhysFbAddr = device->func->resource_addr(device, NVKM_BAR1_FB);
info->gpuPhysInstAddr = device->func->resource_addr(device, NVKM_BAR2_INST);
info->nvDomainBusDeviceFunc = pci_dev_id(pdev);
info->maxUserVa = TASK_SIZE;
info->pciConfigMirrorBase = device->pci->func->cfg.addr;
info->pciConfigMirrorSize = device->pci->func->cfg.size;
info->PCIDeviceID = (pdev->device << 16) | pdev->vendor;
info->PCISubDeviceID = (pdev->subsystem_device << 16) | pdev->subsystem_vendor;
info->PCIRevisionID = pdev->revision;
r570_gsp_acpi_info(gsp, &info->acpiMethodData);
info->bIsPrimary = video_is_primary_device(device->dev);
info->bPreserveVideoMemoryAllocations = false;
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOSEQ);
}
static void
r570_gsp_set_rmargs(struct nvkm_gsp *gsp, bool resume)
{
GSP_ARGUMENTS_CACHED *args;
args = gsp->rmargs.data;
args->messageQueueInitArguments.sharedMemPhysAddr = gsp->shm.mem.addr;
args->messageQueueInitArguments.pageTableEntryCount = gsp->shm.ptes.nr;
args->messageQueueInitArguments.cmdQueueOffset =
(u8 *)gsp->shm.cmdq.ptr - (u8 *)gsp->shm.mem.data;
args->messageQueueInitArguments.statQueueOffset =
(u8 *)gsp->shm.msgq.ptr - (u8 *)gsp->shm.mem.data;
if (!resume) {
args->srInitArguments.oldLevel = 0;
args->srInitArguments.flags = 0;
args->srInitArguments.bInPMTransition = 0;
} else {
args->srInitArguments.oldLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3;
args->srInitArguments.flags = 0;
args->srInitArguments.bInPMTransition = 1;
}
args->bDmemStack = 1;
}
const struct nvkm_rm_api_gsp
r570_gsp = {
.set_rmargs = r570_gsp_set_rmargs,
Annotation
- Immediate include surface: `rm/rm.h`, `rm/rpc.h`, `asm-generic/video.h`, `nvrm/gsp.h`, `nvrm/rpcfn.h`, `nvrm/msgfn.h`, `core/pci.h`, `subdev/pci/priv.h`.
- Detected declarations: `function Copyright`, `function r570_gsp_drop_post_nocat_record`, `function r570_gsp_xlat_mc_engine_idx`, `function r570_gsp_get_static_info`, `function r570_gsp_acpi_info`, `function r570_gsp_set_system_info`, `function r570_gsp_set_rmargs`.
- 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.