drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c- Extension
.c- Size
- 69758 bytes
- Lines
- 2472
- 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.hlinux/module.hlinux/pci.hlinux/reboot.hamdgpu.hamdgpu_smu.hatomfirmware.hamdgpu_atomfirmware.hamdgpu_atombios.hsmu_v13_0.hsoc15_common.hatom.hamdgpu_ras.hsmu_cmn.hasic_reg/thm/thm_13_0_2_offset.hasic_reg/thm/thm_13_0_2_sh_mask.hasic_reg/mp/mp_13_0_2_offset.hasic_reg/mp/mp_13_0_2_sh_mask.hasic_reg/smuio/smuio_13_0_2_offset.hasic_reg/smuio/smuio_13_0_2_sh_mask.h
Detected Declarations
function smu_v13_0_init_microcodefunction smu_v13_0_fini_microcodefunction smu_v13_0_load_microcodefunction smu_v13_0_init_pptable_microcodefunction smu_v13_0_check_fw_statusfunction smu_v13_0_set_pptable_v2_0function smu_v13_0_set_pptable_v2_1function smu_v13_0_get_pptable_from_vbiosfunction smu_v13_0_get_pptable_from_firmwarefunction smu_v13_0_setup_pptablefunction smu_v13_0_init_smc_tablesfunction smu_v13_0_fini_smc_tablesfunction smu_v13_0_init_powerfunction smu_v13_0_fini_powerfunction smu_v13_0_get_vbios_bootup_valuesfunction smu_v13_0_notify_memory_pool_locationfunction smu_v13_0_set_driver_table_locationfunction smu_v13_0_set_tool_table_locationfunction smu_v13_0_set_allowed_maskfunction smu_v13_0_gfx_off_controlfunction smu_v13_0_system_features_controlfunction smu_v13_0_notify_display_changefunction smu_v13_0_get_max_sustainable_clockfunction smu_v13_0_init_max_sustainable_clocksfunction smu_v13_0_get_current_power_limitfunction smu_v13_0_set_power_limitfunction smu_v13_0_allow_ih_interruptfunction smu_v13_0_process_pending_interruptfunction smu_v13_0_enable_thermal_alertfunction smu_v13_0_disable_thermal_alertfunction convert_to_vddcfunction smu_v13_0_get_gfx_vddfunction smu_v13_0_get_fan_control_modefunction smu_v13_0_auto_fan_controlfunction smu_v13_0_set_fan_static_modefunction smu_v13_0_set_fan_speed_pwmfunction smu_v13_0_set_fan_control_modefunction smu_v13_0_set_fan_speed_rpmfunction smu_v13_0_set_xgmi_pstatefunction smu_v13_0_set_irq_statefunction smu_v13_0_interrupt_workfunction smu_v13_0_irq_processfunction smu_v13_0_register_irq_handlerfunction smu_v13_0_get_max_sustainable_clocks_by_dcfunction smu_v13_0_set_azalia_d3_pmefunction smu_v13_0_wait_for_reset_completefunction smu_v13_0_wait_for_eventfunction smu_v13_0_get_dpm_ultimate_freq
Annotated Snippet
if (le32_to_cpu(entries[i].id) == pptable_id) {
*table = ((uint8_t *)v2_1 + le32_to_cpu(entries[i].ppt_offset_bytes));
*size = le32_to_cpu(entries[i].ppt_size_bytes);
break;
}
}
if (i == pptable_count)
return -EINVAL;
return 0;
}
static int smu_v13_0_get_pptable_from_vbios(struct smu_context *smu, void **table, uint32_t *size)
{
struct amdgpu_device *adev = smu->adev;
uint16_t atom_table_size;
uint8_t frev, crev;
int ret, index;
dev_info(adev->dev, "use vbios provided pptable\n");
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
powerplayinfo);
ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
(uint8_t **)table);
if (ret)
return ret;
if (size)
*size = atom_table_size;
return 0;
}
int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu,
void **table,
uint32_t *size,
uint32_t pptable_id)
{
const struct smc_firmware_header_v1_0 *hdr;
struct amdgpu_device *adev = smu->adev;
uint16_t version_major, version_minor;
int ret;
hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
if (!hdr)
return -EINVAL;
dev_info(adev->dev, "use driver provided pptable %d\n", pptable_id);
version_major = le16_to_cpu(hdr->header.header_version_major);
version_minor = le16_to_cpu(hdr->header.header_version_minor);
if (version_major != 2) {
dev_err(adev->dev, "Unsupported smu firmware version %d.%d\n",
version_major, version_minor);
return -EINVAL;
}
switch (version_minor) {
case 0:
ret = smu_v13_0_set_pptable_v2_0(smu, table, size);
break;
case 1:
ret = smu_v13_0_set_pptable_v2_1(smu, table, size, pptable_id);
break;
default:
ret = -EINVAL;
break;
}
return ret;
}
int smu_v13_0_setup_pptable(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;
uint32_t size = 0, pptable_id = 0;
void *table;
int ret = 0;
/* override pptable_id from driver parameter */
if (amdgpu_smu_pptable_id >= 0) {
pptable_id = amdgpu_smu_pptable_id;
dev_info(adev->dev, "override pptable id %d\n", pptable_id);
} else {
pptable_id = smu->smu_table.boot_values.pp_table_id;
}
/* force using vbios pptable in sriov mode */
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/module.h`, `linux/pci.h`, `linux/reboot.h`, `amdgpu.h`, `amdgpu_smu.h`, `atomfirmware.h`, `amdgpu_atomfirmware.h`.
- Detected declarations: `function smu_v13_0_init_microcode`, `function smu_v13_0_fini_microcode`, `function smu_v13_0_load_microcode`, `function smu_v13_0_init_pptable_microcode`, `function smu_v13_0_check_fw_status`, `function smu_v13_0_set_pptable_v2_0`, `function smu_v13_0_set_pptable_v2_1`, `function smu_v13_0_get_pptable_from_vbios`, `function smu_v13_0_get_pptable_from_firmware`, `function smu_v13_0_setup_pptable`.
- 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.