Skip to content

Commit 8652da4

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: enable runpm support over BACO for SMU13.0.0
Enable SMU13.0.0 runpm support. Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Reviewed-by: Feifei Xu <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.0.x
1 parent f8794f3 commit 8652da4

File tree

6 files changed

+50
-20
lines changed

6 files changed

+50
-20
lines changed

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,14 @@ enum smu_cmn2asic_mapping_type {
13881388
CMN2ASIC_MAPPING_WORKLOAD,
13891389
};
13901390

1391+
enum smu_baco_seq {
1392+
BACO_SEQ_BACO = 0,
1393+
BACO_SEQ_MSR,
1394+
BACO_SEQ_BAMACO,
1395+
BACO_SEQ_ULPS,
1396+
BACO_SEQ_COUNT,
1397+
};
1398+
13911399
#define MSG_MAP(msg, index, valid_in_vf) \
13921400
[SMU_MSG_##msg] = {1, (index), (valid_in_vf)}
13931401

drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,6 @@ struct smu_11_5_power_context {
147147
uint32_t max_fast_ppt_limit;
148148
};
149149

150-
enum smu_v11_0_baco_seq {
151-
BACO_SEQ_BACO = 0,
152-
BACO_SEQ_MSR,
153-
BACO_SEQ_BAMACO,
154-
BACO_SEQ_ULPS,
155-
BACO_SEQ_COUNT,
156-
};
157-
158150
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3)
159151

160152
int smu_v11_0_init_microcode(struct smu_context *smu);
@@ -257,7 +249,7 @@ int smu_v11_0_baco_enter(struct smu_context *smu);
257249
int smu_v11_0_baco_exit(struct smu_context *smu);
258250

259251
int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu,
260-
enum smu_v11_0_baco_seq baco_seq);
252+
enum smu_baco_seq baco_seq);
261253

262254
int smu_v11_0_mode1_reset(struct smu_context *smu);
263255

drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,6 @@ struct smu_13_0_power_context {
124124
enum smu_13_0_power_state power_state;
125125
};
126126

127-
enum smu_v13_0_baco_seq {
128-
BACO_SEQ_BACO = 0,
129-
BACO_SEQ_MSR,
130-
BACO_SEQ_BAMACO,
131-
BACO_SEQ_ULPS,
132-
BACO_SEQ_COUNT,
133-
};
134-
135127
#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3)
136128

137129
int smu_v13_0_init_microcode(struct smu_context *smu);
@@ -218,6 +210,9 @@ int smu_v13_0_set_azalia_d3_pme(struct smu_context *smu);
218210
int smu_v13_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
219211
struct pp_smu_nv_clock_table *max_clocks);
220212

213+
int smu_v13_0_baco_set_armd3_sequence(struct smu_context *smu,
214+
enum smu_baco_seq baco_seq);
215+
221216
bool smu_v13_0_baco_is_support(struct smu_context *smu);
222217

223218
enum smu_baco_state smu_v13_0_baco_get_state(struct smu_context *smu);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)
15761576
}
15771577

15781578
int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu,
1579-
enum smu_v11_0_baco_seq baco_seq)
1579+
enum smu_baco_seq baco_seq)
15801580
{
15811581
return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ArmD3, baco_seq, NULL);
15821582
}

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,15 @@ int smu_v13_0_gfx_ulv_control(struct smu_context *smu,
22302230
return ret;
22312231
}
22322232

2233+
int smu_v13_0_baco_set_armd3_sequence(struct smu_context *smu,
2234+
enum smu_baco_seq baco_seq)
2235+
{
2236+
return smu_cmn_send_smc_msg_with_param(smu,
2237+
SMU_MSG_ArmD3,
2238+
baco_seq,
2239+
NULL);
2240+
}
2241+
22332242
bool smu_v13_0_baco_is_support(struct smu_context *smu)
22342243
{
22352244
struct smu_baco_context *smu_baco = &smu->smu_baco;

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
120120
MSG_MAP(Mode1Reset, PPSMC_MSG_Mode1Reset, 0),
121121
MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareMp1ForUnload, 0),
122122
MSG_MAP(DFCstateControl, PPSMC_MSG_SetExternalClientDfCstateAllow, 0),
123+
MSG_MAP(ArmD3, PPSMC_MSG_ArmD3, 0),
123124
};
124125

125126
static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -1566,6 +1567,31 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
15661567
NULL);
15671568
}
15681569

1570+
static int smu_v13_0_0_baco_enter(struct smu_context *smu)
1571+
{
1572+
struct smu_baco_context *smu_baco = &smu->smu_baco;
1573+
struct amdgpu_device *adev = smu->adev;
1574+
1575+
if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
1576+
return smu_v13_0_baco_set_armd3_sequence(smu,
1577+
smu_baco->maco_support ? BACO_SEQ_BAMACO : BACO_SEQ_BACO);
1578+
else
1579+
return smu_v13_0_baco_enter(smu);
1580+
}
1581+
1582+
static int smu_v13_0_0_baco_exit(struct smu_context *smu)
1583+
{
1584+
struct amdgpu_device *adev = smu->adev;
1585+
1586+
if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
1587+
/* Wait for PMFW handling for the Dstate change */
1588+
usleep_range(10000, 11000);
1589+
return smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
1590+
} else {
1591+
return smu_v13_0_baco_exit(smu);
1592+
}
1593+
}
1594+
15691595
static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)
15701596
{
15711597
struct amdgpu_device *adev = smu->adev;
@@ -1827,8 +1853,8 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
18271853
.baco_is_support = smu_v13_0_baco_is_support,
18281854
.baco_get_state = smu_v13_0_baco_get_state,
18291855
.baco_set_state = smu_v13_0_baco_set_state,
1830-
.baco_enter = smu_v13_0_baco_enter,
1831-
.baco_exit = smu_v13_0_baco_exit,
1856+
.baco_enter = smu_v13_0_0_baco_enter,
1857+
.baco_exit = smu_v13_0_0_baco_exit,
18321858
.mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported,
18331859
.mode1_reset = smu_v13_0_mode1_reset,
18341860
.set_mp1_state = smu_v13_0_0_set_mp1_state,

0 commit comments

Comments
 (0)