Skip to contentSkip to conversation

drm/amd/pm: call smu_cmn_get_smc_version in is_mode1_reset_supported.

PATCH Superseded Yifan Zhang 2 participants 2 messages Oct 24, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/pm: call smu_cmn_get_smc_version in is_mode1_reset_supported.

is_mode1_reset_supported may be called before smu init, when smu_context is unitialized in driver load/unload test. Call smu_cmn_get_smc_version explicitly is_mode1_reset_supported.

Fixes 5fe5098c64d9 ("drm/amd/pm: drop most smu_cmn_get_smc_version in smu")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 8 +++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c    | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +7 -1
index 090249b6422a..77c3d76c76a2 100644
@@ -2461,12 +2461,18 @@ static bool sienna_cichlid_is_mode1_reset_supported(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	uint32_t val;
+	uint32_t smu_version;
+	int ret;
 
 	/**
 	 * SRIOV env will not support SMU mode1 reset
 	 * PM FW support mode1 reset from 58.26
 	 */
-	if (amdgpu_sriov_vf(adev) || (smu->smc_fw_version < 0x003a1a00))
+	ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+	if (ret)
+		return false;
+
+	if (amdgpu_sriov_vf(adev) || (smu_version < 0x003a1a00))
 		return false;
 
 	/**
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -1
index b1433973380b..648d5eafb27b 100644
@@ -2615,13 +2615,19 @@ static int smu_v13_0_0_baco_exit(struct smu_context *smu)
 static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
+	u32 smu_version;
+	int ret;
 
 	/* SRIOV does not support SMU mode1 reset */
 	if (amdgpu_sriov_vf(adev))
 		return false;
 
 	/* PMFW support is available since 78.41 */
-	if (smu->smc_fw_version < 0x004e2900)
+	ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+	if (ret)
+		return false;
+
+	if (smu_version < 0x004e2900)
 		return false;
 
 	return true;
Signature · 1 line
2.37.3
maintainer Acked-by on v1 1/1
#1 lore raw

[Public]

________________________________
From: Zhang, Yifan <[email protected]>
Sent: Tuesday, October 24, 2023 9:41 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Li, Candice <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Yifan <[email protected]>
Subject: [PATCH] drm/amd/pm: call smu_cmn_get_smc_version in is_mode1_reset_supported.

is_mode1_reset_supported may be called before smu init, when smu_context is unitialized in driver load/unload test. Call smu_cmn_get_smc_version explicitly is_mode1_reset_supported.

Fixes 5fe5098c64d9 ("drm/amd/pm: drop most smu_cmn_get_smc_version in smu")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 8 +++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c    | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +7 -1
index 090249b6422a..77c3d76c76a2 100644
@@ -2461,12 +2461,18 @@ static bool sienna_cichlid_is_mode1_reset_supported(struct smu_context *smu)
 {
         struct amdgpu_device *adev = smu->adev;
         uint32_t val;
+       uint32_t smu_version;
+       int ret;
 
         /**
          * SRIOV env will not support SMU mode1 reset
          * PM FW support mode1 reset from 58.26
          */
-       if (amdgpu_sriov_vf(adev) || (smu->smc_fw_version < 0x003a1a00))
+       ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+       if (ret)
+               return false;
+
+       if (amdgpu_sriov_vf(adev) || (smu_version < 0x003a1a00))
                 return false;
 
         /**
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -1
index b1433973380b..648d5eafb27b 100644
@@ -2615,13 +2615,19 @@ static int smu_v13_0_0_baco_exit(struct smu_context *smu)
 static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)
 {
         struct amdgpu_device *adev = smu->adev;
+       u32 smu_version;
+       int ret;
 
         /* SRIOV does not support SMU mode1 reset */
         if (amdgpu_sriov_vf(adev))
                 return false;
 
         /* PMFW support is available since 78.41 */
-       if (smu->smc_fw_version < 0x004e2900)
+       ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+       if (ret)
+               return false;
+
+       if (smu_version < 0x004e2900)
                 return false;
 
         return true;

--
2.37.3