drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c- Extension
.c- Size
- 98238 bytes
- Lines
- 1367
- 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
hwmgr.hvega10_hwmgr.hvega10_smumgr.hvega10_powertune.hvega10_ppsmc.hvega10_inc.hpp_debug.hsoc15_common.h
Detected Declarations
function vega10_program_didt_config_registersfunction vega10_program_gc_didt_config_registersfunction vega10_didt_set_maskfunction vega10_enable_cac_driving_se_didt_configfunction vega10_disable_cac_driving_se_didt_configfunction vega10_enable_psm_gc_didt_configfunction vega10_disable_psm_gc_didt_configfunction vega10_enable_se_edc_configfunction vega10_disable_se_edc_configfunction vega10_enable_psm_gc_edc_configfunction vega10_disable_psm_gc_edc_configfunction vega10_enable_se_edc_force_stall_configfunction vega10_disable_se_edc_force_stall_configfunction vega10_enable_didt_configfunction vega10_disable_didt_configfunction vega10_initialize_power_tune_defaultsfunction vega10_set_power_limitfunction vega10_enable_power_containmentfunction vega10_disable_power_containmentfunction vega10_set_overdrive_target_percentagefunction vega10_power_control_set_level
Annotated Snippet
switch (reg_type) {
case VEGA10_CONFIGREG_DIDT:
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, config_regs->offset);
data &= ~config_regs->mask;
data |= ((config_regs->value << config_regs->shift) & config_regs->mask);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, config_regs->offset, data);
break;
case VEGA10_CONFIGREG_GCCAC:
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG_GC_CAC, config_regs->offset);
data &= ~config_regs->mask;
data |= ((config_regs->value << config_regs->shift) & config_regs->mask);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG_GC_CAC, config_regs->offset, data);
break;
case VEGA10_CONFIGREG_SECAC:
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG_SE_CAC, config_regs->offset);
data &= ~config_regs->mask;
data |= ((config_regs->value << config_regs->shift) & config_regs->mask);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG_SE_CAC, config_regs->offset, data);
break;
default:
return -EINVAL;
}
config_regs++;
}
return 0;
}
static int vega10_program_gc_didt_config_registers(struct pp_hwmgr *hwmgr, const struct vega10_didt_config_reg *config_regs)
{
uint32_t data;
while (config_regs->offset != 0xFFFFFFFF) {
data = cgs_read_register(hwmgr->device, config_regs->offset);
data &= ~config_regs->mask;
data |= ((config_regs->value << config_regs->shift) & config_regs->mask);
cgs_write_register(hwmgr->device, config_regs->offset, data);
config_regs++;
}
return 0;
}
static void vega10_didt_set_mask(struct pp_hwmgr *hwmgr, const bool enable)
{
uint32_t data;
uint32_t en = (enable ? 1 : 0);
uint32_t didt_block_info = SQ_IR_MASK | TCP_IR_MASK | TD_PCC_MASK;
if (PP_CAP(PHM_PlatformCaps_SQRamping)) {
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
DIDT_SQ_CTRL0, DIDT_CTRL_EN, en);
didt_block_info &= ~SQ_Enable_MASK;
didt_block_info |= en << SQ_Enable_SHIFT;
}
if (PP_CAP(PHM_PlatformCaps_DBRamping)) {
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
DIDT_DB_CTRL0, DIDT_CTRL_EN, en);
didt_block_info &= ~DB_Enable_MASK;
didt_block_info |= en << DB_Enable_SHIFT;
}
if (PP_CAP(PHM_PlatformCaps_TDRamping)) {
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
DIDT_TD_CTRL0, DIDT_CTRL_EN, en);
didt_block_info &= ~TD_Enable_MASK;
didt_block_info |= en << TD_Enable_SHIFT;
}
if (PP_CAP(PHM_PlatformCaps_TCPRamping)) {
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
DIDT_TCP_CTRL0, DIDT_CTRL_EN, en);
didt_block_info &= ~TCP_Enable_MASK;
didt_block_info |= en << TCP_Enable_SHIFT;
}
if (PP_CAP(PHM_PlatformCaps_DBRRamping)) {
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
DIDT_DBR_CTRL0, DIDT_CTRL_EN, en);
}
if (PP_CAP(PHM_PlatformCaps_DiDtEDCEnable)) {
if (PP_CAP(PHM_PlatformCaps_SQRamping)) {
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_SQ_EDC_CTRL);
data = REG_SET_FIELD(data, DIDT_SQ_EDC_CTRL, EDC_EN, en);
data = REG_SET_FIELD(data, DIDT_SQ_EDC_CTRL, EDC_SW_RST, ~en);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_SQ_EDC_CTRL, data);
}
Annotation
- Immediate include surface: `hwmgr.h`, `vega10_hwmgr.h`, `vega10_smumgr.h`, `vega10_powertune.h`, `vega10_ppsmc.h`, `vega10_inc.h`, `pp_debug.h`, `soc15_common.h`.
- Detected declarations: `function vega10_program_didt_config_registers`, `function vega10_program_gc_didt_config_registers`, `function vega10_didt_set_mask`, `function vega10_enable_cac_driving_se_didt_config`, `function vega10_disable_cac_driving_se_didt_config`, `function vega10_enable_psm_gc_didt_config`, `function vega10_disable_psm_gc_didt_config`, `function vega10_enable_se_edc_config`, `function vega10_disable_se_edc_config`, `function vega10_enable_psm_gc_edc_config`.
- 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.