drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c- Extension
.c- Size
- 128693 bytes
- Lines
- 4177
- 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.hamdgpu_atomfirmware.hamdgpu_userq_fence.himu_v12_1.hsoc_v1_0.hgfx_v12_1_pkt.hgc/gc_12_1_0_offset.hgc/gc_12_1_0_sh_mask.hsoc24_enum.hivsrcid/gfx/irqsrcs_gfx_12_1_0.hsoc15.hclearstate_gfx12.hv12_structs.hgfx_v12_1.hmes_v12_1.hamdgpu_ras_mgr.h
Detected Declarations
function gfx_v12_1_kiq_set_resourcesfunction gfx_v12_1_kiq_map_queuesfunction gfx_v12_1_kiq_unmap_queuesfunction gfx_v12_1_kiq_query_statusfunction gfx_v12_1_kiq_invalidate_tlbsfunction gfx_v12_1_set_kiq_pm4_funcsfunction gfx_v12_1_wait_reg_memfunction gfx_v12_1_ring_test_ringfunction gfx_v12_1_ring_test_ibfunction gfx_v12_1_free_microcodefunction gfx_v12_1_init_toc_microcodefunction gfx_v12_1_init_microcodefunction gfx_v12_1_get_csb_sizefunction gfx_v12_1_get_csb_bufferfunction gfx_v12_1_rlc_finifunction gfx_v12_1_init_rlcg_reg_access_ctrlfunction gfx_v12_1_rlc_initfunction gfx_v12_1_mec_finifunction gfx_v12_1_mec_initfunction wave_read_indfunction wave_read_regsfunction gfx_v12_1_read_wave_datafunction gfx_v12_1_read_wave_sgprsfunction gfx_v12_1_read_wave_vgprsfunction gfx_v12_1_select_me_pipe_qfunction gfx_v12_1_get_xccs_per_xcpfunction gfx_v12_1_ih_to_xcc_instfunction gfx_v12_1_gpu_early_initfunction gfx_v12_1_compute_ring_initfunction gfx_v12_1_parse_rlc_tocfunction gfx_v12_1_calc_toc_total_sizefunction gfx_v12_1_rlc_autoload_buffer_initfunction gfx_v12_1_rlc_backdoor_autoload_copy_ucodefunction gfx_v12_1_rlc_backdoor_autoload_copy_toc_ucodefunction gfx_v12_1_rlc_backdoor_autoload_copy_gfx_ucodefunction gfx_v12_1_rlc_backdoor_autoload_copy_sdma_ucodefunction gfx_v12_1_rlc_backdoor_autoload_copy_mes_ucodefunction gfx_v12_1_rlc_backdoor_autoload_enablefunction gfx_v12_1_sw_initfunction gfx_v12_1_rlc_autoload_buffer_finifunction gfx_v12_1_sw_finifunction gfx_v12_1_xcc_select_se_shfunction gfx_v12_1_get_sa_active_bitmapfunction gfx_v12_1_get_rb_active_bitmapfunction gfx_v12_1_setup_rbfunction gfx_v12_1_xcc_init_compute_vmidfunction gfx_v12_1_tcp_harvestfunction gfx_v12_1_xcc_constants_init
Annotated Snippet
if (adev->gfx.imu.funcs->init_microcode) {
err = adev->gfx.imu.funcs->init_microcode(adev);
if (err)
dev_err(adev->dev, "Failed to load imu firmware!\n");
}
}
out:
if (err) {
amdgpu_ucode_release(&adev->gfx.rlc_fw);
amdgpu_ucode_release(&adev->gfx.mec_fw);
}
return err;
}
static u32 gfx_v12_1_get_csb_size(struct amdgpu_device *adev)
{
u32 count = 0;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
count += 1;
for (sect = gfx12_cs_data; sect->section != NULL; ++sect) {
if (sect->id == SECT_CONTEXT) {
for (ext = sect->section; ext->extent != NULL; ++ext)
count += 2 + ext->reg_count;
} else
return 0;
}
return count;
}
static void gfx_v12_1_get_csb_buffer(struct amdgpu_device *adev, u32 *buffer)
{
u32 count = 0, clustercount = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data == NULL)
return;
if (buffer == NULL)
return;
count += 1;
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
if (sect->id == SECT_CONTEXT) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
clustercount++;
buffer[count++] = ext->reg_count;
buffer[count++] = ext->reg_index;
for (i = 0; i < ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
}
} else
return;
}
buffer[0] = clustercount;
}
static void gfx_v12_1_rlc_fini(struct amdgpu_device *adev)
{
/* clear state block */
amdgpu_bo_free_kernel(&adev->gfx.rlc.clear_state_obj,
&adev->gfx.rlc.clear_state_gpu_addr,
(void **)&adev->gfx.rlc.cs_ptr);
/* jump table block */
amdgpu_bo_free_kernel(&adev->gfx.rlc.cp_table_obj,
&adev->gfx.rlc.cp_table_gpu_addr,
(void **)&adev->gfx.rlc.cp_table_ptr);
}
static void gfx_v12_1_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
{
int xcc_id, num_xcc;
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
for (xcc_id = 0; xcc_id < num_xcc; xcc_id++) {
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[GET_INST(GC, xcc_id)];
reg_access_ctrl->grbm_cntl =
SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regGRBM_GFX_CNTL);
reg_access_ctrl->grbm_idx =
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 gfx_v12_1_kiq_set_resources`, `function gfx_v12_1_kiq_map_queues`, `function gfx_v12_1_kiq_unmap_queues`, `function gfx_v12_1_kiq_query_status`, `function gfx_v12_1_kiq_invalidate_tlbs`, `function gfx_v12_1_set_kiq_pm4_funcs`, `function gfx_v12_1_wait_reg_mem`, `function gfx_v12_1_ring_test_ring`, `function gfx_v12_1_ring_test_ib`, `function gfx_v12_1_free_microcode`.
- 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.