drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c- Extension
.c- Size
- 77108 bytes
- Lines
- 2422
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hamdgpu.hamdgpu_smu.hsmu_v15_0_8_pmfw.hsmu15_driver_if_v15_0_8.hsmu_v15_0_8_ppsmc.hsmu_v15_0_8_ppt.hlinux/pci.hsmu_cmn.hmp/mp_15_0_8_offset.hmp/mp_15_0_8_sh_mask.hsmu_v15_0.hamdgpu_fru_eeprom.h
Detected Declarations
function smu_v15_0_8_get_system_metrics_sizefunction smu_v15_0_8_tables_initfunction smu_v15_0_8_allocate_dpm_contextfunction smu_v15_0_8_init_smc_tablesfunction smu_v15_0_8_tables_finifunction smu_v15_0_8_fini_smc_tablesfunction smu_v15_0_8_init_allowed_featuresfunction smu_v15_0_8_get_metrics_table_internalfunction smu_v15_0_8_get_smu_metrics_datafunction for_each_hbm_stackfunction smu_v15_0_8_get_current_clk_freq_by_tablefunction smu_v15_0_8_get_current_activity_percentfunction smu_v15_0_8_thermal_get_temperaturefunction smu_v15_0_8_get_system_metrics_tablefunction smu_v15_0_8_get_npm_datafunction smu_v15_0_8_read_sensorfunction smu_v15_0_8_emit_clk_levelsfunction smu_v15_0_8_get_dpm_ultimate_freqfunction smu_v15_0_8_set_dpm_tablefunction smu_v15_0_8_setup_pptablefunction smu_v15_0_8_check_fw_statusfunction smu_v15_0_8_get_static_metrics_tablefunction smu_v15_0_8_fru_get_product_infofunction smu_v15_0_8_init_xgmi_datafunction smu_v15_0_8_set_driver_pptablefunction smu_v15_0_8_set_default_dpm_tablefunction smu_v15_0_8_irq_processfunction smu_v15_0_8_set_irq_statefunction smu_v15_0_8_register_irq_handlerfunction smu_v15_0_8_notify_unloadfunction smu_v15_0_8_system_features_controlfunction smu_v15_0_8_get_enabled_maskfunction smu_v15_0_8_is_dpm_runningfunction smu_v15_0_8_get_pm_metricsfunction smu_v15_0_8_mode2_resetfunction smu_v15_0_8_is_temp_metrics_supportedfunction smu_v15_0_8_fill_baseboard_temp_metricsfunction smu_v15_0_8_fill_gpuboard_temp_metricsfunction smu_v15_0_8_get_temp_metricsfunction smu_v15_0_8_get_xcp_metricsfunction for_each_xcpfunction smu_v15_0_8_get_gpu_metricsfunction for_each_hbm_stackfunction smu_v15_0_8_get_unique_idfunction smu_v15_0_8_get_power_limitfunction smu_v15_0_8_populate_umd_state_clkfunction smu_v15_0_8_set_gfx_soft_freq_limited_rangefunction smu_v15_0_8_set_performance_level
Annotated Snippet
time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(tmo))) {
int ret = smu_cmn_send_smc_msg(smu, SMU_MSG_GetMetricsTable, NULL);
if (ret) {
dev_info(adev->dev,
"Failed to export SMU metrics table!\n");
mutex_unlock(&smu_table->metrics_lock);
return ret;
}
amdgpu_device_invalidate_hdp(smu->adev, NULL);
ret = smu_cmn_vram_cpy(smu, smu_table->metrics_table,
table->cpu_addr, table_size);
if (ret) {
mutex_unlock(&smu_table->metrics_lock);
return ret;
}
smu_table->metrics_time = jiffies;
}
if (data)
memcpy(data, smu_table->metrics_table, table_size);
mutex_unlock(&smu_table->metrics_lock);
return 0;
}
static int smu_v15_0_8_get_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member, uint32_t *value)
{
struct smu_table_context *smu_table = &smu->smu_table;
MetricsTable_t *metrics = (MetricsTable_t *)smu_table->metrics_table;
struct amdgpu_device *adev = smu->adev;
int ret, xcc_id;
ret = smu_v15_0_8_get_metrics_table_internal(smu, 10, NULL);
if (ret)
return ret;
switch (member) {
case METRICS_CURR_GFXCLK:
case METRICS_AVERAGE_GFXCLK:
xcc_id = GET_INST(GC, 0);
*value = SMUQ10_ROUND(metrics->GfxclkFrequency[xcc_id]);
break;
case METRICS_CURR_SOCCLK:
case METRICS_AVERAGE_SOCCLK:
*value = SMUQ10_ROUND(metrics->SocclkFrequency[0]);
break;
case METRICS_CURR_UCLK:
case METRICS_AVERAGE_UCLK:
*value = SMUQ10_ROUND(metrics->UclkFrequency[0]);
break;
case METRICS_CURR_VCLK:
*value = SMUQ10_ROUND(metrics->VclkFrequency[0]);
break;
case METRICS_CURR_DCLK:
*value = SMUQ10_ROUND(metrics->DclkFrequency[0]);
break;
case METRICS_CURR_FCLK:
*value = SMUQ10_ROUND(metrics->FclkFrequency[0]);
break;
case METRICS_AVERAGE_GFXACTIVITY:
*value = SMUQ10_ROUND(metrics->SocketGfxBusy);
break;
case METRICS_AVERAGE_MEMACTIVITY:
*value = SMUQ10_ROUND(metrics->DramBandwidthUtilization);
break;
case METRICS_CURR_SOCKETPOWER:
*value = SMUQ10_ROUND(metrics->SocketPower) << 8;
break;
case METRICS_TEMPERATURE_HOTSPOT:
*value = SMUQ10_ROUND(metrics->MaxSocketTemperature) *
SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
break;
case METRICS_TEMPERATURE_MEM:
{
struct amdgpu_device *adev = smu->adev;
u32 max_hbm_temp = 0;
/* Find max temperature across all HBM stacks */
if (adev->umc.active_mask) {
u64 mask = adev->umc.active_mask;
int stack_idx;
for_each_hbm_stack(stack_idx, mask) {
u32 temp;
if (!hbm_stack_mask_valid(mask))
continue;
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_smu.h`, `smu_v15_0_8_pmfw.h`, `smu15_driver_if_v15_0_8.h`, `smu_v15_0_8_ppsmc.h`, `smu_v15_0_8_ppt.h`, `linux/pci.h`.
- Detected declarations: `function smu_v15_0_8_get_system_metrics_size`, `function smu_v15_0_8_tables_init`, `function smu_v15_0_8_allocate_dpm_context`, `function smu_v15_0_8_init_smc_tables`, `function smu_v15_0_8_tables_fini`, `function smu_v15_0_8_fini_smc_tables`, `function smu_v15_0_8_init_allowed_features`, `function smu_v15_0_8_get_metrics_table_internal`, `function smu_v15_0_8_get_smu_metrics_data`, `function for_each_hbm_stack`.
- 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.