drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c- Extension
.c- Size
- 38888 bytes
- Lines
- 1547
- 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
amdgpu.hamdgpu_smu.hsmu_cmn.hsoc15_common.h
Detected Declarations
function smu_msg_v1_send_debug_msgfunction __smu_cmn_send_debug_msgfunction smu_msg_v1_decode_responsefunction smu_cmn_send_smc_msg_with_params_extfunction smu_msg_v1_decode_responsefunction smu_cmn_send_smc_msgfunction smu_cmn_send_debug_smc_msgfunction smu_cmn_send_debug_smc_msg_with_paramfunction smu_msg_v1_decode_responsefunction __smu_msg_v1_poll_statfunction __smu_msg_v1_sendfunction __smu_msg_v1_read_out_argsfunction __smu_msg_v1_print_err_limitedfunction __smu_msg_v1_print_errorfunction __smu_msg_v1_ras_filterfunction smu_msg_v1_send_msgfunction smu_msg_v1_wait_responsefunction smu_msg_wait_responsefunction smu_msg_wait_responsefunction smu_cmn_to_asic_specific_indexfunction smu_cmn_feature_is_supportedfunction __smu_get_enabled_featuresfunction smu_cmn_feature_is_enabledfunction smu_cmn_clk_dpm_is_enabledfunction smu_cmn_get_enabled_maskfunction smu_cmn_get_indep_throttler_statusfunction smu_cmn_feature_update_enable_statefunction smu_cmn_feature_set_enabledfunction smu_cmn_get_pp_feature_maskfunction smu_cmn_set_pp_feature_maskfunction smu_cmn_disable_all_features_with_exceptionfunction smu_cmn_get_smc_versionfunction smu_cmn_check_fw_versionfunction smu_cmn_update_table_read_argfunction smu_cmn_vram_cpyfunction smu_cmn_write_watermarks_tablefunction smu_cmn_write_pptablefunction smu_cmn_get_metrics_tablefunction smu_cmn_get_combo_pptablefunction smu_cmn_set_mp1_statefunction smu_cmn_is_audio_func_enabledfunction smu_cmn_generic_soc_policy_descfunction smu_cmn_generic_plpd_policy_descfunction smu_cmn_get_backend_workload_maskfunction smu_cmn_reset_custom_levelfunction smu_cmn_freqs_matchfunction smu_cmn_print_dpm_clk_levelsfunction smu_cmn_print_pcie_levels
Annotated Snippet
if (args->num_args > 0) {
for (i = 0; i < args->num_args; i++)
in[i] = RREG32(ctl->config.arg_regs[i]);
print_hex_dump(KERN_ERR, "in params:", DUMP_PREFIX_NONE,
16, 4, in, args->num_args * sizeof(u32),
false);
}
}
}
static void __smu_msg_v1_print_error(struct smu_msg_ctl *ctl,
u32 resp,
struct smu_msg_args *args)
{
struct smu_context *smu = ctl->smu;
struct amdgpu_device *adev = smu->adev;
int index = ctl->message_map[args->msg].map_to;
switch (resp) {
case SMU_RESP_NONE:
__smu_msg_v1_print_err_limited(ctl, args, "SMU: No response");
break;
case SMU_RESP_OK:
break;
case SMU_RESP_CMD_FAIL:
break;
case SMU_RESP_CMD_UNKNOWN:
__smu_msg_v1_print_err_limited(ctl, args,
"SMU: unknown command");
break;
case SMU_RESP_CMD_BAD_PREREQ:
__smu_msg_v1_print_err_limited(
ctl, args, "SMU: valid command, bad prerequisites");
break;
case SMU_RESP_BUSY_OTHER:
if (args->msg != SMU_MSG_GetBadPageCount)
__smu_msg_v1_print_err_limited(ctl, args,
"SMU: I'm very busy");
break;
case SMU_RESP_DEBUG_END:
__smu_msg_v1_print_err_limited(ctl, args, "SMU: Debug Err");
break;
case SMU_RESP_UNEXP:
if (amdgpu_device_bus_status_check(adev)) {
dev_err(adev->dev,
"SMU: bus error for message: %s(%d) response:0x%08X ",
smu_get_message_name(smu, args->msg), index,
resp);
if (args->num_args > 0)
print_hex_dump(KERN_ERR,
"in params:", DUMP_PREFIX_NONE,
16, 4, args->args,
args->num_args * sizeof(u32),
false);
}
break;
default:
__smu_msg_v1_print_err_limited(ctl, args,
"SMU: unknown response");
break;
}
}
static int __smu_msg_v1_ras_filter(struct smu_msg_ctl *ctl,
enum smu_message_type msg, u32 msg_flags,
bool *skip_pre_poll)
{
struct smu_context *smu = ctl->smu;
struct amdgpu_device *adev = smu->adev;
bool fed_status;
u32 reg;
if (!(smu->smc_fw_caps & SMU_FW_CAP_RAS_PRI))
return 0;
fed_status = amdgpu_ras_get_fed_status(adev);
/* Block non-RAS-priority messages during RAS error */
if (fed_status && !(msg_flags & SMU_MSG_RAS_PRI)) {
dev_dbg(adev->dev, "RAS error detected, skip sending %s",
smu_get_message_name(smu, msg));
return -EACCES;
}
/* Skip pre-poll for priority messages or during RAS error */
if ((msg_flags & SMU_MSG_NO_PRECHECK) || fed_status) {
reg = RREG32(ctl->config.resp_reg);
dev_dbg(adev->dev,
"Sending priority message %s response status: %x",
smu_get_message_name(smu, msg), reg);
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_smu.h`, `smu_cmn.h`, `soc15_common.h`.
- Detected declarations: `function smu_msg_v1_send_debug_msg`, `function __smu_cmn_send_debug_msg`, `function smu_msg_v1_decode_response`, `function smu_cmn_send_smc_msg_with_params_ext`, `function smu_msg_v1_decode_response`, `function smu_cmn_send_smc_msg`, `function smu_cmn_send_debug_smc_msg`, `function smu_cmn_send_debug_smc_msg_with_param`, `function smu_msg_v1_decode_response`, `function __smu_msg_v1_poll_stat`.
- 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.