drivers/gpu/drm/amd/amdgpu/df_v3_6.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/df_v3_6.c- Extension
.c- Size
- 18962 bytes
- Lines
- 686
- 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.hdf_v3_6.hdf/df_3_6_default.hdf/df_3_6_offset.hdf/df_3_6_sh_mask.h
Detected Declarations
function df_v3_6_get_ficafunction df_v3_6_set_ficafunction df_v3_6_perfmon_rregfunction df_v3_6_perfmon_wregfunction df_v3_6_perfmon_arm_with_statusfunction df_v3_6_perfmon_arm_with_retryfunction df_v3_6_get_df_cntr_availfunction df_v3_6_query_hashesfunction df_v3_6_sw_initfunction df_v3_6_sw_finifunction df_v3_6_enable_broadcast_modefunction df_v3_6_get_fb_channel_numberfunction df_v3_6_get_hbm_channel_numberfunction df_v3_6_update_medium_grain_clock_gatingfunction df_v3_6_get_clockgating_statefunction df_v3_6_pmc_has_counterfunction df_v3_6_pmc_get_addrfunction df_v3_6_pmc_get_read_settingsfunction df_v3_6_pmc_get_ctrl_settingsfunction df_v3_6_pmc_add_cntrfunction df_v3_6_pmc_set_deferredfunction df_v3_6_pmc_is_deferredfunction df_v3_6_pmc_release_cntrfunction df_v3_6_reset_perfmon_cntrfunction df_v3_6_pmc_startfunction df_v3_6_pmc_stopfunction df_v3_6_pmc_get_countfunction df_v3_6_query_ras_poison_mode
Annotated Snippet
if (enable) {
tmp = RREG32_SOC15(DF, 0,
mmDF_PIE_AON0_DfGlobalClkGater);
tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK;
tmp |= DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY;
WREG32_SOC15(DF, 0,
mmDF_PIE_AON0_DfGlobalClkGater, tmp);
} else {
tmp = RREG32_SOC15(DF, 0,
mmDF_PIE_AON0_DfGlobalClkGater);
tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK;
tmp |= DF_V3_6_MGCG_DISABLE;
WREG32_SOC15(DF, 0,
mmDF_PIE_AON0_DfGlobalClkGater, tmp);
}
/* Exit broadcast mode */
adev->df.funcs->enable_broadcast_mode(adev, false);
}
}
static void df_v3_6_get_clockgating_state(struct amdgpu_device *adev,
u64 *flags)
{
u32 tmp;
/* AMD_CG_SUPPORT_DF_MGCG */
tmp = RREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater);
if (tmp & DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY)
*flags |= AMD_CG_SUPPORT_DF_MGCG;
}
/* get assigned df perfmon ctr as int */
static bool df_v3_6_pmc_has_counter(struct amdgpu_device *adev,
uint64_t config,
int counter_idx)
{
return ((config & 0x0FFFFFFUL) ==
adev->df_perfmon_config_assign_mask[counter_idx]);
}
/* get address based on counter assignment */
static void df_v3_6_pmc_get_addr(struct amdgpu_device *adev,
uint64_t config,
int counter_idx,
int is_ctrl,
uint32_t *lo_base_addr,
uint32_t *hi_base_addr)
{
if (!df_v3_6_pmc_has_counter(adev, config, counter_idx))
return;
switch (counter_idx) {
case 0:
*lo_base_addr = is_ctrl ? smnPerfMonCtlLo4 : smnPerfMonCtrLo4;
*hi_base_addr = is_ctrl ? smnPerfMonCtlHi4 : smnPerfMonCtrHi4;
break;
case 1:
*lo_base_addr = is_ctrl ? smnPerfMonCtlLo5 : smnPerfMonCtrLo5;
*hi_base_addr = is_ctrl ? smnPerfMonCtlHi5 : smnPerfMonCtrHi5;
break;
case 2:
*lo_base_addr = is_ctrl ? smnPerfMonCtlLo6 : smnPerfMonCtrLo6;
*hi_base_addr = is_ctrl ? smnPerfMonCtlHi6 : smnPerfMonCtrHi6;
break;
case 3:
*lo_base_addr = is_ctrl ? smnPerfMonCtlLo7 : smnPerfMonCtrLo7;
*hi_base_addr = is_ctrl ? smnPerfMonCtlHi7 : smnPerfMonCtrHi7;
break;
}
}
/* get read counter address */
static void df_v3_6_pmc_get_read_settings(struct amdgpu_device *adev,
uint64_t config,
int counter_idx,
uint32_t *lo_base_addr,
uint32_t *hi_base_addr)
{
df_v3_6_pmc_get_addr(adev, config, counter_idx, 0, lo_base_addr,
hi_base_addr);
}
/* get control counter settings i.e. address and values to set */
static int df_v3_6_pmc_get_ctrl_settings(struct amdgpu_device *adev,
Annotation
- Immediate include surface: `amdgpu.h`, `df_v3_6.h`, `df/df_3_6_default.h`, `df/df_3_6_offset.h`, `df/df_3_6_sh_mask.h`.
- Detected declarations: `function df_v3_6_get_fica`, `function df_v3_6_set_fica`, `function df_v3_6_perfmon_rreg`, `function df_v3_6_perfmon_wreg`, `function df_v3_6_perfmon_arm_with_status`, `function df_v3_6_perfmon_arm_with_retry`, `function df_v3_6_get_df_cntr_avail`, `function df_v3_6_query_hashes`, `function df_v3_6_sw_init`, `function df_v3_6_sw_fini`.
- 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.