drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c- Extension
.c- Size
- 156604 bytes
- Lines
- 5135
- 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.hlinux/module.hamdgpu.hamdgpu_ih.hamdgpu_gfx.hcikd.hcik.hcik_structs.hatom.hamdgpu_ucode.hclearstate_ci.hdce/dce_8_0_d.hdce/dce_8_0_sh_mask.hbif/bif_4_1_d.hbif/bif_4_1_sh_mask.hgca/gfx_7_0_d.hgca/gfx_7_2_enum.hgca/gfx_7_2_sh_mask.hgmc/gmc_7_0_d.hgmc/gmc_7_0_sh_mask.hoss/oss_2_0_d.hoss/oss_2_0_sh_mask.h
Detected Declarations
function gfx_v7_0_free_microcodefunction driverfunction parametersfunction SHsfunction RBsfunction gfx_v7_0_raster_configfunction gfx_v7_0_write_harvested_raster_configsfunction gfx_v7_0_setup_rbfunction gfx_v7_0_init_compute_vmidfunction gfx_v7_0_init_gds_vmidfunction gfx_v7_0_config_initfunction gfx_v7_0_constants_initfunction gfx_v7_0_ring_test_ringfunction gfx_v7_0_ring_emit_hdp_flushfunction gfx_v7_0_ring_emit_vgt_flushfunction gfx_v7_0_ring_emit_fence_gfxfunction gfx_v7_0_ring_emit_fence_computefunction DEfunction gfx_v7_0_ring_emit_ib_computefunction ringfunction gfx_v7_ring_emit_cntxcntlfunction ringfunction Enginefunction gfx_v7_0_cp_gfx_load_microcodefunction gfx_v7_0_cp_gfx_startfunction gfx_v7_0_cp_gfx_resumefunction gfx_v7_0_ring_get_rptrfunction gfx_v7_0_ring_get_wptr_gfxfunction gfx_v7_0_ring_set_wptr_gfxfunction gfx_v7_0_ring_get_wptr_computefunction gfx_v7_0_ring_set_wptr_computefunction gfx_v7_0_cp_compute_enablefunction gfx_v7_0_cp_compute_load_microcodefunction gfx_v7_0_cp_compute_finifunction gfx_v7_0_mec_finifunction gfx_v7_0_mec_initfunction gfx_v7_0_compute_pipe_initfunction gfx_v7_0_mqd_deactivatefunction gfx_v7_0_mqd_initfunction gfx_v7_0_mqd_commitfunction gfx_v7_0_compute_queue_initfunction gfx_v7_0_cp_compute_resumefunction gfx_v7_0_cp_enablefunction gfx_v7_0_cp_load_microcodefunction gfx_v7_0_enable_gui_idle_interruptfunction gfx_v7_0_cp_resumefunction gfx_v7_0_ring_emit_pipeline_syncfunction CP
Annotated Snippet
if (!se_mask[0] && !se_mask[1]) {
raster_config_1 |=
SE_PAIR_MAP(RASTER_CONFIG_SE_PAIR_MAP_3);
} else {
raster_config_1 |=
SE_PAIR_MAP(RASTER_CONFIG_SE_PAIR_MAP_0);
}
}
for (se = 0; se < num_se; se++) {
unsigned raster_config_se = raster_config;
unsigned pkr0_mask = ((1 << rb_per_pkr) - 1) << (se * rb_per_se);
unsigned pkr1_mask = pkr0_mask << rb_per_pkr;
int idx = (se / 2) * 2;
if ((num_se > 1) && (!se_mask[idx] || !se_mask[idx + 1])) {
raster_config_se &= ~SE_MAP_MASK;
if (!se_mask[idx]) {
raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_3);
} else {
raster_config_se |= SE_MAP(RASTER_CONFIG_SE_MAP_0);
}
}
pkr0_mask &= rb_mask;
pkr1_mask &= rb_mask;
if (rb_per_se > 2 && (!pkr0_mask || !pkr1_mask)) {
raster_config_se &= ~PKR_MAP_MASK;
if (!pkr0_mask) {
raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_3);
} else {
raster_config_se |= PKR_MAP(RASTER_CONFIG_PKR_MAP_0);
}
}
if (rb_per_se >= 2) {
unsigned rb0_mask = 1 << (se * rb_per_se);
unsigned rb1_mask = rb0_mask << 1;
rb0_mask &= rb_mask;
rb1_mask &= rb_mask;
if (!rb0_mask || !rb1_mask) {
raster_config_se &= ~RB_MAP_PKR0_MASK;
if (!rb0_mask) {
raster_config_se |=
RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_3);
} else {
raster_config_se |=
RB_MAP_PKR0(RASTER_CONFIG_RB_MAP_0);
}
}
if (rb_per_se > 2) {
rb0_mask = 1 << (se * rb_per_se + rb_per_pkr);
rb1_mask = rb0_mask << 1;
rb0_mask &= rb_mask;
rb1_mask &= rb_mask;
if (!rb0_mask || !rb1_mask) {
raster_config_se &= ~RB_MAP_PKR1_MASK;
if (!rb0_mask) {
raster_config_se |=
RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_3);
} else {
raster_config_se |=
RB_MAP_PKR1(RASTER_CONFIG_RB_MAP_0);
}
}
}
}
/* GRBM_GFX_INDEX has a different offset on CI+ */
gfx_v7_0_select_se_sh(adev, se, 0xffffffff, 0xffffffff, 0);
WREG32(mmPA_SC_RASTER_CONFIG, raster_config_se);
WREG32(mmPA_SC_RASTER_CONFIG_1, raster_config_1);
}
/* GRBM_GFX_INDEX has a different offset on CI+ */
gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, 0);
}
/**
* gfx_v7_0_setup_rb - setup the RBs on the asic
*
* @adev: amdgpu_device pointer
*
* Configures per-SE/SH RB registers (CIK).
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `amdgpu.h`, `amdgpu_ih.h`, `amdgpu_gfx.h`, `cikd.h`, `cik.h`, `cik_structs.h`.
- Detected declarations: `function gfx_v7_0_free_microcode`, `function driver`, `function parameters`, `function SHs`, `function RBs`, `function gfx_v7_0_raster_config`, `function gfx_v7_0_write_harvested_raster_configs`, `function gfx_v7_0_setup_rb`, `function gfx_v7_0_init_compute_vmid`, `function gfx_v7_0_init_gds_vmid`.
- 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.