drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c- Extension
.c- Size
- 119876 bytes
- Lines
- 3669
- 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.hamdgpu_ucode.hclearstate_si.hsi.hsid.hbif/bif_3_0_d.hbif/bif_3_0_sh_mask.hoss/oss_1_0_d.hoss/oss_1_0_sh_mask.hgca/gfx_6_0_d.hgca/gfx_6_0_sh_mask.hgca/gfx_7_2_enum.hgmc/gmc_6_0_d.hgmc/gmc_6_0_sh_mask.hdce/dce_6_0_d.hdce/dce_6_0_sh_mask.hsi_enums.h
Detected Declarations
function gfx_v6_0_init_microcodefunction gfx_v6_0_tiling_mode_table_initfunction gfx_v6_0_select_se_shfunction gfx_v6_0_get_rb_active_bitmapfunction gfx_v6_0_raster_configfunction gfx_v6_0_write_harvested_raster_configsfunction gfx_v6_0_setup_rbfunction gfx_v6_0_set_user_cu_inactive_bitmapfunction gfx_v6_0_get_cu_enabledfunction gfx_v6_0_setup_spifunction gfx_v6_0_setup_tccfunction gfx_v6_0_config_initfunction gfx_v6_0_constants_initfunction gfx_v6_0_ring_test_ringfunction gfx_v6_0_ring_emit_vgt_flushfunction gfx_v6_0_ring_emit_fencefunction gfx_v6_0_ring_emit_ibfunction ringfunction gfx_v6_0_cp_gfx_enablefunction gfx_v6_0_cp_gfx_load_microcodefunction gfx_v6_0_cp_gfx_startfunction gfx_v6_0_cp_gfx_resumefunction gfx_v6_0_ring_get_rptrfunction gfx_v6_0_ring_get_wptrfunction gfx_v6_0_ring_set_wptr_gfxfunction gfx_v6_0_ring_set_wptr_computefunction gfx_v6_0_cp_compute_resumefunction gfx_v6_0_cp_enablefunction gfx_v6_0_cp_load_microcodefunction gfx_v6_0_enable_gui_idle_interruptfunction gfx_v6_0_cp_resumefunction gfx_v6_0_ring_emit_pipeline_syncfunction gfx_v6_0_ring_emit_vm_flushfunction gfx_v6_0_ring_emit_wregfunction gfx_v6_0_rlc_initfunction gfx_v6_0_enable_lbpwfunction gfx_v6_0_wait_for_rlc_serdesfunction gfx_v6_0_update_rlcfunction gfx_v6_0_halt_rlcfunction gfx_v6_0_rlc_stopfunction gfx_v6_0_rlc_startfunction gfx_v6_0_rlc_resetfunction gfx_v6_0_lbpw_supportedfunction gfx_v6_0_init_cgfunction gfx_v6_0_enable_cgcgfunction gfx_v6_0_enable_mgcgfunction gfx_v6_0_update_cgfunction gfx_v6_0_enable_sclk_slowdown_on_pu
Annotated Snippet
if ((num_se > 1) && (!se_mask[idx] || !se_mask[idx + 1])) {
raster_config_se &= ~PA_SC_RASTER_CONFIG__SE_MAP_MASK;
if (!se_mask[idx])
raster_config_se |= RASTER_CONFIG_SE_MAP_3 << PA_SC_RASTER_CONFIG__SE_MAP__SHIFT;
else
raster_config_se |= RASTER_CONFIG_SE_MAP_0 << PA_SC_RASTER_CONFIG__SE_MAP__SHIFT;
}
pkr0_mask &= rb_mask;
pkr1_mask &= rb_mask;
if (rb_per_se > 2 && (!pkr0_mask || !pkr1_mask)) {
raster_config_se &= ~PA_SC_RASTER_CONFIG__PKR_MAP_MASK;
if (!pkr0_mask)
raster_config_se |= RASTER_CONFIG_PKR_MAP_3 << PA_SC_RASTER_CONFIG__PKR_MAP__SHIFT;
else
raster_config_se |= RASTER_CONFIG_PKR_MAP_0 << PA_SC_RASTER_CONFIG__PKR_MAP__SHIFT;
}
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 &= ~PA_SC_RASTER_CONFIG__RB_MAP_PKR0_MASK;
if (!rb0_mask)
raster_config_se |=
RASTER_CONFIG_RB_MAP_3 << PA_SC_RASTER_CONFIG__RB_MAP_PKR0__SHIFT;
else
raster_config_se |=
RASTER_CONFIG_RB_MAP_0 << PA_SC_RASTER_CONFIG__RB_MAP_PKR0__SHIFT;
}
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 &= ~PA_SC_RASTER_CONFIG__RB_MAP_PKR1_MASK;
if (!rb0_mask)
raster_config_se |=
RASTER_CONFIG_RB_MAP_3 << PA_SC_RASTER_CONFIG__RB_MAP_PKR1__SHIFT;
else
raster_config_se |=
RASTER_CONFIG_RB_MAP_0 << PA_SC_RASTER_CONFIG__RB_MAP_PKR1__SHIFT;
}
}
}
/* GRBM_GFX_INDEX has a different offset on SI */
gfx_v6_0_select_se_sh(adev, se, 0xffffffff, 0xffffffff, 0);
WREG32(mmPA_SC_RASTER_CONFIG, raster_config_se);
}
/* GRBM_GFX_INDEX has a different offset on SI */
gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, 0);
}
static void gfx_v6_0_setup_rb(struct amdgpu_device *adev)
{
int i, j;
u32 data;
u32 raster_config = 0;
u32 active_rbs = 0;
u32 rb_bitmap_width_per_sh = adev->gfx.config.max_backends_per_se /
adev->gfx.config.max_sh_per_se;
unsigned num_rb_pipes;
mutex_lock(&adev->grbm_idx_mutex);
for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
gfx_v6_0_select_se_sh(adev, i, j, 0xffffffff, 0);
data = gfx_v6_0_get_rb_active_bitmap(adev);
active_rbs |= data <<
((i * adev->gfx.config.max_sh_per_se + j) *
rb_bitmap_width_per_sh);
}
}
gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, 0);
adev->gfx.config.backend_enable_mask = active_rbs;
adev->gfx.config.num_rbs = hweight32(active_rbs);
num_rb_pipes = min_t(unsigned, adev->gfx.config.max_backends_per_se *
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `amdgpu.h`, `amdgpu_ih.h`, `amdgpu_gfx.h`, `amdgpu_ucode.h`, `clearstate_si.h`, `si.h`.
- Detected declarations: `function gfx_v6_0_init_microcode`, `function gfx_v6_0_tiling_mode_table_init`, `function gfx_v6_0_select_se_sh`, `function gfx_v6_0_get_rb_active_bitmap`, `function gfx_v6_0_raster_config`, `function gfx_v6_0_write_harvested_raster_configs`, `function gfx_v6_0_setup_rb`, `function gfx_v6_0_set_user_cu_inactive_bitmap`, `function gfx_v6_0_get_cu_enabled`, `function gfx_v6_0_setup_spi`.
- 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.