drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c- Extension
.c- Size
- 239973 bytes
- Lines
- 7600
- 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/delay.hlinux/kernel.hlinux/firmware.hlinux/module.hlinux/pci.hamdgpu.hamdgpu_gfx.hamdgpu_psp.hamdgpu_smu.himu_v11_0.hsoc21.hnvd.hgc/gc_11_0_0_offset.hgc/gc_11_0_0_sh_mask.hsmuio/smuio_13_0_6_offset.hsmuio/smuio_13_0_6_sh_mask.hnavi10_enum.hivsrcid/gfx/irqsrcs_gfx_11_0_0.hsoc15.hclearstate_gfx11.hv11_structs.hgfx_v11_0.hgfx_v11_0_cleaner_shader.hgfx_v11_0_3.hnbio_v4_3.hmes_v11_0.hmes_userqueue.hamdgpu_userq_fence.h
Detected Declarations
function gfx11_kiq_set_resourcesfunction gfx11_kiq_map_queuesfunction gfx11_kiq_unmap_queuesfunction gfx11_kiq_query_statusfunction gfx11_kiq_invalidate_tlbsfunction gfx_v11_0_set_kiq_pm4_funcsfunction gfx_v11_0_init_golden_registersfunction gfx_v11_0_write_data_to_regfunction gfx_v11_0_wait_reg_memfunction gfx_v11_ring_insert_nopfunction gfx_v11_0_ring_test_ringfunction gfx_v11_0_ring_test_ibfunction gfx_v11_0_free_microcodefunction gfx_v11_0_init_toc_microcodefunction gfx_v11_0_check_fw_cp_gfx_shadowfunction gfx_v11_0_init_microcodefunction gfx_v11_0_get_csb_sizefunction gfx_v11_0_get_csb_bufferfunction gfx_v11_0_rlc_finifunction gfx_v11_0_init_rlcg_reg_access_ctrlfunction gfx_v11_0_rlc_initfunction gfx_v11_0_mec_finifunction gfx_v11_0_me_initfunction gfx_v11_0_mec_initfunction wave_read_indfunction wave_read_regsfunction gfx_v11_0_read_wave_datafunction gfx_v11_0_read_wave_sgprsfunction gfx_v11_0_read_wave_vgprsfunction gfx_v11_0_select_me_pipe_qfunction gfx_v11_0_get_gfx_shadow_info_nocheckfunction gfx_v11_0_get_gfx_shadow_infofunction gfx_v11_0_gpu_early_initfunction gfx_v11_0_gfx_ring_initfunction gfx_v11_0_compute_ring_initfunction gfx_v11_0_parse_rlc_tocfunction gfx_v11_0_calc_toc_total_sizefunction gfx_v11_0_rlc_autoload_buffer_initfunction gfx_v11_0_rlc_backdoor_autoload_copy_ucodefunction gfx_v11_0_rlc_backdoor_autoload_copy_toc_ucodefunction gfx_v11_0_rlc_backdoor_autoload_copy_gfx_ucodefunction gfx_v11_0_rlc_backdoor_autoload_copy_sdma_ucodefunction gfx_v11_0_rlc_backdoor_autoload_copy_mes_ucodefunction gfx_v11_0_rlc_backdoor_autoload_enablefunction gfx_v11_0_alloc_ip_dumpfunction gfx_v11_0_sw_initfunction IP_VERSIONfunction IP_VERSION
Annotated Snippet
if (r) {
dev_warn(adev->dev, "(%d) create HDP EOP bo failed\n", r);
gfx_v11_0_mec_fini(adev);
return r;
}
memset(hpd, 0, mec_hpd_size);
amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);
}
return 0;
}
static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t wave, uint32_t address)
{
WREG32_SOC15(GC, 0, regSQ_IND_INDEX,
(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
(address << SQ_IND_INDEX__INDEX__SHIFT));
return RREG32_SOC15(GC, 0, regSQ_IND_DATA);
}
static void wave_read_regs(struct amdgpu_device *adev, uint32_t wave,
uint32_t thread, uint32_t regno,
uint32_t num, uint32_t *out)
{
WREG32_SOC15(GC, 0, regSQ_IND_INDEX,
(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
(regno << SQ_IND_INDEX__INDEX__SHIFT) |
(thread << SQ_IND_INDEX__WORKITEM_ID__SHIFT) |
(SQ_IND_INDEX__AUTO_INCR_MASK));
while (num--)
*(out++) = RREG32_SOC15(GC, 0, regSQ_IND_DATA);
}
static void gfx_v11_0_read_wave_data(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields)
{
/* in gfx11 the SIMD_ID is specified as part of the INSTANCE
* field when performing a select_se_sh so it should be
* zero here */
WARN_ON(simd != 0);
/* type 3 wave data */
dst[(*no_fields)++] = 3;
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_STATUS);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_LO);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_PC_HI);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_EXEC_LO);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_EXEC_HI);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_HW_ID1);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_HW_ID2);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_GPR_ALLOC);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_LDS_ALLOC);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_TRAPSTS);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_IB_STS);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_IB_STS2);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_IB_DBG1);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_M0);
dst[(*no_fields)++] = wave_read_ind(adev, wave, ixSQ_WAVE_MODE);
}
static void gfx_v11_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd,
uint32_t wave, uint32_t start,
uint32_t size, uint32_t *dst)
{
WARN_ON(simd != 0);
wave_read_regs(
adev, wave, 0, start + SQIND_WAVE_SGPRS_OFFSET, size,
dst);
}
static void gfx_v11_0_read_wave_vgprs(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd,
uint32_t wave, uint32_t thread,
uint32_t start, uint32_t size,
uint32_t *dst)
{
wave_read_regs(
adev, wave, thread,
start + SQIND_WAVE_VGPRS_OFFSET, size, dst);
}
static void gfx_v11_0_select_me_pipe_q(struct amdgpu_device *adev,
u32 me, u32 pipe, u32 q, u32 vm, u32 xcc_id)
{
soc21_grbm_select(adev, me, pipe, q, vm);
}
/* all sizes are in bytes */
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/firmware.h`, `linux/module.h`, `linux/pci.h`, `amdgpu.h`, `amdgpu_gfx.h`, `amdgpu_psp.h`.
- Detected declarations: `function gfx11_kiq_set_resources`, `function gfx11_kiq_map_queues`, `function gfx11_kiq_unmap_queues`, `function gfx11_kiq_query_status`, `function gfx11_kiq_invalidate_tlbs`, `function gfx_v11_0_set_kiq_pm4_funcs`, `function gfx_v11_0_init_golden_registers`, `function gfx_v11_0_write_data_to_reg`, `function gfx_v11_0_wait_reg_mem`, `function gfx_v11_ring_insert_nop`.
- 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.