drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c- Extension
.c- Size
- 167069 bytes
- Lines
- 5139
- 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_gfx.hsoc15.hsoc15d.hsoc15_common.hvega10_enum.hv9_structs.hivsrcid/gfx/irqsrcs_gfx_9_0.hgc/gc_9_4_3_offset.hgc/gc_9_4_3_sh_mask.hgfx_v9_4_3.hgfx_v9_4_3_cleaner_shader.hamdgpu_xcp.hamdgpu_aca.h
Detected Declarations
enum amdgpu_gfx_cp_ras_mem_idenum amdgpu_gfx_gcea_ras_mem_idenum amdgpu_gfx_gc_cane_ras_mem_idenum amdgpu_gfx_gcutcl2_ras_mem_idenum amdgpu_gfx_gds_ras_mem_idenum amdgpu_gfx_lds_ras_mem_idenum amdgpu_gfx_rlc_ras_mem_idenum amdgpu_gfx_sp_ras_mem_idenum amdgpu_gfx_spi_ras_mem_idenum amdgpu_gfx_sqc_ras_mem_idenum amdgpu_gfx_sq_ras_mem_idenum amdgpu_gfx_ta_ras_mem_idenum amdgpu_gfx_tcc_ras_mem_idenum amdgpu_gfx_tca_ras_mem_idenum amdgpu_gfx_tci_ras_mem_idenum amdgpu_gfx_tcp_ras_mem_idenum amdgpu_gfx_td_ras_mem_idenum amdgpu_gfx_tcx_ras_mem_idenum amdgpu_gfx_atc_l2_ras_mem_idenum amdgpu_gfx_utcl2_ras_mem_idenum amdgpu_gfx_vml2_ras_mem_idenum amdgpu_gfx_vml2_walker_ras_mem_idfunction gfx_v9_4_3_kiq_set_resourcesfunction gfx_v9_4_3_kiq_map_queuesfunction gfx_v9_4_3_kiq_unmap_queuesfunction gfx_v9_4_3_kiq_query_statusfunction gfx_v9_4_3_kiq_invalidate_tlbsfunction gfx_v9_4_3_kiq_reset_hw_queuefunction gfx_v9_4_3_set_kiq_pm4_funcsfunction gfx_v9_4_3_init_golden_registersfunction gfx_v9_4_3_normalize_xcc_reg_offsetfunction gfx_v9_4_3_write_data_to_regfunction gfx_v9_4_3_wait_reg_memfunction gfx_v9_4_3_ring_test_ringfunction gfx_v9_4_3_ring_test_ibfunction gfx_v9_4_3_get_gpu_clock_counterfunction gfx_v9_4_3_free_microcodefunction gfx_v9_4_3_init_rlc_microcodefunction gfx_v9_4_3_init_cp_compute_microcodefunction gfx_v9_4_3_init_microcodefunction gfx_v9_4_3_mec_finifunction gfx_v9_4_3_mec_initfunction gfx_v9_4_3_xcc_select_se_shfunction wave_read_indfunction wave_read_regsfunction gfx_v9_4_3_read_wave_datafunction gfx_v9_4_3_read_wave_sgprsfunction gfx_v9_4_3_read_wave_vgprs
Annotated Snippet
if (r) {
dev_warn(adev->dev, "(%d) create HDP EOP bo failed\n", r);
gfx_v9_4_3_mec_fini(adev);
return r;
}
if (amdgpu_emu_mode == 1) {
for (i = 0; i < mec_hpd_size / 4; i++) {
memset((void *)(hpd + i), 0, 4);
if (i % 50 == 0)
msleep(1);
}
} else {
memset(hpd, 0, mec_hpd_size);
}
amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);
}
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_warn(adev->dev, "(%d) create mec firmware bo failed\n", r);
gfx_v9_4_3_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 void gfx_v9_4_3_xcc_select_se_sh(struct amdgpu_device *adev, u32 se_num,
u32 sh_num, u32 instance, int xcc_id)
{
u32 data;
if (instance == 0xffffffff)
data = REG_SET_FIELD(0, GRBM_GFX_INDEX,
INSTANCE_BROADCAST_WRITES, 1);
else
data = REG_SET_FIELD(0, GRBM_GFX_INDEX,
INSTANCE_INDEX, instance);
if (se_num == 0xffffffff)
data = REG_SET_FIELD(data, GRBM_GFX_INDEX,
SE_BROADCAST_WRITES, 1);
else
data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_INDEX, se_num);
if (sh_num == 0xffffffff)
data = REG_SET_FIELD(data, GRBM_GFX_INDEX,
SH_BROADCAST_WRITES, 1);
else
data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_INDEX, sh_num);
WREG32_SOC15_RLC_SHADOW_EX(reg, GC, GET_INST(GC, xcc_id), regGRBM_GFX_INDEX, data);
}
static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd, uint32_t wave, uint32_t address)
{
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regSQ_IND_INDEX,
(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
(simd << SQ_IND_INDEX__SIMD_ID__SHIFT) |
(address << SQ_IND_INDEX__INDEX__SHIFT) |
(SQ_IND_INDEX__FORCE_READ_MASK));
return RREG32_SOC15(GC, GET_INST(GC, xcc_id), regSQ_IND_DATA);
}
static void wave_read_regs(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd,
uint32_t wave, uint32_t thread,
uint32_t regno, uint32_t num, uint32_t *out)
{
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regSQ_IND_INDEX,
(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
(simd << SQ_IND_INDEX__SIMD_ID__SHIFT) |
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_gfx.h`, `soc15.h`, `soc15d.h`, `soc15_common.h`, `vega10_enum.h`, `v9_structs.h`.
- Detected declarations: `enum amdgpu_gfx_cp_ras_mem_id`, `enum amdgpu_gfx_gcea_ras_mem_id`, `enum amdgpu_gfx_gc_cane_ras_mem_id`, `enum amdgpu_gfx_gcutcl2_ras_mem_id`, `enum amdgpu_gfx_gds_ras_mem_id`, `enum amdgpu_gfx_lds_ras_mem_id`, `enum amdgpu_gfx_rlc_ras_mem_id`, `enum amdgpu_gfx_sp_ras_mem_id`, `enum amdgpu_gfx_spi_ras_mem_id`, `enum amdgpu_gfx_sqc_ras_mem_id`.
- 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.