Skip to contentSkip to conversation

drm/amd/pm: Add warning for unexpected PG requests

PATCH In review Lijo Lazar 3 participants 3 messages Nov 26, 2021

Subsystems (3)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH v2 1/1 drm/amd/pm: Add warning for unexpected PG requests

v1: Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

v2: Use dev_WARN to log device info (Felix/Guchun).

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5 -1
index e156add7b560..ea99afb38d2b 100644
@@ -277,8 +277,12 @@ static int smu_dpm_set_power_gate(void *handle,
 	struct smu_context *smu = handle;
 	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		dev_WARN(smu->adev->dev,
+			 "SMU uninitialized but power %s requested for %u!\n",
+			 gate ? "gate" : "ungate", block_type);
 		return -EOPNOTSUPP;
+	}
 
 	switch (block_type) {
 	/*
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw

[Public]

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Friday, November 26, 2021 1:25 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH v2] drm/amd/pm: Add warning for unexpected PG requests

v1: Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

v2: Use dev_WARN to log device info (Felix/Guchun).

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5 -1
index e156add7b560..ea99afb38d2b 100644
@@ -277,8 +277,12 @@ static int smu_dpm_set_power_gate(void *handle,
 	struct smu_context *smu = handle;
 	int ret = 0;
 
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+		dev_WARN(smu->adev->dev,
+			 "SMU uninitialized but power %s requested for %u!\n",
+			 gate ? "gate" : "ungate", block_type);
 		return -EOPNOTSUPP;
+	}
 
 	switch (block_type) {
 	/*

--
2.25.1

Reviewed-by on v2 1/1
#2 lore raw
In reply to Lijo Lazar

[AMD Official Use Only]

Best Regards,
Kevin
________________________________
From: amd-gfx <[email protected]> on behalf of Lijo Lazar <[email protected]>
Sent: Friday, November 26, 2021 1:25 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH v2] drm/amd/pm: Add warning for unexpected PG requests

v1: Ideally power gate/ungate requests shouldn't come when smu block is uninitialized. Add a WARN message to check the origins if such a thing ever happens.

v2: Use dev_WARN to log device info (Felix/Guchun).

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5 -1
index e156add7b560..ea99afb38d2b 100644
@@ -277,8 +277,12 @@ static int smu_dpm_set_power_gate(void *handle,
         struct smu_context *smu = handle;
         int ret = 0;
 
-       if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+       if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
+               dev_WARN(smu->adev->dev,
+                        "SMU uninitialized but power %s requested for %u!\n",
+                        gate ? "gate" : "ungate", block_type);
                 return -EOPNOTSUPP;
+       }
 
         switch (block_type) {
         /*

--
2.25.1