drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c- Extension
.c- Size
- 45826 bytes
- Lines
- 1485
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hamdgpu.hamdgpu_vcn.hamdgpu_pm.hsoc15.hsoc15d.hsoc15_hw_ip.hvcn_v2_0.hvcn/vcn_5_0_0_offset.hvcn/vcn_5_0_0_sh_mask.hivsrcid/vcn/irqsrcs_vcn_5_0.hvcn_v5_0_0.hdrm/drm_drv.h
Detected Declarations
function vcn_v5_0_0_early_initfunction vcn_v5_0_0_sw_initfunction vcn_v5_0_0_sw_finifunction vcn_v5_0_0_hw_initfunction vcn_v5_0_0_hw_finifunction vcn_v5_0_0_suspendfunction vcn_v5_0_0_resumefunction vcn_v5_0_0_mc_resumefunction vcn_v5_0_0_mc_resume_dpg_modefunction vcn_v5_0_0_disable_static_power_gatingfunction vcn_v5_0_0_enable_static_power_gatingfunction vcn_v5_0_0_disable_clock_gatingfunction vcn_v5_0_0_disable_clock_gating_dpg_modefunction vcn_v5_0_0_enable_clock_gatingfunction vcn_v5_0_0_start_dpg_modefunction vcn_v5_0_0_startfunction vcn_v5_0_0_stop_dpg_modefunction vcn_v5_0_0_stopfunction vcn_v5_0_0_pause_dpg_modefunction vcn_v5_0_0_unified_ring_get_rptrfunction vcn_v5_0_0_unified_ring_get_wptrfunction vcn_v5_0_0_unified_ring_set_wptrfunction vcn_v5_0_0_ring_resetfunction vcn_v5_0_0_set_unified_ring_funcsfunction vcn_v5_0_0_is_idlefunction vcn_v5_0_0_wait_for_idlefunction vcn_v5_0_0_set_clockgating_statefunction vcn_v5_0_0_set_pg_statefunction vcn_v5_0_0_process_interruptfunction vcn_v5_0_0_set_irq_funcs
Annotated Snippet
if (!amdgpu_sriov_vf(adev)) {
if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
(vinst->cur_state != AMD_PG_STATE_GATE &&
RREG32_SOC15(VCN, i, regUVD_STATUS))) {
vinst->set_pg_state(vinst, AMD_PG_STATE_GATE);
}
}
}
return 0;
}
/**
* vcn_v5_0_0_suspend - suspend VCN block
*
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
*
* HW fini and suspend VCN block
*/
static int vcn_v5_0_0_suspend(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
int r, i;
r = vcn_v5_0_0_hw_fini(ip_block);
if (r)
return r;
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
r = amdgpu_vcn_suspend(ip_block->adev, i);
if (r)
return r;
}
return r;
}
/**
* vcn_v5_0_0_resume - resume VCN block
*
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
*
* Resume firmware and hw init VCN block
*/
static int vcn_v5_0_0_resume(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
int r, i;
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
r = amdgpu_vcn_resume(ip_block->adev, i);
if (r)
return r;
}
r = vcn_v5_0_0_hw_init(ip_block);
return r;
}
/**
* vcn_v5_0_0_mc_resume - memory controller programming
*
* @vinst: VCN instance
*
* Let the VCN memory controller know it's offsets
*/
static void vcn_v5_0_0_mc_resume(struct amdgpu_vcn_inst *vinst)
{
struct amdgpu_device *adev = vinst->adev;
int inst = vinst->inst;
uint32_t offset, size;
const struct common_firmware_header *hdr;
hdr = (const struct common_firmware_header *)adev->vcn.inst[inst].fw->data;
size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8);
/* cache window 0: fw */
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
WREG32_SOC15(VCN, inst, regUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN + inst].tmr_mc_addr_lo));
WREG32_SOC15(VCN, inst, regUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN + inst].tmr_mc_addr_hi));
WREG32_SOC15(VCN, inst, regUVD_VCPU_CACHE_OFFSET0, 0);
offset = 0;
} else {
WREG32_SOC15(VCN, inst, regUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
lower_32_bits(adev->vcn.inst[inst].gpu_addr));
WREG32_SOC15(VCN, inst, regUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
upper_32_bits(adev->vcn.inst[inst].gpu_addr));
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_vcn.h`, `amdgpu_pm.h`, `soc15.h`, `soc15d.h`, `soc15_hw_ip.h`, `vcn_v2_0.h`.
- Detected declarations: `function vcn_v5_0_0_early_init`, `function vcn_v5_0_0_sw_init`, `function vcn_v5_0_0_sw_fini`, `function vcn_v5_0_0_hw_init`, `function vcn_v5_0_0_hw_fini`, `function vcn_v5_0_0_suspend`, `function vcn_v5_0_0_resume`, `function vcn_v5_0_0_mc_resume`, `function vcn_v5_0_0_mc_resume_dpg_mode`, `function vcn_v5_0_0_disable_static_power_gating`.
- 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.