drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c- Extension
.c- Size
- 462254 bytes
- Lines
- 10242
- 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.hnv.hnvd.hgc/gc_10_1_0_offset.hgc/gc_10_1_0_sh_mask.hsmuio/smuio_11_0_0_offset.hsmuio/smuio_11_0_0_sh_mask.hnavi10_enum.hivsrcid/gfx/irqsrcs_gfx_10_1.hsoc15.hsoc15_common.hclearstate_gfx10.hv10_structs.hgfx_v10_0.hgfx_v10_0_cleaner_shader.hnbio_v2_3.h
Detected Declarations
function gfx10_kiq_set_resourcesfunction gfx10_kiq_map_queuesfunction gfx10_kiq_unmap_queuesfunction gfx10_kiq_query_statusfunction gfx10_kiq_invalidate_tlbsfunction gfx_v10_0_kiq_reset_hw_queuefunction gfx_v10_0_set_kiq_pm4_funcsfunction gfx_v10_0_init_spm_golden_registersfunction gfx_v10_0_init_golden_registersfunction gfx_v10_0_write_data_to_regfunction gfx_v10_0_wait_reg_memfunction gfx_v10_0_ring_test_ringfunction gfx_v10_0_ring_test_ibfunction gfx_v10_0_free_microcodefunction gfx_v10_0_check_fw_write_waitfunction gfx_v10_0_navi10_gfxoff_should_enablefunction gfx_v10_0_check_gfxoff_flagfunction gfx_v10_0_init_microcodefunction gfx_v10_0_get_csb_sizefunction gfx_v10_0_get_csb_bufferfunction gfx_v10_0_rlc_finifunction gfx_v10_0_init_rlcg_reg_access_ctrlfunction gfx_v10_0_rlc_initfunction gfx_v10_0_mec_finifunction gfx_v10_0_me_initfunction gfx_v10_0_mec_initfunction wave_read_indfunction wave_read_regsfunction gfx_v10_0_read_wave_datafunction gfx_v10_0_read_wave_sgprsfunction gfx_v10_0_read_wave_vgprsfunction gfx_v10_0_select_me_pipe_qfunction gfx_v10_0_update_perfmon_mgcgfunction gfx_v10_0_gpu_early_initfunction gfx_v10_0_gfx_ring_initfunction gfx_v10_0_compute_ring_initfunction gfx_v10_0_alloc_ip_dumpfunction gfx_v10_0_sw_initfunction gfx_v10_0_pfp_finifunction gfx_v10_0_ce_finifunction gfx_v10_0_me_finifunction gfx_v10_0_sw_finifunction gfx_v10_0_select_se_shfunction gfx_v10_0_get_rb_active_bitmapfunction gfx_v10_0_setup_rbfunction gfx_v10_0_init_pa_sc_tile_steering_overridefunction gfx_v10_0_debug_trap_config_initfunction gfx_v10_0_init_compute_vmid
Annotated Snippet
if (r) {
dev_warn(adev->dev, "(%d) create HDP EOP bo failed\n", r);
gfx_v10_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);
}
if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
fw_data = (const __le32 *) (adev->gfx.mec_fw->data +
le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes));
fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes);
r = amdgpu_bo_create_reserved(adev, mec_hdr->header.ucode_size_bytes,
PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
&adev->gfx.mec.mec_fw_obj,
&adev->gfx.mec.mec_fw_gpu_addr,
(void **)&fw);
if (r) {
dev_err(adev->dev, "(%d) failed to create mec fw bo\n", r);
gfx_v10_0_mec_fini(adev);
return r;
}
memcpy(fw, fw_data, fw_size);
amdgpu_bo_kunmap(adev->gfx.mec.mec_fw_obj);
amdgpu_bo_unreserve(adev->gfx.mec.mec_fw_obj);
}
return 0;
}
static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t wave, uint32_t address)
{
WREG32_SOC15(GC, 0, mmSQ_IND_INDEX,
(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
(address << SQ_IND_INDEX__INDEX__SHIFT));
return RREG32_SOC15(GC, 0, mmSQ_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, mmSQ_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, mmSQ_IND_DATA);
}
static void gfx_v10_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 gfx10 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 2 wave data */
dst[(*no_fields)++] = 2;
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_INST_DW0);
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_v10_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd,
uint32_t wave, uint32_t start,
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 gfx10_kiq_set_resources`, `function gfx10_kiq_map_queues`, `function gfx10_kiq_unmap_queues`, `function gfx10_kiq_query_status`, `function gfx10_kiq_invalidate_tlbs`, `function gfx_v10_0_kiq_reset_hw_queue`, `function gfx_v10_0_set_kiq_pm4_funcs`, `function gfx_v10_0_init_spm_golden_registers`, `function gfx_v10_0_init_golden_registers`, `function gfx_v10_0_write_data_to_reg`.
- 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.