Skip to content

Commit 3e55845

Browse files
Likun Gaoalexdeucher
authored andcommitted
drm/amd/swsmu: add smu v14_0_2 support
Add initial support for smu v14_0_2. v2: fix warnings (Alex) v3: squash in various fixes (Alex) v4: squash in various fixes (Alex) v5: remove hardcoded pptable id (Alex) v6: update fw version (Alex) v7: squash in more updates (Alex) v8: rebase, squash in pptable override updates, combo table updates, SW CTF support (Alex) Signed-off-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Likun Gao <Likun.Gao@amd.com> Reviewed-by: Likun Gao <Likun.Gao@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent fefa83f commit 3e55845

5 files changed

Lines changed: 1864 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define SMU14_DRIVER_IF_VERSION_INV 0xFFFFFFFF
2929
#define SMU14_DRIVER_IF_VERSION_SMU_V14_0_0 0x7
3030
#define SMU14_DRIVER_IF_VERSION_SMU_V14_0_1 0x6
31-
#define SMU14_DRIVER_IF_VERSION_SMU_V14_0_2 0x1
31+
#define SMU14_DRIVER_IF_VERSION_SMU_V14_0_2 0x25
3232

3333
#define FEATURE_MASK(feature) (1ULL << feature)
3434

drivers/gpu/drm/amd/pm/swsmu/smu14/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Makefile for the 'smu manager' sub-component of powerplay.
2424
# It provides the smu management services for the driver.
2525

26-
SMU14_MGR = smu_v14_0.o smu_v14_0_0_ppt.o
26+
SMU14_MGR = smu_v14_0.o smu_v14_0_0_ppt.o smu_v14_0_2_ppt.o
2727

2828
AMD_SWSMU_SMU14MGR = $(addprefix $(AMD_SWSMU_PATH)/smu14/,$(SMU14_MGR))
2929

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ int smu_v14_0_init_pptable_microcode(struct smu_context *smu)
172172
if (!adev->scpm_enabled)
173173
return 0;
174174

175+
if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 2)) ||
176+
(amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 3)))
177+
return 0;
178+
175179
/* override pptable_id from driver parameter */
176180
if (amdgpu_smu_pptable_id >= 0) {
177181
pptable_id = amdgpu_smu_pptable_id;
@@ -245,6 +249,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
245249
smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_1;
246250
break;
247251
case IP_VERSION(14, 0, 2):
252+
case IP_VERSION(14, 0, 3):
248253
smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_2;
249254
break;
250255
default:
@@ -895,11 +900,32 @@ static int smu_v14_0_set_irq_state(struct amdgpu_device *adev,
895900
return 0;
896901
}
897902

903+
#define THM_11_0__SRCID__THM_DIG_THERM_L2H 0 /* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH */
904+
#define THM_11_0__SRCID__THM_DIG_THERM_H2L 1 /* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL */
905+
898906
static int smu_v14_0_irq_process(struct amdgpu_device *adev,
899907
struct amdgpu_irq_src *source,
900908
struct amdgpu_iv_entry *entry)
901909
{
902-
// TODO
910+
struct smu_context *smu = adev->powerplay.pp_handle;
911+
uint32_t client_id = entry->client_id;
912+
uint32_t src_id = entry->src_id;
913+
914+
if (client_id == SOC15_IH_CLIENTID_THM) {
915+
switch (src_id) {
916+
case THM_11_0__SRCID__THM_DIG_THERM_L2H:
917+
schedule_delayed_work(&smu->swctf_delayed_work,
918+
msecs_to_jiffies(AMDGPU_SWCTF_EXTRA_DELAY));
919+
break;
920+
case THM_11_0__SRCID__THM_DIG_THERM_H2L:
921+
dev_emerg(adev->dev, "ERROR: GPU under temperature range detected\n");
922+
break;
923+
default:
924+
dev_emerg(adev->dev, "ERROR: GPU under temperature range unknown src id (%d)\n",
925+
src_id);
926+
break;
927+
}
928+
}
903929

904930
return 0;
905931
}
@@ -921,7 +947,17 @@ int smu_v14_0_register_irq_handler(struct smu_context *smu)
921947
irq_src->num_types = 1;
922948
irq_src->funcs = &smu_v14_0_irq_funcs;
923949

924-
// TODO: THM related
950+
ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_THM,
951+
THM_11_0__SRCID__THM_DIG_THERM_L2H,
952+
irq_src);
953+
if (ret)
954+
return ret;
955+
956+
ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_THM,
957+
THM_11_0__SRCID__THM_DIG_THERM_H2L,
958+
irq_src);
959+
if (ret)
960+
return ret;
925961

926962
ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
927963
SMU_IH_INTERRUPT_ID_TO_DRIVER,

0 commit comments

Comments
 (0)