Skip to content

Commit 98a936c

Browse files
Yang Wangalexdeucher
authored andcommitted
drm/amdgpu: enable pp_od_clk_voltage for gfx 9.4.3 SRIOV
v1: enabel pp_od_clk_voltage node for gfx 9.4.3 SRIOV and BM. v2: add onevf check for gfx 9.4.3 v3: refine code check order to make function clearly. Signed-off-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1cb96a8 commit 98a936c

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,6 +2034,31 @@ static int ss_bias_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
20342034
return 0;
20352035
}
20362036

2037+
static int pp_od_clk_voltage_attr_update(struct amdgpu_device *adev, struct amdgpu_device_attr *attr,
2038+
uint32_t mask, enum amdgpu_device_attr_states *states)
2039+
{
2040+
uint32_t gc_ver = amdgpu_ip_version(adev, GC_HWIP, 0);
2041+
2042+
*states = ATTR_STATE_SUPPORTED;
2043+
2044+
if (!amdgpu_dpm_is_overdrive_supported(adev)) {
2045+
*states = ATTR_STATE_UNSUPPORTED;
2046+
return 0;
2047+
}
2048+
2049+
/* Enable pp_od_clk_voltage node for gc 9.4.3 SRIOV/BM support */
2050+
if (gc_ver == IP_VERSION(9, 4, 3)) {
2051+
if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
2052+
*states = ATTR_STATE_UNSUPPORTED;
2053+
return 0;
2054+
}
2055+
2056+
if (!(attr->flags & mask))
2057+
*states = ATTR_STATE_UNSUPPORTED;
2058+
2059+
return 0;
2060+
}
2061+
20372062
/* Following items will be read out to indicate current plpd policy:
20382063
* - -1: none
20392064
* - 0: disallow
@@ -2118,7 +2143,8 @@ static struct amdgpu_device_attr amdgpu_device_attrs[] = {
21182143
AMDGPU_DEVICE_ATTR_RW(pp_sclk_od, ATTR_FLAG_BASIC),
21192144
AMDGPU_DEVICE_ATTR_RW(pp_mclk_od, ATTR_FLAG_BASIC),
21202145
AMDGPU_DEVICE_ATTR_RW(pp_power_profile_mode, ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
2121-
AMDGPU_DEVICE_ATTR_RW(pp_od_clk_voltage, ATTR_FLAG_BASIC),
2146+
AMDGPU_DEVICE_ATTR_RW(pp_od_clk_voltage, ATTR_FLAG_BASIC,
2147+
.attr_update = pp_od_clk_voltage_attr_update),
21222148
AMDGPU_DEVICE_ATTR_RO(gpu_busy_percent, ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
21232149
AMDGPU_DEVICE_ATTR_RO(mem_busy_percent, ATTR_FLAG_BASIC|ATTR_FLAG_ONEVF),
21242150
AMDGPU_DEVICE_ATTR_RO(pcie_bw, ATTR_FLAG_BASIC),
@@ -2163,10 +2189,6 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
21632189
} else if (DEVICE_ATTR_IS(pp_dpm_fclk)) {
21642190
if (mp1_ver < IP_VERSION(10, 0, 0))
21652191
*states = ATTR_STATE_UNSUPPORTED;
2166-
} else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
2167-
*states = ATTR_STATE_UNSUPPORTED;
2168-
if (amdgpu_dpm_is_overdrive_supported(adev))
2169-
*states = ATTR_STATE_SUPPORTED;
21702192
} else if (DEVICE_ATTR_IS(mem_busy_percent)) {
21712193
if ((adev->flags & AMD_IS_APU &&
21722194
gc_ver != IP_VERSION(9, 4, 3)) ||

0 commit comments

Comments
 (0)